Merge branch 'containerisation' into primary-id #1156
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: Run tests | |
| on: [push, pull_request] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| max-parallel: 4 | |
| matrix: | |
| python-version: ["3.11", "3.12"] | |
| services: | |
| postgres: | |
| image: postgres:14 | |
| env: | |
| POSTGRES_DB: onyx | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| ports: | |
| - 5432:5432 | |
| # needed because the postgres container does not provide a healthcheck | |
| options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
| 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 | |
| python -m pip install --user pipx | |
| python -m pipx ensurepath | |
| pipx install poetry==1.7.0 | |
| poetry config virtualenvs.in-project true | |
| poetry env use ${{ matrix.python-version }} | |
| poetry install --with test,dev | |
| - name: Run Linter | |
| run: | | |
| poetry run ruff check | |
| - name: Run Tests | |
| env: | |
| HOST_NAME: localhost | |
| SECRET_KEY: super-duper-secret-key | |
| DB_ENGINE: django.db.backends.postgresql | |
| DB_HOST: localhost | |
| DB_PORT: 5432 | |
| DB_NAME: onyx | |
| DB_USER: postgres | |
| DB_PASSWORD: postgres | |
| working-directory: ./onyx | |
| run: | | |
| poetry run coverage run --rcfile=../pyproject.toml manage.py test -v 2 | |
| poetry run coverage report --rcfile=../pyproject.toml |