From 6edf03e082dccd16da91d0add2760f8999b3029d Mon Sep 17 00:00:00 2001 From: PurHur Date: Mon, 25 May 2026 01:00:39 +0000 Subject: [PATCH] CI: default EXAMPLES_README_SYNC_GATE=1 in fast inventory (#1822) Turn on the examples/README.md drift guard in ci-fast after #1531 fixed post-#764 execute wording. Document the gate in local-ci-matrix and CiScriptsTest. Co-authored-by: Cursor --- docs/local-ci-matrix.md | 1 + script/ci-common.sh | 2 +- script/ci-defaults.env | 1 + script/ci-docker-run.sh | 2 +- test/unit/CiScriptsTest.php | 28 ++++++++++++++++++++++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/docs/local-ci-matrix.md b/docs/local-ci-matrix.md index d81de893236..01ff043d7ec 100644 --- a/docs/local-ci-matrix.md +++ b/docs/local-ci-matrix.md @@ -98,6 +98,7 @@ Defaults are exported from [`script/ci-defaults.env`](../script/ci-defaults.env) | `JIT_PREFLIGHT_GATE` | `0` | `ci-fast.sh` | Early MCJIT probe after `composer install` ([#728](https://github.com/PurHur/php-compiler/issues/728)) | | `M2_SPINE_ISSUE_HYGIENE_GATE` | `1` | `ci-fast.sh` (`ci_run_inventory_checks`) | `script/check-m2-spine-issue-hygiene.php` — stale `m2-spine-unit` tickets ([#1819](https://github.com/PurHur/php-compiler/issues/1819), [#1808](https://github.com/PurHur/php-compiler/issues/1808)); set `0` for bulk spine PRs | | `WAVE3_ROADMAP_SYNC_GATE` | `1` | `ci-fast.sh` (`ci_run_inventory_checks`) | `script/check-wave3-roadmap-sync.php` ([#1802](https://github.com/PurHur/php-compiler/issues/1802), [#1814](https://github.com/PurHur/php-compiler/issues/1814)); set `0` for doc-only iteration | +| `EXAMPLES_README_SYNC_GATE` | `1` | `ci-fast.sh` (`ci_run_inventory_checks`) | `script/check-examples-readme-sync.php` ([#1822](https://github.com/PurHur/php-compiler/issues/1822), [#1531](https://github.com/PurHur/php-compiler/issues/1531)); set `0` for doc-only iteration | Ladder-only env vars (not in `ci-defaults.env`): `MINIWEBAPP_LINT_GATE` (default `1` in `web-smoke.sh`), `MINIWEBAPP_AOT_BISECT_GATE` (default `0` in `miniwebapp-gates.sh` — [#879](https://github.com/PurHur/php-compiler/issues/879)). diff --git a/script/ci-common.sh b/script/ci-common.sh index 5ef8657d846..13a9c3a3636 100644 --- a/script/ci-common.sh +++ b/script/ci-common.sh @@ -88,7 +88,7 @@ ci_run_m2_spine_issue_hygiene_check() { } ci_run_examples_readme_sync_check() { - if [[ "${EXAMPLES_README_SYNC_GATE:-0}" != "1" ]]; then + if [[ "${EXAMPLES_README_SYNC_GATE:-1}" != "1" ]]; then return 0 fi echo "Examples README sync (EXAMPLES_README_SYNC_GATE=1, issue #1822)..." diff --git a/script/ci-defaults.env b/script/ci-defaults.env index 6013cfb1727..0c98058da52 100755 --- a/script/ci-defaults.env +++ b/script/ci-defaults.env @@ -24,3 +24,4 @@ export BOOTSTRAP_LOOP_PROBE_GATE="${BOOTSTRAP_LOOP_PROBE_GATE:-0}" export CAPABILITY_SYNTAX_CHECK="${CAPABILITY_SYNTAX_CHECK:-1}" export M2_SPINE_ISSUE_HYGIENE_GATE="${M2_SPINE_ISSUE_HYGIENE_GATE:-1}" # default on (#1819); opt-out for bulk spine PRs export WAVE3_ROADMAP_SYNC_GATE="${WAVE3_ROADMAP_SYNC_GATE:-1}" # default on (#1814); opt-out WAVE3_ROADMAP_SYNC_GATE=0 for doc-only iteration +export EXAMPLES_README_SYNC_GATE="${EXAMPLES_README_SYNC_GATE:-1}" # default on (#1822); opt-out EXAMPLES_README_SYNC_GATE=0 for doc-only iteration diff --git a/script/ci-docker-run.sh b/script/ci-docker-run.sh index df540e91b07..f00115039c8 100755 --- a/script/ci-docker-run.sh +++ b/script/ci-docker-run.sh @@ -18,6 +18,6 @@ ci_docker_run() { -e "JIT_PREFLIGHT_GATE=${JIT_PREFLIGHT_GATE:-}" \ -e "WAVE3_ROADMAP_SYNC_GATE=${WAVE3_ROADMAP_SYNC_GATE:-1}" \ -e "M2_SPINE_ISSUE_HYGIENE_GATE=${M2_SPINE_ISSUE_HYGIENE_GATE:-1}" \ - -e "EXAMPLES_README_SYNC_GATE=${EXAMPLES_README_SYNC_GATE:-0}" \ + -e "EXAMPLES_README_SYNC_GATE=${EXAMPLES_README_SYNC_GATE:-1}" \ "$@" } diff --git a/test/unit/CiScriptsTest.php b/test/unit/CiScriptsTest.php index 3174a577916..f5a41c7b354 100644 --- a/test/unit/CiScriptsTest.php +++ b/test/unit/CiScriptsTest.php @@ -249,6 +249,26 @@ public function testCiDockerRunPassesWave3RoadmapSyncGateDefaultOn(): void $this->assertStringContainsString('WAVE3_ROADMAP_SYNC_GATE=${WAVE3_ROADMAP_SYNC_GATE:-1}', $body); } + public function testCiDefaultsEnvDefinesExamplesReadmeSyncGateOn(): void + { + $defaults = (string) file_get_contents(dirname(__DIR__, 2).'/script/ci-defaults.env'); + $this->assertStringContainsString('EXAMPLES_README_SYNC_GATE="${EXAMPLES_README_SYNC_GATE:-1}"', $defaults); + } + + public function testCiFastRunsExamplesReadmeSyncViaInventoryChecks(): void + { + $common = (string) file_get_contents(dirname(__DIR__, 2).'/script/ci-common.sh'); + $this->assertStringContainsString('ci_run_examples_readme_sync_check', $common); + $this->assertStringContainsString('check-examples-readme-sync.php', $common); + $this->assertStringContainsString('EXAMPLES_README_SYNC_GATE:-1', $common); + } + + public function testCiDockerRunPassesExamplesReadmeSyncGateDefaultOn(): void + { + $body = (string) file_get_contents(dirname(__DIR__, 2).'/script/ci-docker-run.sh'); + $this->assertStringContainsString('EXAMPLES_README_SYNC_GATE=${EXAMPLES_README_SYNC_GATE:-1}', $body); + } + public function testCiDefaultsEnvDefinesExamplesAotSmokeGateOn(): void { $defaults = (string) file_get_contents(dirname(__DIR__, 2).'/script/ci-defaults.env'); @@ -440,6 +460,14 @@ public function testLocalCiMatrixDocumentsWave3RoadmapSyncGate(): void $this->assertMatchesRegularExpression('/\| `WAVE3_ROADMAP_SYNC_GATE` \| `1` \|/', $doc); } + public function testLocalCiMatrixDocumentsExamplesReadmeSyncGate(): void + { + $doc = (string) file_get_contents(dirname(__DIR__, 2).'/docs/local-ci-matrix.md'); + $this->assertStringContainsString('EXAMPLES_README_SYNC_GATE', $doc); + $this->assertStringContainsString('check-examples-readme-sync.php', $doc); + $this->assertMatchesRegularExpression('/\| `EXAMPLES_README_SYNC_GATE` \| `1` \|/', $doc); + } + public function testLocalCiMatrixDocumentsMiniWebAppGates(): void { $doc = (string) file_get_contents(dirname(__DIR__, 2).'/docs/local-ci-matrix.md');