diff --git a/.github/workflows/_lint.yml b/.github/workflows/_lint.yml index 3547dc9a..c5c7da7d 100644 --- a/.github/workflows/_lint.yml +++ b/.github/workflows/_lint.yml @@ -35,6 +35,12 @@ jobs: # collide on the same cache key and one job fails to save. cache-key-suffix: lint-${{ inputs.runs-on }}-${{ github.workflow }} + - name: Install rustfmt + clippy components + # setup-soldr reads `channel` from rust-toolchain.toml but does not + # honor the `components` array, so cargo fmt / cargo clippy fail with + # "component is not installed". Provision them explicitly here. + run: rustup component add rustfmt clippy + - name: Install system dependencies (Linux) if: runner.os == 'Linux' run: | diff --git a/ci/env.py b/ci/env.py index 6ec69d79..321bfae1 100644 --- a/ci/env.py +++ b/ci/env.py @@ -166,20 +166,18 @@ def activate() -> None: def _apply_rustc_wrapper(env: dict[str, str]) -> dict[str, str]: - """Set RUSTC_WRAPPER to zccache when available, falling back to sccache. + """Set RUSTC_WRAPPER to zccache when available. - The project uses zccache (via soldr) for compile caching. Prefer it; fall - back to sccache for environments where only that is installed. Bare cargo - invocations that consume this env still benefit from the cache even though - most callers in this repo now route through ``soldr cargo`` directly. + The project uses zccache (via soldr) for compile caching. Bare cargo + invocations that consume this env still benefit from the cache even + though most callers in this repo route through ``soldr cargo`` directly + (which manages the wrapper itself). """ if env.get("RUSTC_WRAPPER"): return env - for tool in ("zccache", "sccache"): - found = shutil.which(tool, path=env.get("PATH")) - if found: - env["RUSTC_WRAPPER"] = found - return env + found = shutil.which("zccache", path=env.get("PATH")) + if found: + env["RUSTC_WRAPPER"] = found return env diff --git a/tests/unit/test_version.py b/tests/unit/test_version.py index 68658e47..879b5dc0 100644 --- a/tests/unit/test_version.py +++ b/tests/unit/test_version.py @@ -15,13 +15,18 @@ class MainTester(unittest.TestCase): """Main tester class.""" def test_command(self) -> None: - """Test command line interface (CLI).""" + """Test command line interface (CLI). + + The Rust CLI emits clap's standard " " format + (e.g. "fastled 2.0.7"); assert the package __version__ is present + in that output rather than requiring an exact match. + """ stdout = subprocess.check_output(COMMAND, stdin=subprocess.DEVNULL) version_stdout = stdout.decode("utf-8").strip() - self.assertEqual( - version_stdout, + self.assertIn( __version__, - f"FastLED Version mismatch: {version_stdout} (tool output) != {__version__} (package version)", + version_stdout, + f"FastLED Version mismatch: {version_stdout} (tool output) does not contain {__version__} (package version)", )