Skip to content

ci: cache c2a-boom-tools binaries in pytest workflow#490

Open
sksat (sksat) wants to merge 1 commit into
mainfrom
ci/cache-boom-tools
Open

ci: cache c2a-boom-tools binaries in pytest workflow#490
sksat (sksat) wants to merge 1 commit into
mainfrom
ci/cache-boom-tools

Conversation

@sksat

Copy link
Copy Markdown
Member

概要

pytest CI が稀に setup 段階で落ちる flake の修正その 2(その 1 は #488)。boom-tools のバイナリ群を actions/cache でキャッシュし、キャッシュヒット時は preinstall がネットワークに一切出ないようにする。

背景

#488 に書いたとおり、flake の入口は cargo-binstall の fetcher のネットワークタイムアウト。#488 はタイムアウト後の fallback ビルドを直すものだが、本 PR はそもそも毎回のダウンロード自体を不要にして、ネットワーク起因の失敗確率と CI 時間を下げる。

変更内容

  • install.sh(mobc / subobc 共通): C2A_BOOM_TOOLS_CACHE_DIR が設定されている場合、
    • 全 7 バイナリがそこに揃っていれば ./bin/ に復元して即終了(cargo-binstall のダウンロードも含めて network access ゼロ)
    • 揃っていなければ従来どおりインストールし、最後にキャッシュへ保存
    • 未設定時(ローカル)は従来と完全に同一の挙動
  • pytest.yml:
    • 既存の "Cache C2A devtools" ステップを置き換え。このステップは examples/mobc/tools/(boom-tools/ への改名前のパス)を参照しており、実際には何もキャッシュしていなかった(hashFiles の対象も存在しないため key も縮退していた)
    • キャッシュ key は install.sh の hashFiles。ツールのバージョンはすべて install.sh 内に書かれているので、バージョン更新時に自然に key が変わる
    • matrix 全 9 job で同一 key を共有(preinstall が走るのはどの job でも examples/mobc のため)

動作確認

ローカルで restore パス(完全キャッシュ → 復元して即終了、ネットワーク不要)と miss パス(欠けあり → 通常インストールへ進む)の両方を確認済み。

備考

  • fix(boom-tools): pass --locked to cargo-binstall #488 と本 PR は install.sh で軽微に conflict するので、先にマージされた方に追従して rebase する
  • 初回キャッシュ作成時の同時 job 競合は actions/cache が良きに計らう(最初に Post 処理に到達した job が保存し、他は保存スキップ)

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings June 10, 2026 15:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to reduce flaky failures during pytest CI setup by caching c2a-boom-tools binaries via actions/cache, so that when the cache hits the boom-tools preinstall can restore binaries locally and avoid any network access.

Changes:

  • Add a CI-only restore/save path in examples/*/boom-tools/install.sh controlled by C2A_BOOM_TOOLS_CACHE_DIR.
  • Replace the existing (effectively no-op) devtools cache step in pytest.yml with a cache for the boom-tools binary directory keyed by the install.sh hash.
  • Wire C2A_BOOM_TOOLS_CACHE_DIR into the workflow so pnpm install can reuse cached boom-tools binaries.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
examples/mobc/boom-tools/install.sh Restore/save boom-tools binaries from/to a cache directory when C2A_BOOM_TOOLS_CACHE_DIR is set.
examples/subobc/boom-tools/install.sh Same cache restore/save behavior as mobc for consistency across users.
.github/workflows/pytest.yml Cache ${{ runner.temp }}/c2a-boom-tools and set C2A_BOOM_TOOLS_CACHE_DIR for the pnpm install step.
Comments suppressed due to low confidence (2)

examples/mobc/boom-tools/install.sh:31

  • cargo-binstall is invoked without --locked. If cargo-binstall falls back to a source build (e.g., after a fetch timeout), Cargo may resolve newer transitive dependencies than the pinned toolchain supports, causing deterministic CI failures (the same issue described in PR #488). Add --locked to all cargo-binstall invocations so the fallback build uses each crate's Cargo.lock.
./bin/cargo-binstall --root . tmtc-c2a               --version 1.1.1 --no-confirm

./bin/cargo-binstall --root . tlmcmddb-cli           --version 2.6.1 --no-confirm
./bin/cargo-binstall --root . kble                   --version 0.4.2 --no-confirm
./bin/cargo-binstall --root . kble-serialport        --version 0.4.2 --no-confirm

examples/subobc/boom-tools/install.sh:31

  • cargo-binstall is invoked without --locked. If cargo-binstall falls back to a source build (e.g., after a fetch timeout), Cargo may resolve newer transitive dependencies than the pinned toolchain supports, causing deterministic CI failures. Add --locked to all cargo-binstall invocations so the fallback build uses each crate's Cargo.lock.
./bin/cargo-binstall --root . tmtc-c2a               --version 1.1.1 --no-confirm

./bin/cargo-binstall --root . tlmcmddb-cli           --version 2.6.1 --no-confirm
./bin/cargo-binstall --root . kble                   --version 0.4.2 --no-confirm
./bin/cargo-binstall --root . kble-serialport        --version 0.4.2 --no-confirm

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The boom-tools preinstall downloads prebuilt binaries via cargo-binstall
on every CI run. When the binstall fetchers hit a network timeout, it
silently falls back to building from source, which currently always
fails (edition 2024 transitive deps vs the pinned Rust 1.81.0
toolchain), making pytest CI flaky.

Teach install.sh to restore/save binaries from a cache directory given
via C2A_BOOM_TOOLS_CACHE_DIR (opt-in; local behavior is unchanged when
unset), and wire it to actions/cache keyed on the hash of install.sh,
which contains all tool versions. On a cache hit the preinstall now
performs no network access at all.

This replaces the stale 'Cache C2A devtools' step, which referenced
examples/mobc/tools/ — a path that no longer exists (renamed to
boom-tools/) — and therefore cached nothing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants