Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Unify CI workflow and update api_nginx image name
Dhruv Bhanushali9d4c9094d5f0
diff --git a/.github/actions/build-docs/action.yml b/.github/actions/build-docs/action.ymlnew file mode 100644index 000000000..ce2af766d--- /dev/null+++ b/.github/actions/build-docs/action.yml@@ -0,0 +1,37 @@+name: openverse/build-docs+description: Build Openverse full-stack docs++runs:+ using: "composite"+ steps:+ - name: Build Sphinx+ shell: bash+ run: |+ just api/sphinx-make+ sudo chown "$USER:$USER" -R ./api+ env:+ DC_USER: root++ - name: Install translations+ shell: bash+ run: |+ just frontend/run i18n++ - name: Build Storybook+ shell: bash+ run: |+ just frontend/run storybook:build++ - name: Build Tailwind Config Viewer+ shell: bash+ run: |+ just frontend/run tcv:build++ # Storybook will be available at `/storybook`+ # Tailwind will be available at `/tailwind`+ - name: Merge all docs+ shell: bash+ run: |+ mv api/build/html /tmp/docs+ mv frontend/storybook-static /tmp/docs/storybook+ mv frontend/.tcv-export /tmp/docs/tailwinddiff --git a/.github/actions/load-img/action.yml b/.github/actions/load-img/action.ymlnew file mode 100644index 000000000..488703e7d--- /dev/null+++ b/.github/actions/load-img/action.yml@@ -0,0 +1,42 @@+name: openverse/load-img+description: Download and import Docker images from artifacts++inputs:+ setup_ingestion_server:+ default: "true"+ description: Whether to set up ingestion server image++ setup_api:+ default: "true"+ description: Whether to set up API image++runs:+ using: "composite"+ steps:+ # Ingestion server+ - name: Download image `ingestion_server`+ uses: actions/download-artifact@v3+ if: inputs.setup_ingestion_server == 'true'+ with:+ name: ingestion_server+ path: /tmp++ - name: Load image `ingestion_server`+ if: inputs.setup_ingestion_server == 'true'+ shell: bash+ run: |+ docker load --input /tmp/ingestion_server.tar++ # API+ - name: Download image `api`+ uses: actions/download-artifact@v3+ if: inputs.setup_api == 'true'+ with:+ name: api+ path: /tmp++ - name: Load image `api`+ if: inputs.setup_api == 'true'+ shell: bash+ run: |+ docker load --input /tmp/api.tardiff --git a/.github/actions/staging-api-deploy/action.yml b/.github/actions/staging-api-deploy/action.ymlindex 877e32317..a1ed7e6ff 100644--- a/.github/actions/staging-api-deploy/action.yml+++ b/.github/actions/staging-api-deploy/action.yml@@ -90,7 +90,7 @@ runs:with:task-definition: task-definition.jsoncontainer-name: nginx- image: "ghcr.io/wordpress/openverse-api-nginx:${{ inputs.tag }}"+ image: "ghcr.io/wordpress/openverse-api_nginx:${{ inputs.tag }}"- name: "Fill in the new django image ID in the Amazon ECS task definition"id: "task-def-django"diff --git a/.github/workflows/api-rollback.yml b/.github/workflows/api-rollback.ymlindex 85796ed09..464310910 100644--- a/.github/workflows/api-rollback.yml+++ b/.github/workflows/api-rollback.yml@@ -58,7 +58,7 @@ jobs:const { data: versions } =await github.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({package_type: 'container',- package_name: 'openverse-api-nginx',+ package_name: 'openverse-api_nginx',org: 'WordPress',page,// max of `per_page`@@ -71,7 +71,7 @@ jobs:}if (!exists) {throw new Error(- '`${{ inputs.tag }}` does not appear to be a valid tag for the ghcr.io/wordpress/openverse-api-nginx image.'+ '`${{ inputs.tag }}` does not appear to be a valid tag for the ghcr.io/wordpress/openverse-api_nginx image.')}diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymldeleted file mode 100644index 0acd2a7ff..000000000--- a/.github/workflows/ci.yml+++ /dev/null@@ -1,337 +0,0 @@-name: CI--on:- push:- branches:- - main- pull_request:--# Cancels all previous workflow runs for pull requests that have not completed.-concurrency:- # The concurrency group contains the workflow name and the branch name for pull requests- # or the commit hash for any other events.- group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}- cancel-in-progress: true--env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}--jobs:- types:- name: Check types- runs-on: ubuntu-latest-- steps:- - name: Checkout repository- uses: actions/checkout@v3-- - name: Setup CI env- uses: ./.github/actions/setup-env- with:- github_token: ${{ secrets.GITHUB_TOKEN }}- setup_python: false-- - name: Check types- run: just frontend/run types-- lint:- name: Lint files- runs-on: ubuntu-latest-- steps:- - name: Checkout repository- uses: actions/checkout@v3-- - name: Setup CI env- uses: ./.github/actions/setup-env- with:- github_token: ${{ secrets.GITHUB_TOKEN }}- # Python is not needed to run pre-commit.- setup_python: false- # Node.js is needed by lint actions.-- - name: Cache pre-commit envs- uses: actions/cache@v3- with:- path: ~/.cache/pre-commit- key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}-- - name: Run pre-commit to lint files- run: |- just precommit- just lint-- unit:- name: Unit tests- runs-on: ubuntu-latest-- steps:- - name: Checkout repository- uses: actions/checkout@v3-- - name: Setup CI env- uses: ./.github/actions/setup-env- with:- github_token: ${{ secrets.GITHUB_TOKEN }}- setup_python: false-- - name: Run unit tests- run: just frontend/run test:unit-- clean-playwright-failure-comment:- name: Remove previous Playwright test failure comments- runs-on: ubuntu-latest- if: github.ref != 'refs/heads/main'-- steps:- - uses: peter-evans/find-comment@v2- id: test-results-comment- with:- issue-number: ${{ github.event.pull_request.number }}- body-includes: Playwright Failure Test Results-- - uses: actions/github-script@v6- if: steps.test-results-comment.outputs.comment-id != 0- with:- script: |- await github.rest.issues.deleteComment({- repo: context.repo.repo,- owner: context.repo.owner,- comment_id: ${{ steps.test-results-comment.outputs.comment-id }}- })- console.log('Deleted comment with ID ${{ steps.test-results-comment.outputs.comment-id }}')-- nuxt-playwright-e2e:- name: Nuxt Playwright e2e tests- runs-on: ubuntu-latest-- steps:- - name: Checkout repository- uses: actions/checkout@v3-- - name: Setup CI env- uses: ./.github/actions/setup-env- with:- github_token: ${{ secrets.GITHUB_TOKEN }}- setup_python: false-- - name: Run Nuxt Playwright e2e tests- run: just frontend/run test:playwright e2e --workers=2-- - uses: actions/upload-artifact@v3- if: failure()- with:- name: nuxt-e2e-test-results- path: test-results-- nuxt-playwright-vr:- name: Nuxt Playwright VR tests- runs-on: ubuntu-latest-- steps:- - name: Checkout repository- uses: actions/checkout@v3-- - name: Setup CI env- uses: ./.github/actions/setup-env- with:- github_token: ${{ secrets.GITHUB_TOKEN }}- setup_python: false-- - name: Run Nuxt Playwright visual regression tests- run: just frontend/run test:playwright visual-regression --workers=2-- - uses: actions/upload-artifact@v3- if: failure()- with:- name: nuxt-vr-test-results- path: test-results-- storybook-playwright:- name: Storybook Playwright tests- runs-on: ubuntu-latest-- steps:- - name: Checkout repository- uses: actions/checkout@v3-- - name: Setup CI env- uses: ./.github/actions/setup-env- with:- github_token: ${{ secrets.GITHUB_TOKEN }}- setup_python: false-- - name: Run Storybook Playwright tests- run: just frontend/run test:storybook-- - uses: actions/upload-artifact@v3- if: failure()- id: test-results- with:- name: storybook-test-results- path: test-results-- playwright-test-failure-comment:- name: Share Playwright test debugging instructions- runs-on: ubuntu-latest- if: always() && github.ref != 'refs/heads/main' && (needs.nuxt-playwright-vr.result == 'failure' || needs.nuxt-playwright-e2e.result == 'failure' ||needs.storybook-playwright.result == 'failure')- needs:- - nuxt-playwright-e2e- - nuxt-playwright-vr- - storybook-playwright-- steps:- - uses: peter-evans/create-or-update-comment@v2- with:- issue-number: ${{ github.event.pull_request.number }}- body: |- **Playwright Failure Test Results**-- It looks like some of the Playwright tests failed. You can download the Playwright trace- output for both Storybook and Nuxt Playwright tests that have failed at the bottom of this- page, under the "Artifacts" section:-- <https://github.com/WordPress/openverse-frontend/actions/runs/${{ github.run_id }}>-- Read more about how to use this artifact here: <https://github.com/WordPress/openverse-frontend/blob/main/test/playwright/README.md#debugging>-- storybook:- name: Check Storybook build- runs-on: ubuntu-latest-- steps:- - name: Checkout repository- uses: actions/checkout@v3-- - name: Setup CI env- uses: ./.github/actions/setup-env- with:- github_token: ${{ secrets.GITHUB_TOKEN }}- setup_python: false-- - name: Run Storybook smoke-test- run: just frontend/run storybook:smoke-- build:- name: Check Nuxt build- runs-on: ubuntu-latest-- steps:- - name: Checkout repository- uses: actions/checkout@v3-- - name: Setup CI env- uses: ./.github/actions/setup-env- with:- github_token: ${{ secrets.GITHUB_TOKEN }}- setup_python: false-- - name: Run build- run: just frontend/run build-- gh-pages:- name: PR Storybook and Tailwind Preview- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login == 'WordPress'- runs-on: ubuntu-latest-- steps:- - uses: peter-evans/find-comment@v2- id: preview-comment- with:- issue-number: ${{ github.event.pull_request.number }}- body-includes: Storybook and Tailwind configuration previews-- - uses: peter-evans/create-or-update-comment@v2- if: steps.preview-comment.outputs.comment-id != 0- with:- comment-id: ${{ steps.preview-comment.outputs.comment-id }}- edit-mode: replace- body: |- **Storybook and Tailwind configuration previews**: _Updating_- (This comment will be automatically updated with the preview URLs once they are ready)-- - uses: peter-evans/create-or-update-comment@v2- if: steps.preview-comment.outputs.comment-id == 0- with:- issue-number: ${{ github.event.pull_request.number }}- body: |- **Storybook and Tailwind configuration previews**: _Updating_- (This comment will be automatically updated with the preview URLs once they are ready)-- - name: Checkout repository- uses: actions/checkout@v3-- - name: Setup CI env- uses: ./.github/actions/setup-env- with:- github_token: ${{ secrets.GITHUB_TOKEN }}- setup_python: false-- - name: Fetch translation files- run: just frontend/run i18n-- - name: Build Storybook- run: just frontend/run storybook:build-- - name: Build Tailwind Config Viewer- run: just frontend/run tcv:build-- # This makes the TCV available at the `/tailwind` directory in the gh-pages- - name: Merge TCV and Storybook builds- run: |- mv frontend/.tcv-export frontend/storybook-static/tailwind- mv frontend/storybook-static /tmp/preview-- # Otherwise we end up with `node_modules` and other things only necessary for building- # but not necessary for deploying the `gh-pages` branch- - name: Recreate working directory to avoid superfluous files- run: |- cd ..- rm -rf openverse-frontend- mkdir openverse-frontend-- - name: Checkout repository at `gh-pages` branch- uses: actions/checkout@v3- with:- ref: gh-pages-- - name: Merge preview with existing gh-pages- run: |- cd ..- cp -r ./openverse-frontend /tmp/gh-pages- # trash the existing preview folder and replace it with the newly generated one- # if the preview hasn't been pushed yet this will still exit(0)- rm -rf /tmp/gh-pages/_preview/${{ github.event.pull_request.number }}- mv /tmp/preview /tmp/gh-pages/_preview/${{ github.event.pull_request.number }}- cd openverse-frontend-- - name: Deploy- uses: peaceiris/actions-gh-pages@v3- with:- github_token: ${{ secrets.GITHUB_TOKEN }}- publish_dir: /tmp/gh-pages- force_orphan: true-- - uses: peter-evans/find-comment@v2- id: final-preview-comment- with:- issue-number: ${{ github.event.pull_request.number }}- body-includes: Storybook and Tailwind configuration previews-- - uses: peter-evans/create-or-update-comment@v2- with:- comment-id: ${{ steps.final-preview-comment.outputs.comment-id }}- edit-mode: replace- body: |- **Storybook and Tailwind configuration previews**: _Ready_-- **Storybook:** <https://wordpress.github.io/openverse-frontend/_preview/${{ github.event.pull_request.number }}>- **Tailwind:** <https://wordpress.github.io/openverse-frontend/_preview/${{ github.event.pull_request.number }}/tailwind>-- Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again.-- You can check [the GitHub pages deployment action list](https://github.com/WordPress/openverse-frontend/actions/workflows/pages/pages-build-deployment) to see the current status of the deployments.-- - name: Checkout repository # again, to enable cleaning.- if: always()- uses: actions/checkout@v3diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.ymlindex 0694befd2..0217a07ce 100644--- a/.github/workflows/ci_cd.yml+++ b/.github/workflows/ci_cd.yml@@ -5,6 +5,7 @@ on:push:branches:- main+ - monoreporelease:types:- published@@ -18,17 +19,52 @@ concurrency:cancel-in-progress: ${{ github.event_name == 'pull_request' }}jobs:- lint:- name: Lint+ ###########+ # Helpers #+ ###########++ get-image-tag:+ name: Get image tag+ runs-on: ubuntu-latest+ outputs:+ image-tag: ${{ steps.get-image-tag.outputs.image-tag }}++ steps:+ - name: Get image tag+ id: get-image-tag+ run: |+ if [[ "${{ github.event_name }}" == "release" ]]; then+ echo "image-tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"+ else+ echo "image-tag=${{ github.sha }}" >> "$GITHUB_OUTPUT"+ fi++ #############+ # Universal #+ #############++ lint: # This includes type-checking of the frontend.+ name: Lint filesruns-on: ubuntu-latest+steps:- name: Checkout repositoryuses: actions/checkout@v3- - name: Setup Python- uses: actions/setup-python@v4+ - name: Setup CI env+ uses: ./.github/actions/setup-envwith:- python-version: "3.10"+ github_token: ${{ secrets.GITHUB_TOKEN }}+ # Python is not needed to run pre-commit.+ setup_python: false+ # Node.js is needed by lint actions.+ install_recipe: ""+ # Need more complex install recipe.++ - name: Install dependences+ run: |+ pnpm install+ just frontend/install --ignore-workspace- name: Cache pre-commit envsuses: actions/cache@v3@@ -38,26 +74,15 @@ jobs:- name: Run pre-commit to lint filesrun: |- pip install pre-commit- pre-commit run --all-files+ just precommit+ just lint- get-image-tag:- name: Get image tag- runs-on: ubuntu-latest- outputs:- image-tag: ${{ steps.get-image-tag.outputs.image-tag }}- steps:- - name: Get image tag- id: get-image-tag- run: |- if [[ "${{ github.event_name }}" == "release" ]]; then- echo "image-tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"- else- echo "image-tag=${{ github.sha }}" >> "$GITHUB_OUTPUT"- fi+ ############################+ # API and ingestion server #+ ############################build-images:- name: Build images+ name: Build Docker imagesruns-on: ubuntu-lateststrategy:matrix:@@ -67,6 +92,7 @@ jobs:needs:- get-image-tag- lint+steps:- name: Checkout repositoryuses: actions/checkout@v3@@ -94,61 +120,9 @@ jobs:name: ${{ matrix.image }}path: /tmp/${{ matrix.image }}.tar- build-nginx:- # This requires a separate job due to the dependency on the other image builds- name: Build `nginx` Dockerfile target- runs-on: ubuntu-latest- needs:- - build-images- - get-image-tag-- steps:- - uses: actions/checkout@v3-- - name: Setup just- uses: extractions/setup-just@v1- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}-- - name: Download all images- uses: actions/download-artifact@v3- with:- path: /tmp-- - name: Load API and ingestion server images- run: |- docker load --input /tmp/api/api.tar- docker load --input /tmp/ingestion_server/ingestion_server.tar-- - name: collectstatic- run: just api/collectstatic- env:- STATIC_ROOT: ./static- DC_USER: root-- - name: Setup Docker Buildx- uses: docker/setup-buildx-action@v2- with:- install: true-- - name: Build image `nginx`- uses: docker/build-push-action@v4- with:- context: api- target: nginx- push: false- tags: openverse-api-nginx- cache-from: type=gha,scope=nginx- cache-to: type=gha,scope=nginx- outputs: type=docker,dest=/tmp/api-nginx.tar- build-args: |- SEMANTIC_VERSION=${{ needs.get-image-tag.outputs.image-tag }}-- - name: Upload image `api-nginx`- uses: actions/upload-artifact@v3- with:- name: api-nginx- path: /tmp/api-nginx.tar+ ####################+ # Ingestion server #+ ####################test-ing:name: Run tests for ingestion-server@@ -156,41 +130,24 @@ jobs:timeout-minutes: 15needs:- build-images+steps:- name: Checkout repositoryuses: actions/checkout@v3- - name: Setup just- uses: extractions/setup-just@v1- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}-- - name: Setup Python- uses: actions/setup-python@v4- with:- python-version: "3.10"-- - name: Cache Python dependencies- uses: actions/cache@v3+ - name: Setup CI env+ uses: ./.github/actions/setup-envwith:- path: ~/.cache/pip- key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile.lock') }}- restore-keys: |- ${{ runner.os }}-pip--- - name: Install Python deps for ingestion-server- run: |- pip install -U pip- pip install pipenv- just ingestion_server/install+ github_token: ${{ secrets.GITHUB_TOKEN }}+ # Python is needed to run the test.+ setup_nodejs: false+ # Node.js is not needed to run ingestion server tests.+ install_recipe: ingestion_server/install- - name: Download image `ingestion_server`- uses: actions/download-artifact@v3+ - name: Load Docker images+ uses: ./.github/actions/load-imgwith:- name: ingestion_server- path: /tmp- - name: Load image `ingestion_server`- run: docker load --input /tmp/ingestion_server.tar+ setup_api: false- name: Run ingestion-server testsrun: just ingestion_server/test-local@@ -206,30 +163,33 @@ jobs:if: always()run: cat ingestion_server/test/ingestion_logs.txt+ #######+ # API #+ #######+test-api:name: Run tests for the APIruns-on: ubuntu-latesttimeout-minutes: 15needs:- build-images+steps:- name: Checkout repositoryuses: actions/checkout@v3- - name: Setup just- uses: extractions/setup-just@v1- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}-- - name: Download all images- uses: actions/download-artifact@v3+ - name: Setup CI env+ uses: ./.github/actions/setup-envwith:- path: /tmp+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ # Python is not needed to run the tests.+ setup_nodejs: false+ # Node.js is not needed to run API tests.+ install_recipe: ""- - name: Load all images- run: |- docker load --input /tmp/api/api.tar- docker load --input /tmp/ingestion_server/ingestion_server.tar+ - name: Load Docker images+ uses: ./.github/actions/load-img- name: Start API, ingest and index test datarun: just init@@ -255,24 +215,23 @@ jobs:runs-on: ubuntu-latestneeds:- build-images+steps:- name: Checkout repositoryuses: actions/checkout@v3- - name: Setup just- uses: extractions/setup-just@v1- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}-- - name: Download all images- uses: actions/download-artifact@v3+ - name: Setup CI env+ uses: ./.github/actions/setup-envwith:- path: /tmp+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ # Python is not needed to run the tests.+ setup_nodejs: false+ # Node.js is not needed to run API tests.+ install_recipe: ""- - name: Load all images- run: |- docker load --input /tmp/api/api.tar- docker load --input /tmp/ingestion_server/ingestion_server.tar+ - name: Load Docker images+ uses: ./.github/actions/load-img- name: Test ReDoc siterun: just api/doc-test@@ -282,23 +241,23 @@ jobs:runs-on: ubuntu-latestneeds:- build-images- steps:- - uses: actions/checkout@v3- - name: Setup just- uses: extractions/setup-just@v1- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ steps:+ - name: Checkout repository+ uses: actions/checkout@v3- - name: Download all images- uses: actions/download-artifact@v3+ - name: Setup CI env+ uses: ./.github/actions/setup-envwith:- path: /tmp+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ # Python is not needed to run the tests.+ setup_nodejs: false+ # Node.js is not needed to run API tests.+ install_recipe: ""- - name: Load all images- run: |- docker load --input /tmp/api/api.tar- docker load --input /tmp/ingestion_server/ingestion_server.tar+ - name: Load Docker images+ uses: ./.github/actions/load-img- name: Run checkrun: just api/dj validateopenapischema@@ -317,24 +276,23 @@ jobs:runs-on: ubuntu-latestneeds:- build-images+steps:- name: Checkout repositoryuses: actions/checkout@v3- - name: Setup just- uses: extractions/setup-just@v1- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}-- - name: Download all images- uses: actions/download-artifact@v3+ - name: Setup CI env+ uses: ./.github/actions/setup-envwith:- path: /tmp+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ # Python is not needed to run the tests.+ setup_nodejs: false+ # Node.js is not needed to run API tests.+ install_recipe: ""- - name: Load all images- run: |- docker load --input /tmp/api/api.tar- docker load --input /tmp/ingestion_server/ingestion_server.tar+ - name: Load Docker images+ uses: ./.github/actions/load-img- name: Run checkrun: just api/dj check@@ -344,94 +302,281 @@ jobs:runs-on: ubuntu-latestneeds:- build-images+steps:- name: Checkout repositoryuses: actions/checkout@v3- - name: Setup just- uses: extractions/setup-just@v1- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}-- - name: Download all images- uses: actions/download-artifact@v3+ - name: Setup CI env+ uses: ./.github/actions/setup-envwith:- path: /tmp+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ # Python is not needed to run the tests.+ setup_nodejs: false+ # Node.js is not needed to run API tests.+ install_recipe: ""- - name: Load all images- run: |- docker load --input /tmp/api/api.tar- docker load --input /tmp/ingestion_server/ingestion_server.tar+ - name: Load Docker images+ uses: ./.github/actions/load-img- name: Run makemigrationsrun: just api/dj makemigrations --check --noinput --merge- push:- name: Publish Docker images+ #########+ # NGINX #+ #########++ build-nginx:+ # This requires a separate job due to the dependency on the other image builds+ name: Build `nginx` Docker imageruns-on: ubuntu-latest- # prevent running on fork PRs- if: (github.event_name == 'push' || github.event_name == 'release') && github.repository == 'WordPress/openverse-api'needs:- - test-ing- - test-api- - get-image-tag- - build-nginx- permissions:- packages: write- contents: read- strategy:- matrix:- image:- - api- - ingestion_server- - api-nginx+ - build-images+steps:- - name: Log in to GitHub Docker Registry- uses: docker/login-action@v2- with:- registry: https://ghcr.io- username: ${{ github.actor }}- password: ${{ secrets.GITHUB_TOKEN }}+ - name: Checkout repository+ uses: actions/checkout@v3- - name: Download image `${{ matrix.image }}`- uses: actions/download-artifact@v3+ - name: Setup CI env+ uses: ./.github/actions/setup-envwith:- name: ${{ matrix.image }}- path: /tmp+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ # Python is not needed to build the image.+ setup_nodejs: false+ # Node.js is not needed to build the image.+ install_recipe: ""- - name: Load and tag image `${{ matrix.image }}` (latest & sha)+ - name: Load Docker images+ uses: ./.github/actions/load-img++ - name: collectstaticrun: |- docker load --input /tmp/${{ matrix.image }}.tar- docker tag openverse-${{ matrix.image }} \- ghcr.io/wordpress/openverse-${{ matrix.image }}:latest- docker tag openverse-${{ matrix.image }} \- ghcr.io/wordpress/openverse-${{ matrix.image }}:${{ needs.get-image-tag.outputs.image-tag }}- docker push --all-tags ghcr.io/wordpress/openverse-${{ matrix.image }}+ just _all-up+ just api/collectstatic+ env:+ DC_USER: root- deploy-staging:- name: Deploy staging API+ - name: Setup Docker Buildx+ uses: docker/setup-buildx-action@v2+ with:+ install: true++ - name: Build image `api_nginx`+ uses: docker/build-push-action@v4+ with:+ context: api+ target: nginx # from `api/Dockerfile`+ push: false+ tags: openverse-api_nginx+ cache-from: type=gha,scope=nginx+ cache-to: type=gha,scope=nginx+ outputs: type=docker,dest=/tmp/api_nginx.tar+ build-args: |+ SEMANTIC_VERSION=${{ needs.get-image-tag.outputs.image-tag }}++ - name: Upload image `api_nginx`+ uses: actions/upload-artifact@v3+ with:+ name: api_nginx+ path: /tmp/api_nginx.tar++ ############+ # Frontend #+ ############++ frontend-unit:+ name: Run frontend unit testsruns-on: ubuntu-latest- # Deploy a new version when `main` is pushed to in this repository- if: github.event_name == 'push' && github.repository == 'WordPress/openverse-api'needs:- - push- - get-image-tag+ - lint+steps:- - uses: actions/checkout@v3+ - name: Checkout repository+ uses: actions/checkout@v3- - uses: ./.github/actions/staging-api-deploy+ - name: Setup CI env+ uses: ./.github/actions/setup-envwith:- tag: ${{ needs.get-image-tag.outputs.image-tag }}- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}- slack-webhook: ${{ secrets.SLACK_WEBHOOK_URL }}- gh-slack-username-map: ${{ secrets.GH_SLACK_USERNAME_MAP }}+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ install_recipe: frontend/install --ignore-workspace- publish-docs:- name: Publish developer docs+ - name: Run unit tests+ run: just frontend/run test:unit++ storybook-smoke:+ name: Check Storybook smoke test+ runs-on: ubuntu-latest+ needs:+ - lint++ steps:+ - name: Checkout repository+ uses: actions/checkout@v3++ - name: Setup CI env+ uses: ./.github/actions/setup-env+ with:+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ install_recipe: frontend/install --ignore-workspace++ - name: Run Storybook smoke-test+ run: just frontend/run storybook:smoke++ nuxt-build:+ name: Check Nuxt build+ runs-on: ubuntu-latest+ needs:+ - lint++ steps:+ - name: Checkout repository+ uses: actions/checkout@v3++ - name: Setup CI env+ uses: ./.github/actions/setup-env+ with:+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ install_recipe: frontend/install --ignore-workspace++ - name: Run build+ run: just frontend/run build++ nuxt-playwright-e2e:+ name: Nuxt Playwright e2e tests+ runs-on: ubuntu-latest+ needs:+ - lint++ steps:+ - name: Checkout repository+ uses: actions/checkout@v3++ - name: Setup CI env+ uses: ./.github/actions/setup-env+ with:+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ install_recipe: frontend/install --ignore-workspace++ - name: Run Nuxt Playwright e2e tests+ run: just frontend/run test:playwright e2e --workers=2++ - uses: actions/upload-artifact@v3+ if: failure()+ with:+ name: nuxt-e2e-test-results+ path: test-results++ nuxt-playwright-vr:+ name: Nuxt Playwright VR tests+ runs-on: ubuntu-latest+ needs:+ - lint++ steps:+ - name: Checkout repository+ uses: actions/checkout@v3++ - name: Setup CI env+ uses: ./.github/actions/setup-env+ with:+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ install_recipe: frontend/install --ignore-workspace++ - name: Run Nuxt Playwright visual regression tests+ run: just frontend/run test:playwright visual-regression --workers=2++ - uses: actions/upload-artifact@v3+ if: failure()+ with:+ name: nuxt-vr-test-results+ path: test-results++ storybook-playwright:+ name: Storybook Playwright tests+ runs-on: ubuntu-latest+ needs:+ - lint++ steps:+ - name: Checkout repository+ uses: actions/checkout@v3++ - name: Setup CI env+ uses: ./.github/actions/setup-env+ with:+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ install_recipe: frontend/install --ignore-workspace++ - name: Run Storybook Playwright tests+ run: just frontend/run test:storybook++ - uses: actions/upload-artifact@v3+ if: failure()+ id: test-results+ with:+ name: storybook-test-results+ path: test-results++ clean-playwright-failure-comment:+ name: Remove Playwright test debugging instructions+ runs-on: ubuntu-latest+ if: github.event_name == 'pull_request'++ steps:+ - uses: peter-evans/find-comment@v2+ id: test-results-comment+ with:+ issue-number: ${{ github.event.pull_request.number }}+ body-includes: Playwright failure test results++ - uses: actions/github-script@v6+ if: steps.test-results-comment.outputs.comment-id != 0+ with:+ script: |+ await github.rest.issues.deleteComment({+ repo: context.repo.repo,+ owner: context.repo.owner,+ comment_id: ${{ steps.test-results-comment.outputs.comment-id }}+ })+ console.log('Deleted comment with ID ${{ steps.test-results-comment.outputs.comment-id }}')++ playwright-test-failure-comment:+ name: Post Playwright test debugging instructions+ runs-on: ubuntu-latest+ if: always() && github.event_name == 'pull_request' && (needs.nuxt-playwright-vr.result == 'failure' || needs.nuxt-playwright-e2e.result == 'failure' ||needs.storybook-playwright.result == 'failure')+ needs:+ - nuxt-playwright-e2e+ - nuxt-playwright-vr+ - storybook-playwright+ - clean-playwright-failure-comment++ steps:+ - uses: peter-evans/create-or-update-comment@v2+ with:+ issue-number: ${{ github.event.pull_request.number }}+ body: |+ **Playwright failure test results**++ It looks like some of the Playwright tests failed. You can download the Playwright trace+ output for all playwright tests that have failed at the bottom of this page, under the+ "Artifacts" section:++ <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}>++ Read more about how to use this artifact here: <https://github.com/${{ github.repository }}/blob/main/frontend/test/playwright/README.md#debugging>++ build-frontend:+ # This requires a separate job due to a difference in build steps+ name: Build `frontend` Docker imageruns-on: ubuntu-latest- # Push new docs when `main` is pushed to in this repository- if: github.event_name == 'push' && github.repository == 'WordPress/openverse-api'needs:- build-images@@ -439,62 +584,112 @@ jobs:- name: Checkout repositoryuses: actions/checkout@v3- - name: Setup just- uses: extractions/setup-just@v1+ - name: Setup CI env+ uses: ./.github/actions/setup-env+ with:+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ # Python is not needed to build the image.+ install_recipe: frontend/install --ignore-workspace++ - name: Download translation strings+ run: just frontend/run i18nenv:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ GLOTPRESS_USERNAME: ${{ secrets.MAKE_USERNAME }}+ GLOTPRESS_PASSWORD: ${{ secrets.MAKE_LOGIN_PASSWORD }}- - name: Download all images- uses: actions/download-artifact@v3+ - name: Setup Docker Buildx+ uses: docker/setup-buildx-action@v2with:- path: /tmp+ install: true- - name: Load all images- run: |- docker load --input /tmp/api/api.tar- docker load --input /tmp/ingestion_server/ingestion_server.tar+ - name: Build image `frontend`+ uses: docker/build-push-action@v4+ with:+ context: frontend+ target: app # from `frontend/Dockerfile`+ push: false+ tags: openverse-frontend+ cache-from: type=gha,scope=frontend+ cache-to: type=gha,scope=frontend+ outputs: type=docker,dest=/tmp/frontend.tar+ build-args: |+ SEMANTIC_VERSION=${{ needs.get-image-tag.outputs.image-tag }}- - name: Make developer docs- run: |- just api/sphinx-make- sudo chown "$USER:$USER" -R ./api- mv ./api/build/html /tmp/gh-pages- env:- DC_USER: root+ - name: Upload image `frontend`+ uses: actions/upload-artifact@v3+ with:+ name: frontend+ path: /tmp/frontend.tar++ #################+ # Documentation #+ #################++ docs-publish:+ name: Publish full-stack docs+ if: github.event_name == 'push'+ runs-on: ubuntu-latest+ needs:+ - test-ing+ - test-api+ - nuxt-build++ steps:+ - name: Checkout repository+ uses: actions/checkout@v3++ - name: Setup CI env+ uses: ./.github/actions/setup-env+ with:+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ install_recipe: frontend/install --ignore-workspace++ - name: Load Docker images+ uses: ./.github/actions/load-img++ - name: Compile documentation+ uses: ./.github/actions/build-docs+ # Docs will be located at `/tmp/docs`.- - uses: actions/checkout@v3+ - name: Checkout repository at `gh-pages` branch+ uses: actions/checkout@v3with:ref: gh-pages- name: Preserve previews- run: mv _preview /tmp/gh-pages/_preview+ run: mv _preview /tmp/docs/_preview- name: Deploy- uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3+ uses: peaceiris/actions-gh-pages@v3with:github_token: ${{ secrets.GITHUB_TOKEN }}- publish_dir: /tmp/gh-pages+ publish_dir: /tmp/docsforce_orphan: true- - name: Checkout branch again to enable cleaning- if: always()+ - name: Checkout repository # again, to enable cleaninguses: actions/checkout@v3- with:- ref: main+ if: always()docs-preview:- name: Publish preview of developer docs for the branch- runs-on: ubuntu-latest- # Check if the event is not triggered by a fork or dependabot+ name: Preview full-stack docsif: github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login == 'WordPress' && github.actor != 'dependabot[bot]'+ runs-on: ubuntu-latestneeds:- - build-images+ - test-ing+ - test-api+ - nuxt-build+ env:+ REPO_OWNER: ${{ github.event.pull_request.head.repo.owner.login }}+ REPO_NAME: ${{ github.event.pull_request.head.repo.name }}+steps:- uses: peter-evans/find-comment@v2id: preview-commentwith:issue-number: ${{ github.event.pull_request.number }}- body-includes: API Developer Docs Preview+ body-includes: Full-stack documentation- uses: peter-evans/create-or-update-comment@v2if: steps.preview-comment.outputs.comment-id != 0@@ -502,7 +697,8 @@ jobs:comment-id: ${{ steps.preview-comment.outputs.comment-id }}edit-mode: replacebody: |- **API Developer Docs Preview**: _Updating_+ **Full-stack documentation**: _Updating_+(This comment will be automatically updated with the preview URL once it is ready)- uses: peter-evans/create-or-update-comment@v2@@ -510,55 +706,47 @@ jobs:with:issue-number: ${{ github.event.pull_request.number }}body: |- **API Developer Docs Preview**: _Updating_+ **Full-stack documentation**: _Updating_+(This comment will be automatically updated with the preview URLs once it is ready)- name: Checkout repositoryuses: actions/checkout@v3- - name: Setup just- uses: extractions/setup-just@v1- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}-- - name: Download all images- uses: actions/download-artifact@v3+ - name: Setup CI env+ uses: ./.github/actions/setup-envwith:- path: /tmp+ github_token: ${{ secrets.GITHUB_TOKEN }}+ setup_python: false+ install_recipe: frontend/install --ignore-workspace- - name: Load all images- run: |- docker load --input /tmp/api/api.tar- docker load --input /tmp/ingestion_server/ingestion_server.tar+ - name: Load Docker images+ uses: ./.github/actions/load-img- - name: Build docs- run: |- just api/sphinx-make- sudo chown "$USER:$USER" -R ./api- mv ./api/build/html /tmp/preview- env:- DC_USER: root+ - name: Compile documentation+ uses: ./.github/actions/build-docs+ # Docs will be located at `/tmp/docs`.- # Otherwise we end up with any extra stuff not git-ignored in the gh-pages branch- - name: Recreate working directory to avoid superfluous files+ - name: Recreate working directory # to avoid superfluous files from getting tracked automaticallyrun: |cd ..- sudo rm -rf openverse-api- mkdir openverse-api+ sudo rm -rf "$REPO_NAME"+ mkdir "$REPO_NAME"- - uses: actions/checkout@v3+ - name: Checkout repository at `gh-pages` branch+ uses: actions/checkout@v3with:ref: gh-pages- name: Merge preview with existing gh-pagesrun: |cd ..- cp -r ./openverse-api /tmp/gh-pages- # trash the existing preview folder and replace it with the newly generated one- # if the preview hasn't been pushed yet this will still exit(0)+ cp -r "$REPO_NAME" /tmp/gh-pages+ # Trash the existing preview folder and replace it with the newly generated one.+ # If the preview hasn't been pushed yet this will still exit with code 0.sudo rm -rf /tmp/gh-pages/_preview/${{ github.event.pull_request.number }}- mv /tmp/preview /tmp/gh-pages/_preview/${{ github.event.pull_request.number }}- cd openverse-api+ mv /tmp/docs /tmp/gh-pages/_preview/${{ github.event.pull_request.number }}+ cd "$REPO_NAME"- name: Deployuses: peaceiris/actions-gh-pages@v3@@ -571,21 +759,71 @@ jobs:id: final-preview-commentwith:issue-number: ${{ github.event.pull_request.number }}- body-includes: API Developer Docs Preview+ body-includes: Full-stack documentation- uses: peter-evans/create-or-update-comment@v2with:comment-id: ${{ steps.final-preview-comment.outputs.comment-id }}edit-mode: replacebody: |- **API Developer Docs Preview**: _Ready_+ **Full-stack documentation**: _Ready_- <https://wordpress.github.io/openverse-api/_preview/${{ github.event.pull_request.number }}>+ <https://${{ env.REPO_OWNER }}.github.io/${{ env.REPO_NAME }}/_preview/${{ github.event.pull_request.number }}>Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again.- You can check [the GitHub pages deployment action list](https://github.com/WordPress/openverse-api/actions/workflows/pages/pages-build-deployment) to see the current status of the deployments.+ You can check [the GitHub pages deployment action list](https://github.com/${{ github.repository }}/actions/workflows/pages/pages-build-deployment) to see the current status of the deployments.- - name: Checkout branch again to enable cleaning+ - name: Checkout repository # again, to enable cleaninguses: actions/checkout@v3if: always()++ #################+ # Docker images #+ #################++ publish-images:+ name: Publish Docker images+ runs-on: ubuntu-latest+ # prevent running on fork PRs+ if: (github.event_name == 'push' && github.repository == 'WordPress/openverse') || (github.event_name == 'release' && github.repository == 'WordPress/openverse')+ needs:+ # `build-images` is automatically included in `test-ing` and `test-api`.+ - test-ing+ - test-api+ - build-nginx+ - build-frontend+ - get-image-tag+ permissions:+ packages: write+ contents: read+ strategy:+ matrix:+ image:+ - api+ - ingestion_server+ - api_nginx+ - frontend++ steps:+ - name: Log in to GitHub Docker Registry+ uses: docker/login-action@v2+ with:+ registry: https://ghcr.io+ username: ${{ github.actor }}+ password: ${{ secrets.GITHUB_TOKEN }}++ - name: Download image `${{ matrix.image }}`+ uses: actions/download-artifact@v3+ with:+ name: ${{ matrix.image }}+ path: /tmp++ - name: Load and tag image `${{ matrix.image }}` (latest & sha)+ run: |+ docker load --input /tmp/${{ matrix.image }}.tar+ docker tag openverse-${{ matrix.image }} \+ ghcr.io/wordpress/openverse-${{ matrix.image }}:latest+ docker tag openverse-${{ matrix.image }} \+ ghcr.io/wordpress/openverse-${{ matrix.image }}:${{ needs.get-image-tag.outputs.image-tag }}+ docker push --all-tags ghcr.io/wordpress/openverse-${{ matrix.image }}diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yamldeleted file mode 100644index 27ec48e42..000000000--- a/.github/workflows/gh-pages.yaml+++ /dev/null@@ -1,58 +0,0 @@-name: GitHub Pages--on:- push:- branches:- - main--concurrency:- group: ${{ github.workflow }}- cancel-in-progress: true--jobs:- deploy:- name: Deploy GitHub pages- runs-on: ubuntu-latest- steps:- - name: Checkout repository- uses: actions/checkout@v3-- - name: Setup CI env- uses: ./.github/actions/setup-env- with:- github_token: ${{ secrets.GITHUB_TOKEN }}- setup_python: false-- - name: Fetch translation files- run: just frontend/run i18n-- - name: Build Storybook- run: just frontend/run storybook:build-- - name: Build Tailwind Config Viewer- run: just frontend/run tcv:build-- # This makes the TCV available at the `/tailwind` directory in the gh-pages- - name: Merge TCV and Storybook builds- run: |- mv frontend/.tcv-export frontend/storybook-static/tailwind- mv frontend/storybook-static /tmp/gh-pages-- - name: Checkout repository at `gh-pages` branch- uses: actions/checkout@v3- with:- ref: gh-pages-- - name: Preserve previews- run: mv _preview /tmp/gh-pages/_preview-- - name: Deploy- uses: peaceiris/actions-gh-pages@v3- with:- github_token: ${{ secrets.GITHUB_TOKEN }}- publish_dir: /tmp/gh-pages- force_orphan: true-- - name: Checkout repository # again, to enable cleaning.- if: always()- uses: actions/checkout@v3diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.ymldeleted file mode 100644index 9c6b3b295..000000000--- a/.github/workflows/ghcr.yml+++ /dev/null@@ -1,133 +0,0 @@-name: GitHub Container Registry & Deployment--on:- push:- branches:- - main- pull_request:- branches:- - main- release:- types: [published]--# Prevents multiple deployments/builds from running at the same time-concurrency:- group: ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'staging' || github.event.pull_request.number }}_release- # Don't continue building images for a PR if the PR is updated quickly- # For other workflows, allow them to complete and just block on them. This- # ensures deployments in particular to happen in series rather than parallel.- cancel-in-progress: ${{ github.event_name == 'pull_request' }}--jobs:- push-to-ghcr:- name: Build and push image for commit- runs-on: ubuntu-latest- # prevent running on fork PRs- if: github.event_name == 'push' || github.event_name == 'release' || github.event.pull_request.head.repo.owner.login == 'WordPress'- outputs:- pushed-version: ${{ steps.get-version.outputs.version }}-- steps:- - name: Checkout branch or push to main- uses: actions/checkout@v3- if: github.event_name != 'release'-- - name: Checkout release- uses: actions/checkout@v3- if: github.event_name == 'release'- with:- ref: ${{ github.event.release.tag_name }}-- - name: Setup CI env- uses: ./.github/actions/setup-env- with:- github_token: ${{ secrets.GITHUB_TOKEN }}- setup_python: false-- - name: Download translation strings- run: just frontend/run i18n- env:- GLOTPRESS_USERNAME: ${{ secrets.MAKE_USERNAME }}- GLOTPRESS_PASSWORD: ${{ secrets.MAKE_LOGIN_PASSWORD }}-- - uses: docker/setup-buildx-action@v2- with:- install: true-- - uses: docker/login-action@v2- with:- registry: https://ghcr.io- username: ${{ github.actor }}- password: ${{ secrets.GITHUB_TOKEN }}-- - uses: docker/metadata-action@v4- id: metadata- with:- images: ghcr.io/wordpress/openverse-frontend- tags: |- type=sha- type=ref,event=tag- type=raw,value=main,enabled=${{ github.event_name == 'push' }}-- - name: Get relevant tag for internal image version- id: get-version- shell: python- run: |- import json- import os- metadata = json.loads('${{ steps.metadata.outputs.json }}')- version = metadata["labels"]["org.opencontainers.image.version"]- if version == "main":- # get first version that isn't main- for tag in metadata["tags"]:- if ":main" not in tag:- version = tag.split(":")[1]- with open(os.environ.get("GITHUB_OUTPUT"), "a") as state:- state.write(f"version={version}\n")-- - uses: docker/build-push-action@v4- with:- context: frontend/- tags: ${{ steps.metadata.outputs.tags }}- labels: ${{ steps.metadata.outputs.labels }}- push: true- cache-from: type=gha- cache-to: type=gha,mode=max- build-args: |- RELEASE=${{ steps.get-version.outputs.version }}-- deploy-staging:- name: Deploy staging frontend- runs-on: ubuntu-latest- if: github.event_name == 'push'- needs: push-to-ghcr-- steps:- - uses: actions/checkout@v3-- - uses: ./.github/actions/staging-nuxt-deploy- with:- tag: ${{ needs.push-to-ghcr.outputs.pushed-version }}- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}- slack-webhook: ${{ secrets.SLACK_WEBHOOK_URL }}- gh-slack-username-map: ${{ secrets.GH_SLACK_USERNAME_MAP }}-- deploy-production:- name: Deploy production frontend- runs-on: ubuntu-latest- if: github.event_name == 'release'- needs: push-to-ghcr-- steps:- - uses: actions/checkout@v3- with:- ref: main-- - uses: ./.github/actions/production-nuxt-deploy- with:- tag: ${{ github.event.release.tag_name }}- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}- slack-webhook: ${{ secrets.SLACK_WEBHOOK_URL }}- gh-slack-username-map: ${{ secrets.GH_SLACK_USERNAME_MAP }}diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.ymldeleted file mode 100644index f89592d42..000000000--- a/.github/workflows/lint.yml+++ /dev/null@@ -1,42 +0,0 @@-name: Lint--on:- pull_request:- push:- branches:- - main--# Cancels all previous workflow runs for pull requests that have not completed.-concurrency:- # The concurrency group contains the workflow name and the branch name for pull requests- # or the commit hash for any other events.- group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}- cancel-in-progress: true--jobs:- lint:- name: Lint- runs-on: ubuntu-latest- steps:- - name: Checkout repository- uses: actions/checkout@v3-- - name: Setup CI env- uses: ./.github/actions/setup-env- with:- github_token: ${{ secrets.GITHUB_TOKEN }}- # Python is not needed to run pre-commit.- setup_python: false- # Node.js is needed to check rendered templates.- install_recipe: automations/js/install-- - name: Cache pre-commit envs- uses: actions/cache@v3- with:- path: ~/.cache/pre-commit- key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}-- - name: Run pre-commit to lint files- run: |- just precommit- just lintdiff --git a/.github/workflows/push_docker_image.yml b/.github/workflows/push_docker_image.ymlindex 53b9b4d4f..3e1dffcdb 100644--- a/.github/workflows/push_docker_image.yml+++ b/.github/workflows/push_docker_image.yml@@ -3,7 +3,7 @@ on:workflow_dispatch:inputs:image:- description: 'Image to push (options: "api", "api-nginx", or "ingestion_server")'+ description: 'Image to push (options: "api", "api_nginx", or "ingestion_server")'required: truecommit:description: Commit that the image is built fromdiff --git a/nginx/justfile b/nginx/justfileindex 3fed12bea..3a7ad7ac8 100644--- a/nginx/justfile+++ b/nginx/justfile@@ -16,13 +16,13 @@ collectstatic:# Run the NGINX image locallybuild-run upstream_url='api.openverse.engineering': collectstatic# upstream_url can also be set to 172.17.0.1:50280 for local testing- docker build --target nginx . -t openverse-api-nginx:latest+ docker build --target nginx . -t openverse-api_nginx:latest@echo "--> NGINX server will be run at http://localhost:9090, upstream at {{ upstream_url }}"@echo "--> Try a static URL like http://localhost:9090/static/admin/css/base.css to test"docker run --rm -p 9090:8080 -it \-e DJANGO_NGINX_UPSTREAM_URL="{{ upstream_url }}" \-e DJANGO_NGINX_GIT_REVISION="$(git rev-parse HEAD)" \- openverse-api-nginx:latest+ openverse-api_nginx:latest# Make locally trusted certificates (requires mkcert installed)cert: