Merge pull request #2283 from ludovic111/ci/launcher-check

🤖 Agent: Merging. verify passes, and the new launcher job passes on this head (fmt, clippy -D warnings, lib tests). On the earlier head it had caught main's E0061 before #2281. The Python tests show the same 2 environment errors as main.
This commit is contained in:
Ludovic Marie
2026-10-26 17:23:37 +01:00
committed by GitHub
3 changed files with 74 additions and 3 deletions
+36
View File
@@ -73,6 +73,42 @@ jobs:
run: |
cargo +stable test --workspace --lib --bins --tests --features horizon-client/mods,horizon-mods/pack
cargo +stable test --workspace --doc --features horizon-client/mods,horizon-mods/pack
# The launcher is its own workspace (launcher/Cargo.toml), so verify's cargo runs never build it. A pull request that
# changes it or a crate it builds is checked here, and so is every push to main: two pull requests can each pass
# alone and break it together (#2059 and the registry ratings did, 2026-10-26).
launcher:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Does this pull request change the launcher or a crate it builds?
if: github.event_name == 'pull_request'
id: launcher
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: python3 tools/ci/rust_changes.py --launcher "$BASE_SHA" "$HEAD_SHA" >> "$GITHUB_OUTPUT"
- name: Install Rust and the headers GPUI links against
if: steps.launcher.outputs.required != 'false'
run: |
sudo apt-get update && sudo apt-get install -y --no-install-recommends libxkbcommon-x11-dev libwayland-dev \
libx11-xcb-dev libfontconfig-dev libvulkan-dev libasound2-dev libudev-dev
rustup toolchain install stable --profile minimal --component rustfmt --component clippy
- uses: Swatinem/rust-cache@v2
if: steps.launcher.outputs.required != 'false'
with:
workspaces: launcher
shared-key: launcher
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Check the launcher's formatting, lint and tests
if: steps.launcher.outputs.required != 'false'
working-directory: launcher
run: |
cargo +stable fmt --check
cargo +stable clippy --all-targets --locked -- -D warnings
cargo +stable test --locked --lib
# Most pull requests leave the harnesses to parity-main, which runs them on main a batch of merges at a time
# (.github/workflows/parity-main.yml; releases wait for it). A pull request still runs them itself when it changes
# a harness, an oracle, a probe or the runner, or carries the run-parity label (run-parity.yml, when it is added).
+12 -1
View File
@@ -4,7 +4,7 @@ import subprocess
import tempfile
import unittest
from tools.ci.rust_changes import changed_paths, needs_rust
from tools.ci.rust_changes import changed_paths, needs_launcher, needs_rust
class RustChangesTests(unittest.TestCase):
@@ -21,6 +21,17 @@ class RustChangesTests(unittest.TestCase):
with self.subTest(path=path):
self.assertTrue(needs_rust(["README.md", path]))
def test_launcher_checks_follow_the_crates_it_builds(self):
for path in ["crates/horizon-client/src/game.rs", "launcher/links.json", "launcher/docs/a.md",
"launcher/README.md", "website/src/index.html", "tools/pr_ready.py"]:
with self.subTest(path=path):
self.assertFalse(needs_launcher([path]))
for path in ["launcher/src/main.rs", "launcher/Cargo.lock", "crates/horizon-port-pack/src/net.rs",
"crates/horizon-theme/src/lib.rs", "Cargo.toml", "Cargo.lock",
".github/workflows/ci.yml"]:
with self.subTest(path=path):
self.assertTrue(needs_launcher(["README.md", path]))
def test_moving_source_into_docs_still_requires_rust(self):
with tempfile.TemporaryDirectory() as directory:
def git(*args):
+26 -2
View File
@@ -1,14 +1,36 @@
#!/usr/bin/env python3
"""Keep verify's Rust steps for any change beyond documentation."""
"""Keep verify's Rust steps for any change beyond documentation.
--launcher: whether the change is built into the launcher, its own workspace (release_train.LAUNCHER_PATHS).
"""
import argparse
import subprocess
import sys
from pathlib import Path
# The repository root, appended so a script run finds `tools` without shadowing anything already importable.
sys.path.append(str(Path(__file__).resolve().parents[2]))
from tools import release_train # noqa: E402
# The root workspace's manifest and toolchain files: the launcher's path crates inherit from them.
ROOT_RUST = {"Cargo.toml", "Cargo.lock", "rust-toolchain.toml", "rustfmt.toml", "clippy.toml"}
# The check itself: a change to it runs it.
LAUNCHER_CHECK = {".github/workflows/ci.yml", "tools/ci/rust_changes.py", "tools/release_train.py"}
def needs_rust(paths):
return any(not (path.startswith("docs/") or path.endswith(".md")) for path in paths)
def needs_launcher(paths):
return any(path in ROOT_RUST or path in LAUNCHER_CHECK or (
path.startswith(tuple(release_train.LAUNCHER_PATHS))
and not path.startswith(tuple(release_train.LAUNCHER_IGNORED))
and not path.endswith(".md")
) for path in paths)
def changed_paths(base, head):
# Renames must include deletions too: moving source into docs still affects Rust.
output = subprocess.check_output([
@@ -21,5 +43,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("base")
parser.add_argument("head")
parser.add_argument("--launcher", action="store_true", help="answer for the launcher instead")
args = parser.parse_args()
print(f"required={str(needs_rust(changed_paths(args.base, args.head))).lower()}")
needs = needs_launcher if args.launcher else needs_rust
print(f"required={str(needs(changed_paths(args.base, args.head))).lower()}")