diff --git a/.github/workflows/README.md b/.github/workflows/README.md index d5e7fd7c335..2cf6da91b7e 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -103,12 +103,14 @@ Triggers `deploy.yaml` after successful processing via `repository_dispatch`. -### [cluster-tests.yaml](cluster-tests.yaml) -**Clusters parser regression tests and stated sub-cluster counts** +### [script-tests.yaml](script-tests.yaml) +**Unit tests for the scripts** | Trigger | Runs on | |---------|---------| -| Pull requests changing the clusters data, parser or tests | PR branches | +| Pull requests | PR branches | + +Runs every test in `scripts/tests/` (including the SEO checks and the clusters parser and sub-cluster counts) and `scripts/test_parse_disciplines_gdoc.py`. ### [check_images.yaml](check_images.yaml) **Image validation in PRs** diff --git a/.github/workflows/cluster-tests.yaml b/.github/workflows/cluster-tests.yaml deleted file mode 100644 index 0df4cd336d3..00000000000 --- a/.github/workflows/cluster-tests.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: Cluster Tests - -# ======================= -# Clusters data checks -# ======================= -# Purpose: Runs the parser regression tests and checks the stated sub-cluster counts -# Triggers: PRs that change the clusters data, its parser or these tests - -on: - pull_request: - paths: - - 'data/clusters_v4.json' - - 'scripts/parse_clusters_to_sheet.py' - - 'scripts/tests/test_clusters_data.py' - - 'scripts/tests/test_parse_clusters.py' - - '.github/workflows/cluster-tests.yaml' - -permissions: - contents: read - -jobs: - cluster-tests: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Run cluster tests - run: python3 -m unittest discover -s scripts/tests -p 'test_*clusters*.py' diff --git a/.github/workflows/script-tests.yaml b/.github/workflows/script-tests.yaml new file mode 100644 index 00000000000..046981d2bf0 --- /dev/null +++ b/.github/workflows/script-tests.yaml @@ -0,0 +1,39 @@ +name: Script Tests + +# ======================= +# Script unit tests +# ======================= +# Purpose: Runs every unit test in scripts/tests/ (SEO checks, data and staging +# scripts, clusters parser and stated sub-cluster counts) and the +# disciplines parser test. The tests take a few seconds. +# Triggers: Every pull request, since tests also read data, content and workflows + +on: + pull_request: + +permissions: + contents: read + +jobs: + script-tests: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.11" + + # pandas: resource.py; python-docx: the disciplines parser; + # playwright (imported only, no browsers): the Doors preview checks. + - name: Install test dependencies + run: python3 -m pip install pandas python-docx playwright + + - name: Run tests in scripts/tests + run: python3 -m unittest discover -s scripts/tests + + - name: Run the disciplines parser test + run: python3 -m unittest discover -s scripts -p 'test_parse_disciplines_gdoc.py' diff --git a/AGENTS.md b/AGENTS.md index a6254100d8a..7ca7c464c0b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,4 +22,4 @@ Run both against a build (`hugo -d