Repo consistency #666
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: Run tests | |
on: [pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
postgres_version: ['14','16'] | |
services: | |
postgres: | |
image: postgres:${{ matrix.postgres_version }} | |
env: | |
POSTGRES_DB: ndoh_hub | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis:6.0 | |
ports: | |
- 6379:6379 | |
env: | |
HUB_DATABASE: postgres://postgres:postgres@localhost:5432/ndoh_hub | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install gettext | |
run: sudo apt-get install gettext | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- uses: abatilo/actions-poetry@v3 | |
- name: Install dependencies | |
id: install-deps | |
run: | | |
poetry install | |
- name: Check formatting | |
# Lints/tests should always run, even if other lints/tests have failed. | |
if: success() || failure() && steps.install-deps.outcome == 'success' | |
run: | | |
poetry run ruff format --check | |
- name: Lint | |
if: success() || failure() && steps.install-deps.outcome == 'success' | |
run: | | |
poetry run ruff check | |
- name: Run migrations | |
if: success() || failure() && steps.install-deps.outcome == 'success' | |
run: | | |
poetry run ./manage.py makemigrations registrations changes\ | |
eventstore --dry-run | grep 'No changes detected' || (echo 'There\ | |
are changes which require migrations.' && exit 1) | |
- name: Run tests | |
if: success() || failure() && steps.install-deps.outcome == 'success' | |
run: | | |
poetry run pytest -vv | |