Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

ci(oss): re-pin to Node 24 majors with exact versions, Dependabot for actions, pinned runner and SDK, no cancelling of main pushes

eyalgolan710f2a3b1ae1
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 000000000..4f18d7b55
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,9 @@
+# Keeps the SHA-pinned actions in .github/workflows current (it bumps the SHA and the version comment together).
+version: 2
+updates:
+ - package-ecosystem: github-actions
+ directory: /
+ schedule:
+ interval: weekly
+ commit-message:
+ prefix: "ci"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c94697975..377fbedd7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -7,7 +7,7 @@ name: CI
# contributions come in under the repository licences (inbound = outbound, GitHub Terms of Service D.6; decision D2).
# Unity edit-mode tests are not run here; CONTRIBUTING.md, "What CI runs", says why.
# No `schedule:` and no `pull_request_target`, on purpose. Every action is pinned to a commit SHA
-# (scripts/oss/pin_actions.py). The job names are the required checks in scripts/oss/github/ruleset-protect-main.json;
+# (scripts/oss/pin_actions.py). The job names are the required checks in scripts/oss/github/ruleset-main-review.json;
# a test keeps the two identical.
on:
@@ -19,38 +19,41 @@ on:
permissions:
contents: read
+env:
+ UV_PYTHON: "3.12"
+
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
sim:
name: Sim (dotnet test)
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
+ - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
- dotnet-version: "10.0.x"
+ dotnet-version: "10.0.401"
- name: Simulation and content tests
run: dotnet test sim/Statecraft.sln -c Release
tools:
name: Tools (pytest)
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# tools/tests/test_package_release.py runs the sim's release gate (dotnet run --project sim/Statecraft.Cli).
- - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
+ - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
- dotnet-version: "10.0.x"
- - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
+ dotnet-version: "10.0.401"
+ - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
with:
version: "0.12.5"
- name: Data tool tests
@@ -58,13 +61,13 @@ jobs:
policy:
name: Repo policy
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
+ - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
with:
version: "0.12.5"
- name: Policy checker tests
@@ -75,14 +78,14 @@ jobs:
changelog:
name: Changelog
if: github.event_name == 'pull_request'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
+ - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
with:
version: "0.12.5"
- name: A user-visible change carries a CHANGELOG line or the no-changelog label
diff --git a/scripts/oss/tests/test_github_config.py b/scripts/oss/tests/test_github_config.py
index cd599eea5..f0057d25c 100644
--- a/scripts/oss/tests/test_github_config.py
+++ b/scripts/oss/tests/test_github_config.py
@@ -92,3 +92,20 @@ def test_ci_commands_match_contributing():
def test_codeowners_makes_the_maintainer_owner_of_everything():
lines = [l for l in (ROOT / ".github/CODEOWNERS").read_text().splitlines() if l and not l.startswith("#")]
assert lines == ["* @eyalgolan"]
+
+
+# Review fix round 1 (I5, M1, M2, M4).
+def test_pins_carry_exact_version_comments_and_dependabot_keeps_them_current():
+ for ref_line in re.findall(r"uses:\s*[\w.-]+/[\w./-]+@[0-9a-f]{40}.*", CI.read_text(encoding="utf-8")):
+ assert re.search(r"# v\d+\.\d+\.\d+$", ref_line), ref_line
+ dep = yaml.safe_load((ROOT / ".github/dependabot.yml").read_text(encoding="utf-8"))
+ assert dep["version"] == 2 and any(u["package-ecosystem"] == "github-actions" for u in dep["updates"])
+
+
+def test_toolchain_is_pinned_and_main_pushes_are_not_cancelled():
+ text = CI.read_text(encoding="utf-8")
+ assert "ubuntu-latest" not in text and "ubuntu-24.04" in text
+ assert 'dotnet-version: "10.0.401"' in text and "10.0.x" not in text
+ assert 'UV_PYTHON: "3.12"' in text
+ assert "cancel-in-progress: ${{ github.event_name == 'pull_request' }}" in text
+ assert "ruleset-protect-main.json" not in text and "ruleset-main-review.json" in text