Improve GitHub CI/CD workflow: Python 3.13, Ruff, pip-audit #267
This file contains hidden or 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: Test packages | |
| on: [push, pull_request, workflow_dispatch] | |
| jobs: | |
| test: | |
| name: Run code quality checks and tests | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: test_db | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| env: | |
| DJANGO_SETTINGS_MODULE: pythonie.settings.tests | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test_db | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| requirements/main.txt | |
| requirements/dev.txt | |
| requirements/production.txt | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip setuptools uv | |
| python -m uv pip install -r requirements/main.txt -r requirements/dev.txt -r requirements/production.txt | |
| - name: Check code formatting with Ruff | |
| run: | | |
| python -m ruff format --check pythonie | |
| - name: Lint code with Ruff | |
| run: | | |
| python -m ruff check pythonie | |
| - name: Check for security vulnerabilities | |
| run: | | |
| python -m pip_audit | |
| - name: Run Django tests | |
| run: | | |
| python pythonie/manage.py test pythonie --verbosity=2 |