ci: stop Actions cache thrashing, fix orphan keys, and trim paid runner waste (#9740)

* ci: stop Actions cache thrashing, fix orphan keys, and trim paid runner waste

Consolidate sm-standard-4 and ubuntu-latest shared Rust caches, fix six orphan cache-shared-key references and rust-cache env-hash mismatches, archive e2e_test once in dual-stack-nightly, move prebuilt fuzz and nixl-check lanes to ubuntu-latest (guarding fuzz metadata probe with RUSTUP_AUTO_INSTALL=0), and deduplicate artifact-only manual packaging runs.

Refs: https://github.com/rustfs/backlog/issues/3379

* test(ci): merge step-level env in nightly e2e workflow provenance test

Align BinaryProvenanceTests.test_nightly_workflow_builds_and_runs_matching_features with GitHub Actions env precedence (workflow -> job -> step) while keeping RUSTFS_E2E_LOG_DIR pointed at the gitignored fixture target dir, and assert RUSTFS_BUILD_FEATURES stays out of job-level env so Swatinem/rust-cache keys match cache-warm.yml.
This commit is contained in:
RustFS
2026-11-29 11:04:18 +08:00
committed by GitHub
parent b26ec5c9c3
commit af6020607b
21 changed files with 213 additions and 89 deletions
+15 -6
View File
@@ -215,24 +215,33 @@ if os.environ.get("FAKE_BUILD_MUTATE"):
import yaml
workflow = Path(__file__).resolve().parents[1] / ".github/workflows/e2e-replication-nightly.yml"
jobs = yaml.safe_load(workflow.read_text())["jobs"]
doc = yaml.safe_load(workflow.read_text())
workflow_env = {k: str(v) for k, v in (doc.get("env") or {}).items()}
jobs = doc["jobs"]
for job_name, expected in (("repl-nightly", set()), ("protocols-nightly", {"ftps", "webdav", "sftp"})):
job = jobs[job_name]
job_env = {**workflow_env, **{k: str(v) for k, v in (job.get("env") or {}).items()}}
steps = {step["name"]: step for step in job["steps"]}
build = next(step for name, step in steps.items() if name.startswith("Build "))
run = next(step for name, step in steps.items() if name.startswith("Run "))
with self.subTest(job=job_name):
features = job["env"].get("RUSTFS_BUILD_FEATURES", "")
env = dict(self.env, RUSTFS_BUILD_FEATURES=features, RUSTFS_E2E_LOG_DIR=str(self.root / "target/logs"))
result = subprocess.run(["bash", "-e", "-o", "pipefail", "-c", build["run"]], cwd=self.root, env=env, capture_output=True, text=True)
# Keep RUSTFS_BUILD_FEATURES step-scoped so ./.github/actions/setup
# does not hash it into the shared Swatinem/rust-cache key.
self.assertNotIn("RUSTFS_BUILD_FEATURES", job_env)
base_env = {**self.env, **job_env}
log_override = {"RUSTFS_E2E_LOG_DIR": str(self.root / "target/logs")}
build_env = {**base_env, **{k: str(v) for k, v in (build.get("env") or {}).items()}, **log_override}
run_env = {**base_env, **{k: str(v) for k, v in (run.get("env") or {}).items()}, **log_override}
result = subprocess.run(["bash", "-e", "-o", "pipefail", "-c", build["run"]], cwd=self.root, env=build_env, capture_output=True, text=True)
self.assertEqual(result.returncode, 0, result.stderr)
manifest = json.loads(self.sidecar.read_text())
self.assertEqual(set(manifest["requested_features"]), expected)
self.assertEqual(set(manifest["features"]), expected | {"default", "ftps", "webdav"})
for status in (0, 23):
result = subprocess.run(["bash", "-e", "-o", "pipefail", "-c", run["run"]], cwd=self.root, env=dict(env, FAKE_TEST_EXIT=str(status)), capture_output=True, text=True)
result = subprocess.run(["bash", "-e", "-o", "pipefail", "-c", run["run"]], cwd=self.root, env=dict(run_env, FAKE_TEST_EXIT=str(status)), capture_output=True, text=True)
self.assertEqual(result.returncode, status, result.stderr)
result = subprocess.run(["bash", "-e", "-o", "pipefail", "-c", run["run"]], cwd=self.root, env=dict(env, RUSTFS_BUILD_FEATURES=features + ",unexpected-feature"), capture_output=True, text=True)
features = run_env.get("RUSTFS_BUILD_FEATURES", "")
result = subprocess.run(["bash", "-e", "-o", "pipefail", "-c", run["run"]], cwd=self.root, env=dict(run_env, RUSTFS_BUILD_FEATURES=features + ",unexpected-feature"), capture_output=True, text=True)
self.assertNotEqual(result.returncode, 0)
self.assertIn("build features/profile differ", result.stdout + result.stderr)