Skip to content
24 changes: 24 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,30 @@ jobs:
- name: Style check
run : make style_check

migration_check:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8
ports:
- 8877:3306
# needed because the container does not provide a healthcheck
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries=5 -e MYSQL_ROOT_PASSWORD=root --entrypoint sh mysql -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
steps:
- name: Download artifacts (Docker images) from previous workflows
uses: actions/download-artifact@v3
with:
name: surface-tests
path: /tmp
- name: Load Docker images from previous workflows
run: docker load --input /tmp/myimage.tar
- name: Check for not-migrated changes in models
run: |
docker run --network host \
-e SURF_DATABASE_URL="mysql://root:root@127.0.0.1:8877/surface" \
ghcr.io/${{ github.repository }}:${{ inputs.build-tag }} \
sh -c './manage.py makemigrations --dry-run --check'

pytest:
runs-on: ubuntu-latest
strategy:
Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ repos:
hooks:
- id: ruff
args: ["--fix"]
- repo: local
hooks:
- id: migration-check
name: migration-check
entry: python surface/manage.py makemigrations --check --dry-run
language: system
files: models.*\.py$
pass_filenames: false
2 changes: 1 addition & 1 deletion surface/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ django-surface-theme==0.0.8
django-dbcleanup==0.1.3
django-logbasecommand==0.0.1
django-notification-sender[slack]==0.0.4
django-dkron==1.1.0
django-dkron==1.1.1
django-slack-processor==0.0.4
django-olympus==0.0.3
django-environ-ppb[vault]==1.0.0
Expand Down