Merge pull request #36 from mateuszszymaniak/working_branch #24
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: Food Helper CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: ['3.11'] | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: ${{ vars.POSTGRES_USER }} | |
POSTGRES_DB: ${{ vars.POSTGRES_DB }} | |
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry install | |
- name: Run Tests | |
run: | | |
poetry run python manage.py test | |
env: | |
DB_USER: ${{ vars.POSTGRES_USER }} | |
DB_NAME: ${{ vars.POSTGRES_DB }} | |
DB_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
DB_HOST: ${{ vars.POSTGRES_HOST }} | |
DB_PORT: 5432 | |
- name: Run Bandit | |
run: | | |
poetry run bandit -r . | |
- name: Run Safety | |
run: | | |
poetry run safety check | |
continue-on-error: true | |
- name: Run Ruff | |
run: | | |
poetry run ruff check . |