Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

No docs, Docker images or deploys if CI + CD workflow changes (#1933)

Dhruv Bhanushali209cd44abed6
diff --git a/.github/filters.yml b/.github/filters.yml
index 2bc13e6aa..5ca06a04e 100644
--- a/.github/filters.yml
+++ b/.github/filters.yml
@@ -1,31 +1,50 @@
+# This file is used by the `get-changes` action to determine the changesets.
+# Also see
+# - list of stacks: job `add-stack-label` of workflow `ci_cd.yml`
+# - list of stack labels: https://github.com/WordPress/openverse/labels?q=stack
catalog:
- catalog/**
- # Change to the CI + CD workflow should trigger complete workflow.
- - .github/workflows/ci_cd.yml
+ - docker/minio/**
+ - docker/upstream_db/**
api:
- api/**
- # Change to the CI + CD workflow should trigger complete workflow.
- - .github/workflows/ci_cd.yml
+ - docker/db/**
+ - docker/es/**
+ - docker/nginx/**
+ - load_sample_data.sh
ingestion_server:
- ingestion_server/**
- # Change to the CI + CD workflow should trigger complete workflow.
- - .github/workflows/ci_cd.yml
+ - docker/db/**
+ - docker/es/**
+ - docker/upstream_db/**
+ - load_sample_data.sh
frontend:
- frontend/**
- package.json
- pnpm-lock.yaml
- pnpm-workspace.yaml
+ - tsconfig.json
- .npmrc
- .pnpmfile.cjs
- # Change to the CI + CD workflow should trigger complete workflow.
- - .github/workflows/ci_cd.yml
+analytics:
+ - docker/clickhouse/**
+ - docker/plausible/**
+ - docker/plausible_db/**
+ - setup_plausible.sh
documentation:
- documentation/**
- # Change to the CI + CD workflow should trigger complete workflow.
- - .github/workflows/ci_cd.yml
lint:
- prettier.config.js
- - .prettierignore
+ - .editorconfig
- .eslintrc.js
- .eslintignore
+ - .isort.cfg
+ - .ruff.toml
+ - .prettierignore
- .pre-commit-config.yaml
+mgmt:
+ - .github/**
+ - automations/**
+ci_cd:
+ - .github/actions/**
+ - .github/workflows/ci_cd.yml
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
index 77302205c..324ffba02 100644
--- a/.github/workflows/ci_cd.yml
+++ b/.github/workflows/ci_cd.yml
@@ -36,6 +36,7 @@ jobs:
api: ${{ contains(fromJson(steps.paths-filter.outputs.changes), 'api') }}
frontend: ${{ contains(fromJson(steps.paths-filter.outputs.changes), 'frontend') }}
documentation: ${{ contains(fromJson(steps.paths-filter.outputs.changes), 'documentation') }}
+ ci_cd: ${{ contains(fromJson(steps.paths-filter.outputs.changes), 'ci_cd') }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
@@ -124,26 +125,27 @@ jobs:
- get-changes
steps:
- - name: Checkout repository
- uses: actions/checkout@v3
-
- - name: Add API stack label
- uses: actions-ecosystem/action-add-labels@v1
- if: ${{ needs.get-changes.outputs.api == 'true' }}
- with:
- labels: "🧱 stack: api"
-
- - name: Add ingestion server stack label
- uses: actions-ecosystem/action-add-labels@v1
- if: ${{ needs.get-changes.outputs.ingestion_server == 'true' }}
- with:
- labels: "🧱 stack: ingestion server"
-
- - name: Add frontend stack label
- uses: actions-ecosystem/action-add-labels@v1
- if: ${{ needs.get-changes.outputs.frontend == 'true' }}
+ - name: Apply stack labels
+ uses: actions/github-script@v6
with:
- labels: "🧱 stack: frontend"
+ # Also see
+ # - list of stack filters: `.github/filters.yml`
+ # - list of stack labels: https://github.com/WordPress/openverse/labels?q=stack
+ script: |
+ const stacks = ["catalog", "api", "ingestion_server", "frontend", "documentation", "mgmt"]
+ const labels = JSON
+ .parse('${{ needs.get-changes.outputs.changes }}')
+ .filter(change => stacks.includes(change))
+ .map(change => `🧱 stack: ${change.replace("_", " ")}`)
+ if (labels.len == 0) {
+ labels.push("🚦 status: awaiting triage", "🏷 status: label work required")
+ }
+ github.rest.issues.addLabels({
+ issue_number: context.issue.number,
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ labels,
+ })
build-images:
name: Build Docker images
@@ -229,7 +231,9 @@ jobs:
test-cat:
name: Run tests for the catalog
- if: needs.get-changes.outputs.catalog == 'true'
+ if: |
+ needs.get-changes.outputs.catalog == 'true' ||
+ needs.get-changes.outputs.ci_cd == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
needs:
@@ -260,7 +264,9 @@ jobs:
catalog-checks:
name: Run catalog checks
- if: needs.get-changes.outputs.catalog == 'true'
+ if: |
+ needs.get-changes.outputs.catalog == 'true' ||
+ needs.get-changes.outputs.ci_cd == 'true'
runs-on: ubuntu-latest
needs:
- get-changes
@@ -293,7 +299,9 @@ jobs:
test-ing:
name: Run tests for ingestion-server
- if: needs.get-changes.outputs.ingestion_server == 'true'
+ if: |
+ needs.get-changes.outputs.ingestion_server == 'true' ||
+ needs.get-changes.outputs.ci_cd == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
needs:
@@ -337,7 +345,10 @@ jobs:
test-api:
name: Run tests for the API
- if: needs.get-changes.outputs.ingestion_server == 'true' || needs.get-changes.outputs.api == 'true'
+ if: |
+ needs.get-changes.outputs.ingestion_server == 'true' ||
+ needs.get-changes.outputs.api == 'true' ||
+ needs.get-changes.outputs.ci_cd == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
needs:
@@ -383,7 +394,9 @@ jobs:
django-checks:
name: Run Django checks
- if: needs.get-changes.outputs.api == 'true'
+ if: |
+ needs.get-changes.outputs.api == 'true' ||
+ needs.get-changes.outputs.ci_cd == 'true'
runs-on: ubuntu-latest
needs:
- get-changes
@@ -440,10 +453,12 @@ jobs:
# PRs to meet the required checks criteria and be merged.
bypass-django-checks:
name: Run Django checks
- if: needs.get-changes.outputs.api != 'true'
+ if: |
+ !cancelled() &&
+ needs.django-checks.result == 'skipped'
runs-on: ubuntu-latest
needs:
- - get-changes
+ - django-checks
strategy:
matrix:
name:
@@ -462,7 +477,9 @@ jobs:
nuxt-build:
name: Check Nuxt build
- if: needs.get-changes.outputs.frontend == 'true'
+ if: |
+ needs.get-changes.outputs.frontend == 'true' ||
+ needs.get-changes.outputs.ci_cd == 'true'
runs-on: ubuntu-latest
needs:
- get-changes
@@ -486,7 +503,9 @@ jobs:
nuxt-checks:
name: Run Nuxt checks
- if: needs.get-changes.outputs.frontend == 'true'
+ if: |
+ needs.get-changes.outputs.frontend == 'true' ||
+ needs.get-changes.outputs.ci_cd == 'true'
runs-on: ubuntu-latest
needs:
- get-changes
@@ -520,10 +539,12 @@ jobs:
# PRs to meet the required checks criteria and be merged.
bypass-nuxt-checks:
name: Run Nuxt checks
- if: needs.get-changes.outputs.frontend != 'true'
+ if: |
+ !cancelled() &&
+ needs.nuxt-checks.result == 'skipped'
runs-on: ubuntu-latest
needs:
- - get-changes
+ - nuxt-checks
strategy:
fail-fast: false
matrix:
@@ -537,7 +558,9 @@ jobs:
playwright:
name: Run Playwright tests
- if: needs.get-changes.outputs.frontend == 'true'
+ if: |
+ needs.get-changes.outputs.frontend == 'true' ||
+ needs.get-changes.outputs.ci_cd == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
needs:
@@ -582,10 +605,12 @@ jobs:
# PRs to meet the required checks criteria and be merged.
bypass-playwright:
name: Run Playwright tests
- if: needs.get-changes.outputs.frontend != 'true'
+ if: |
+ !cancelled() &&
+ needs.playwright.result == 'skipped'
runs-on: ubuntu-latest
needs:
- - get-changes
+ - playwright
strategy:
matrix:
name:
@@ -602,10 +627,9 @@ jobs:
if: |
!cancelled() &&
github.event_name == 'pull_request' &&
- needs.get-changes.outputs.frontend == 'true'
+ needs.playwright.result != ''
runs-on: ubuntu-latest
needs:
- - get-changes
- playwright
steps:
diff --git a/.github/workflows/pr_label_check.yml b/.github/workflows/pr_label_check.yml
index 03f4ecd31..cb24f8149 100644
--- a/.github/workflows/pr_label_check.yml
+++ b/.github/workflows/pr_label_check.yml
@@ -14,6 +14,7 @@ on:
- unlabeled
jobs:
+ # List of aspect labels: https://github.com/WordPress/openverse/labels?q=aspect
check_aspect_label:
name: Check aspect label
runs-on: ubuntu-latest
@@ -24,6 +25,7 @@ jobs:
one_of: "πŸ’» aspect: code,πŸ“„ aspect: text,πŸ€– aspect: dx,πŸ•Ή aspect: interface,♿️ aspect: a11y"
repo_token: ${{ secrets.GITHUB_TOKEN }}
+ # List of goal labels: https://github.com/WordPress/openverse/labels?q=goal
check_goal_label:
name: Check goal label
runs-on: ubuntu-latest
@@ -34,6 +36,7 @@ jobs:
one_of: "🌟 goal: addition,πŸ›  goal: fix,✨ goal: improvement,🧰 goal: internal improvement"
repo_token: ${{ secrets.GITHUB_TOKEN }}
+ # List of priority labels: https://github.com/WordPress/openverse/labels?q=priority
check_priority_label:
name: Check priority label
runs-on: ubuntu-latest
@@ -44,6 +47,7 @@ jobs:
one_of: "🟩 priority: low,🟨 priority: medium,🟧 priority: high,πŸŸ₯ priority: critical"
repo_token: ${{ secrets.GITHUB_TOKEN }}
+ # List of stack labels: https://github.com/WordPress/openverse/labels?q=stack
check_stack_label:
name: Check stack label
runs-on: ubuntu-latest
@@ -51,5 +55,5 @@ jobs:
- name: Check stack label
uses: docker://agilepathway/pull-request-label-checker:v1.4.26
with:
- any_of: "🧱 stack: backend,🧱 stack: documentation,🧱 stack: frontend,🧱 stack: mgmt,🧱 stack: api,🧱 stack: catalog,🧱 stack: ingestion server"
+ any_of: "🧱 stack: backend,🧱 stack: analytics, 🧱 stack: documentation,🧱 stack: frontend,🧱 stack: mgmt,🧱 stack: api,🧱 stack: catalog,🧱 stack: ingestion server,🧱 stack: infra"
repo_token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/automations/python/workflows/set_matrix_images.py b/automations/python/workflows/set_matrix_images.py
index 4599a6836..f68ff0604 100644
--- a/automations/python/workflows/set_matrix_images.py
+++ b/automations/python/workflows/set_matrix_images.py
@@ -37,6 +37,8 @@ includes = {
"frontend": {"image": "frontend", "context": "frontend", "target": "app"},
}
+if "ci_cd" in changes:
+ build_matrix["image"] |= set(includes.keys())
if "catalog" in changes:
build_matrix["image"] |= {"upstream_db", "catalog"}
publish_matrix["image"].add("catalog")