Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Add step to run Django check in CI (#638)
Dhruv Bhanushali003a062ddbb8
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.ymlindex 6f5564d47..e2b862c4e 100644--- a/.github/workflows/ci_cd.yml+++ b/.github/workflows/ci_cd.yml@@ -143,7 +143,7 @@ jobs:run: just init- name: Run API tests- run: just api-test -T+ run: just api-test- name: Print API test logsif: always()@@ -160,7 +160,7 @@ jobs:- name: Make developer docsif: github.event_name == 'push' && github.repository == 'WordPress/openverse-api'- run: just sphinx-make -T+ run: just sphinx-make- name: Upload developer docsif: github.event_name == 'push' && github.repository == 'WordPress/openverse-api'@@ -169,6 +169,31 @@ jobs:name: docspath: api/build/html/+ django-check:+ name: Run Django check+ runs-on: ubuntu-latest+ needs:+ - build-images+ steps:+ - name: Checkout repository+ uses: actions/checkout@v2++ - name: Setup just+ uses: extractions/setup-just@v1++ - name: Download all images+ uses: actions/download-artifact@v2+ with:+ path: /tmp++ - name: Load all images+ run: |+ docker load --input /tmp/api/api.tar+ docker load --input /tmp/ingestion_server/ingestion_server.tar++ - name: Run check+ run: just dj check+check-migrations:name: Check for uncommited Django migrationsruns-on: ubuntu-latest@@ -192,7 +217,7 @@ jobs:docker load --input /tmp/ingestion_server/ingestion_server.tar- name: Run makemigrations- run: just dj -T makemigrations --check --noinput+ run: just dj makemigrations --check --noinputpush:name: Publish Docker imagesdiff --git a/justfile b/justfileindex fc1f584d7..aaf39c134 100644--- a/justfile+++ b/justfile@@ -1,5 +1,6 @@set dotenv-load := false+IS_PROD := env_var_or_default("PROD", "")IS_CI := env_var_or_default("CI", "")# Show all available recipes@@ -26,10 +27,9 @@ default:# Docker ###########-IS_PROD := env_var_or_default("IS_PROD", "")DOCKER_FILE := "-f " + (- if IS_PROD == "true" {"ingestion_server/docker-compose.yml"}- else {"docker-compose.yml"}+ if IS_PROD == "true" { "ingestion_server/docker-compose.yml" }+ else { "docker-compose.yml" })# Build all (or specified) services@@ -53,6 +53,11 @@ recreate:logs services="" args=(if IS_CI != "" { "" } else { "-f" }):docker-compose {{ DOCKER_FILE }} logs {{ args }} {{ services }}+EXEC_DEFAULTS := if IS_CI == "" { "" } else { "-T" }++# Execute statement in service containers using Docker Compose+exec +args:+ docker-compose exec {{ EXEC_DEFAULTS }} {{ args }}######### Init #@@ -179,8 +184,8 @@ _api-install:exit 0# Run API tests inside Docker-@api-test docker_args="" tests="": _api-up- docker-compose exec {{ docker_args }} web ./test/run_test.sh {{ tests }}+@api-test tests="": _api-up+ just exec web ./test/run_test.sh {{ tests }}# Run API tests locallyapi-testlocal args="":@@ -191,16 +196,16 @@ dj-local +args:cd api && pipenv run python manage.py {{ args }}# Run Django administrative commands in the docker container-@dj docker_args="" +args="": _api-up- docker-compose exec {{ docker_args }} web python manage.py {{ args }}+@dj +args="": _api-up+ just exec web python manage.py {{ args }}# Make a test cURL request to the APIstats media="images":curl "http://localhost:8000/v1/{{ media }}/stats/"-# Attach to ipython+# Get Django shell with IPythonipython:- docker-compose exec web ipython+ just dj shell##########@@ -208,12 +213,12 @@ ipython:########### Compile Sphinx documentation into HTML output-sphinx-make args="" service="web": up wait-for-es wait-for-ing wait-for-web- docker-compose exec {{ args }} {{ service }} sphinx-build -M html docs/ build/+sphinx-make: up wait-for-es wait-for-ing wait-for-web+ just exec web sphinx-build -M html docs/ build/# Serve Sphinx documentation via a live-reload server-sphinx-live service="web" port="3000": up wait-for-es wait-for-ing wait-for-web- docker-compose exec {{ service }} sphinx-autobuild --host 0.0.0.0 --port {{ port }} docs/ build/html/+sphinx-live port="3000": up wait-for-es wait-for-ing wait-for-web+ just exec web sphinx-autobuild --host 0.0.0.0 --port {{ port }} docs/ build/html/# Serve the Sphinx documentation from the HTML output directorysphinx-serve dir="api" port="3001":