diff --git a/quest/m0/nightly/README.md b/quest/m0/nightly/README.md index 93a9ac19281..e58a48a54c5 100644 --- a/quest/m0/nightly/README.md +++ b/quest/m0/nightly/README.md @@ -1,4 +1,4 @@ -# Nightly passes on main +# [S] Nightly passes on main ## Goal @@ -16,7 +16,7 @@ Decided 2026-10-24 (maintainer), from a triage of run child per distinct cause, each landing on its own. The PR gate keeps skipping benches and examples; a green Nightly catches them within a day. -This README's own work, after the children: +This README's own work: - Nightly's multi-step jobs (Features first) keep going past a failed step and fail at the end, so one break never hides the steps after it. @@ -30,7 +30,3 @@ This README's own work, after the children: [moq-dev/moq#6656](https://github.com/moq-dev/moq/pull/6656). Public API: none. Wire: none. - -## Required - -- [Nightly's base in a shallow checkout](/quest/m0/nightly/shallow-base.md) - `sh/gh/nightly.test.py` passes in Nightly's depth-1 checkout diff --git a/quest/m0/nightly/shallow-base.md b/quest/m0/nightly/shallow-base.md deleted file mode 100644 index 636fb21b259..00000000000 --- a/quest/m0/nightly/shallow-base.md +++ /dev/null @@ -1,15 +0,0 @@ -# [XS] Nightly's base in a shallow checkout - -## Goal - -`test_paired_base_is_the_previous_scheduled_nightly` -(`sh/gh/nightly.test.py:46`) passes in Nightly's Tests matrix. - -## Plan - -The test runs `git rev-parse HEAD~1`, but the Tests matrix in `nightly.yml` -checks out with the default `fetch-depth: 1`, so it exits 128. Added by -[moq-dev/moq#6511](https://github.com/moq-dev/moq/pull/6511). Make the test -build its own history instead of reading the checkout's. - -Public API: none. Wire: none. diff --git a/sh/gh/nightly.test.py b/sh/gh/nightly.test.py index f39a2014200..c1a11aaaa67 100644 --- a/sh/gh/nightly.test.py +++ b/sh/gh/nightly.test.py @@ -16,7 +16,7 @@ class NightlyTest(unittest.TestCase): - def run_group(self, group, fail="", **environment): + def run_group(self, group, fail="", cwd=ROOT, **environment): with tempfile.TemporaryDirectory() as directory: scratch = Path(directory) calls = scratch / "calls" @@ -38,28 +38,36 @@ def run_group(self, group, fail="", **environment): BENCH_RESULTS=str(scratch / "results"), NIGHTLY_CALLS=str(calls), NIGHTLY_FAIL=fail, BASH_ENV="/dev/null") env.pop("BENCH_BASE", None) env.update(environment) - result = subprocess.run(["bash", "sh/gh/nightly.sh", group], cwd=ROOT, + result = subprocess.run(["bash", ROOT / "sh/gh/nightly.sh", group], cwd=cwd, env=env, capture_output=True, text=True) self.bases = set(Path(f"{calls}.base").read_text().splitlines()) if calls.exists() else set() return result, calls.read_text().splitlines() if calls.exists() else [] def test_paired_base_is_the_previous_scheduled_nightly(self): - head, parent = (subprocess.run(["git", "rev-parse", revision], cwd=ROOT, capture_output=True, text=True, - check=True).stdout.strip() for revision in ("HEAD", "HEAD~1")) - # This run is the newest scheduled one; the previous run's commit is the base. - runs = json.dumps([{"databaseId": 2, "headSha": parent}, {"databaseId": 1, "headSha": head}]) - result, _ = self.run_group("rust-uring", BENCH_BASE="previous-nightly", GITHUB_RUN_ID="2", NIGHTLY_RUNS=runs) - self.assertEqual(result.returncode, 0, result.stderr) - self.assertEqual(self.bases, {head}) - # A named revision reaches the runner as its commit. - result, _ = self.run_group("rust-uring", BENCH_BASE="HEAD~1") - self.assertEqual(result.returncode, 0, result.stderr) - self.assertEqual(self.bases, {parent}) - result, calls = self.run_group("rust-uring", BENCH_BASE="previous-nightly", GITHUB_RUN_ID="1", - NIGHTLY_RUNS=json.dumps([{"databaseId": 1, "headSha": head}])) - self.assertEqual(result.returncode, 1) - self.assertIn("no previous scheduled Nightly", result.stderr) - self.assertEqual(calls, []) + # Nightly checks out shallowly, so the test builds the history it resolves against. + with tempfile.TemporaryDirectory() as repo: + git = ["git", "-C", repo, "-c", "user.name=nightly", "-c", "user.email=nightly@example.com", + "-c", "commit.gpgsign=false"] + subprocess.run([*git, "init", "-q"], check=True) + for message in ("parent", "head"): + subprocess.run([*git, "commit", "-q", "--allow-empty", "-m", message], check=True) + head, parent = (subprocess.run([*git, "rev-parse", revision], capture_output=True, text=True, + check=True).stdout.strip() for revision in ("HEAD", "HEAD~1")) + # This run is the newest scheduled one; the previous run's commit is the base. + runs = json.dumps([{"databaseId": 2, "headSha": parent}, {"databaseId": 1, "headSha": head}]) + result, _ = self.run_group("rust-uring", cwd=repo, BENCH_BASE="previous-nightly", GITHUB_RUN_ID="2", + NIGHTLY_RUNS=runs) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(self.bases, {head}) + # A named revision reaches the runner as its commit. + result, _ = self.run_group("rust-uring", cwd=repo, BENCH_BASE="HEAD~1") + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(self.bases, {parent}) + result, calls = self.run_group("rust-uring", cwd=repo, BENCH_BASE="previous-nightly", + GITHUB_RUN_ID="1", NIGHTLY_RUNS=json.dumps([{"databaseId": 1, "headSha": head}])) + self.assertEqual(result.returncode, 1) + self.assertIn("no previous scheduled Nightly", result.stderr) + self.assertEqual(calls, []) def test_paired_base_applies_only_to_rust_bench_groups(self): for group in ("js", "rust-test", "bindings"):