diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index f6d4438f..77eda3f2 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -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: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d40a8a74..2d3663e7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/surface/requirements.txt b/surface/requirements.txt index 200ffb46..5f8245fc 100644 --- a/surface/requirements.txt +++ b/surface/requirements.txt @@ -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