Skip to content

Commit

Permalink
Verifying API schema before running tests (cvat-ai#5998)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Sizov authored Apr 10, 2023
1 parent 2505b31 commit c5156f4
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ jobs:
cp -r cvat-sdk/* /tmp/cvat_sdk/
- name: Verify API schema
id: verify_schema
run: |
docker load --input /tmp/cvat_server/image.tar
docker run --rm --entrypoint /bin/bash cvat/server \
-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 " -c 'python manage.py spectacular' > cvat/schema.yml"
exit 1
fi
- name: Upload CVAT server artifact
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -128,20 +144,6 @@ jobs:
docker tag cvat/ui:latest cvat/ui:${CVAT_VERSION}
docker image ls -a
- name: Verify API schema
id: verify_schema
run: |
docker run --rm --entrypoint /bin/bash cvat/server:${CVAT_VERSION} \
-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 " -c 'python manage.py spectacular' > cvat/schema.yml"
exit 1
fi
- name: Upload expected schema as an artifact
if: failure() && steps.verify_schema.conclusion == 'failure'
Expand Down

0 comments on commit c5156f4

Please sign in to comment.