Skip to content

Commit

Permalink
CI: Add a step to verify that no migrations are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
SpecLad committed Aug 6, 2024
1 parent f3dcc3e commit 536a327
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,23 @@ jobs:
- name: Verify API schema
id: verify_schema
run: |
docker run --rm --entrypoint /bin/bash cvat/server:${CVAT_VERSION} \
docker run --rm cvat/server:${CVAT_VERSION} bash \
-c 'python manage.py spectacular' > cvat/schema-expected.yml
if ! git diff --no-index cvat/schema.yml cvat/schema-expected.yml; then
echo
echo 'API schema has changed! Please update cvat/schema.yml:'
echo
echo ' docker run --rm --entrypoint /bin/bash cvat/server:dev \'
echo ' docker run --rm cvat/server:dev bash \'
echo " -c 'python manage.py spectacular' > cvat/schema.yml"
exit 1
fi
- name: Verify migrations
run: |
docker run --rm cvat/server:${CVAT_VERSION} bash \
-c 'python manage.py makemigrations --check'
- name: Upload expected schema as an artifact
if: failure() && steps.verify_schema.conclusion == 'failure'
uses: actions/upload-artifact@v3.1.2
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,23 @@ jobs:
id: verify_schema
run: |
docker load --input /tmp/cvat_server/image.tar
docker run --rm --entrypoint /bin/bash cvat/server \
docker run --rm cvat/server bash \
-c 'python manage.py spectacular' > cvat/schema-expected.yml
if ! git diff --no-index cvat/schema.yml cvat/schema-expected.yml; then
echo
echo 'API schema has changed! Please update cvat/schema.yml:'
echo
echo ' docker run --rm --entrypoint /bin/bash cvat/server:dev \'
echo ' docker run --rm cvat/server:dev bash \'
echo " -c 'python manage.py spectacular' > cvat/schema.yml"
exit 1
fi
- name: Verify migrations
run: |
docker run --rm cvat/server bash \
-c 'python manage.py makemigrations --check'
- name: Upload CVAT server artifact
uses: actions/upload-artifact@v3
with:
Expand Down

0 comments on commit 536a327

Please sign in to comment.