Update main.yml #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: restaurant_menu_workflow | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
env: | |
DB_HOST_TEST: ${{ secrets.DB_HOST_TEST }} | |
DB_PORT: ${{ secrets.DB_PORT }} | |
DB_NAME: ${{ secrets.DB_NAME }} | |
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
services: | |
postgres: | |
image: postgres:15.1-alpine | |
env: | |
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Debug secrets | |
run: | | |
echo "DB_HOST_TEST: ${{ secrets.DB_HOST_TEST }}" | |
echo "DB_PORT: ${{ secrets.DB_PORT }}" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pep8-naming flake8-broken-line flake8-return flake8-isort | |
cd restaurant_menu/ | |
pip install --no-cache-dir -r requirements.txt | |
- name: Test with flake8 | |
run: | | |
python -m flake8 restaurant_menu/src/ | |
python -m flake8 restaurant_menu/tests/ | |
- name: Test with Pytest (menu/routers) | |
run: | | |
pytest -v restaurant_menu/tests/test_routers.py | |
- name: Test with Pytest (postman-script) | |
run: | | |
pytest -v restaurant_menu/tests/test_script_count_dishes_and_submenus.py |