Skip to content

ci: share the Swift package cache and move actions to Node 24 - #605

Merged
whes1015 merged 2 commits into
mainfrom
ci/node24-and-spm-cache
Oct 11, 2026
Merged

whes1015 merged 2 commits into
mainfrom
ci/node24-and-spm-cache

Conversation

@whes1015

Copy link
Copy Markdown
Member

這個 PR 做了什麼

讓 PR 的 iOS 建置能還原 main 存下的 Swift 套件快取,並把剩下仍跑在 Node 20 的 action 升到第一個支援 Node 24 的 major。所有 workflow 的行為都沒變。

d8096522 ci: let pull requests restore the Swift package cache main saves(ios.yml、release.yml)

  • 兩個 workflow 的 SPM 快取用同一個 key,但列的路徑不同。actions/cache 的快取版本是用路徑清單算出來的 hash,路徑不同就是兩份不同的快取(actions/cache README:「build-linux will create two different caches as the paths are different」)。

  • 所以 PR 永遠還原不到 release.yml 在 main 存的那份。每個 PR 都從零重建套件,再用同一個 key 另存一份自己的。目前的 cache 清單就是這樣:

    key ref 大小
    macOS-spm-3827c54c… refs/heads/main 878 MB
    macOS-spm-3827c54c… refs/pull/604/merge 883 MB
    macOS-spm-3827c54c… refs/pull/588/merge 884 MB
  • 修法是兩邊改成列同樣三個路徑。release.yml 三個都會用到:Flutter 那一步 clone 到 build/ios/SourcePackages,後面直接呼叫的 xcodebuild archive 沒有帶 -clonedSourcePackagesDirPath,所以 clone 到 DerivedData。ios.yml 只會寫入前兩個,第三個列出來只是為了讓兩邊清單一致。

  • 原本 release.yml 沒有快取 build/ios/SourcePackages,這次補上後,release 的 Flutter 那一步也能用到快取。

f8cdf49c ci: move the remaining actions onto their Node 24 majors(android.yml、ios.yml、release.yml、review.yml)

最近的 run 都有「targets Node.js 20 but is being forced to run on Node.js 24」的警告。各升到第一個支援 Node 24 的 major,用到的 input 都沒有受到破壞性變更影響:

action 原版本 新版本 確認過的地方
actions/cache v4 v5 v5 只換 runtime;ios.yml、android.yml 本來就用 v5
actions/upload-artifact v4 v6 v5 先支援 Node 24,v6 預設改用 Node 24
actions/download-artifact v4 v7 v5 改的是「用 ID 下載單一 artifact」的解壓位置;release.yml 是全部下載 + merge-multiple,不受影響
dorny/paths-filter v3 v4 v4 只換 runtime
actions/github-script v7 v8 v8 只換 runtime;v9 才會讓 require('@actions/github') 失效,review.yml 的 script 沒有用 require

setup-java@v5 和 jdx/mise-action@v4 本來就是 Node 24,沒有動。

相關 issue

沒有對應的 issue。

怎麼驗

  • actionlint 1.7.12 -shellcheck= 跑過全部 workflow,沒有警告。
  • 兩邊 SPM 快取的 path、key、restore-keys 逐行比對過,完全相同。
  • 合併後第一次 release 會因為路徑改變而 miss,存下新的快取;之後開的 PR,iOS job 的 Cache Swift Packages 應該顯示從 main 的 key 還原,而且不會再另存一份 PR 自己的快取。
  • release.yml 只有 push main 才會跑,這個 PR 上驗不到。快取那一步只影響速度:還原失敗就是照原本的方式重新抓套件,不會讓建置失敗。

檢查清單

  • tool/check/commits.sh origin/main..HEAD 通過
  • 一個 commit 一件事
  • mise exec -- flutter analyze 與 mise exec -- flutter test 通過(只改 workflow,交給 CI)
  • 新的使用者可見字串都走 AppLocalizations(沒有新字串)
  • 有 UI 變更的話(沒有 UI 變更)

ios.yml and release.yml cache Swift packages under the same key but
listed different paths. A cache entry's version is a hash of its path
list, so the two were separate caches: no pull request ever restored
the entry release.yml saved on main. Each one missed, rebuilt the
packages cold, and stored its own ~880 MB copy under that same key;
the cache list shows one per open pull request beside main's.

Give both the same three paths. release.yml needs every one of them:
Flutter's step clones into build/ios/SourcePackages and the xcodebuild
archive after it clones into DerivedData. ios.yml writes only the
first two and lists the third so the lists match.
Runs still warned that cache@v4, upload-artifact@v4,
download-artifact@v4, paths-filter@v3 and github-script@v7 target
Node 20 and are being forced onto Node 24. Take the first major of each
that ships Node 24: cache v5 (what ios.yml and android.yml already use),
upload-artifact v6, download-artifact v7, paths-filter v4 and
github-script v8.

None of those majors changes an input used here. download-artifact v5
changed where an artifact fetched by id is extracted; release.yml
fetches them all with merge-multiple, which that change does not touch.
@github-actions

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 0 finding(s) across 4 selected item(s).

@codecov

codecov Bot commented Oct 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.26%. Comparing base (1271afb) to head (f8cdf49).

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@whes1015
whes1015 merged commit d32c91d into main Oct 11, 2026
8 checks passed
@whes1015
whes1015 deleted the ci/node24-and-spm-cache branch October 11, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants