From 0b8e4b476750bdcdbcda47950b6e6f8e08cc1950 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Thu, 5 Nov 2026 11:45:49 +0100 Subject: [PATCH] fix: build the site before the CI test suite --- .github/workflows/validate.yml | 13 +++++++++---- tests/test_workflow_paths.py | 5 +++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index fc6d1fc69..eca666728 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -283,6 +283,13 @@ jobs: if: ${{ !cancelled() }} run: python scripts/generate_site.py + # website/dist is gitignored too. Built after the suite, the tests that + # read the rendered pages (page budgets, sidebar, search) found none and + # skipped on every run. + - name: Build the site + if: ${{ !cancelled() }} + run: npm run build --prefix website + - name: Run test suite if: ${{ !cancelled() }} # No test downloads a release asset: 252 MB files fetched into the @@ -302,11 +309,9 @@ jobs: # heading failed it there with nothing in front of it. Run whatever the # suite returned, so one red step does not hide the other. The release # assets are not restored: they change counts, not links or headings. - - name: Build the site + - name: Check the built site if: ${{ !cancelled() }} - run: | - npm run build --prefix website - python scripts/validate_site.py --site-dir website/dist + run: python scripts/validate_site.py --site-dir website/dist label-pr: runs-on: ubuntu-latest diff --git a/tests/test_workflow_paths.py b/tests/test_workflow_paths.py index f1a791a8d..be2994464 100644 --- a/tests/test_workflow_paths.py +++ b/tests/test_workflow_paths.py @@ -142,6 +142,11 @@ class ThePullRequestBuildsTheSite(unittest.TestCase): ) suite = next(i for i, run in enumerate(runs) if "unittest discover" in run) self.assertLess(generate, suite) + # The built pages too: about fifty tests read website/dist. + build = next(i for i, run in enumerate(runs) if "npm run build" in run) + self.assertLess(generate, build) + self.assertLess(build, suite) + self.assertEqual(steps[build].get("if"), "${{ !cancelled() }}") self.assertEqual(steps[suite].get("if"), "${{ !cancelled() }}") # A failed data fetch skipped the generator, and all 228 site tests # then failed under it: the generator runs whatever came before.