Repository navigation
perf(ci): PRテンプレートだけのループ検査と同じPRの古いCIを省く - #131
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
結論
PRテンプレートだけを直したときは、Ubuntu・macOSともに重いループ検査を省きます。先日のテンプレート変更では、macOSのループ検査だけで12分24秒かかっていました。変更前の実行ログ
同じPRに次のコミットが届くと、古いCIをキャンセルします。
mainは従来どおりpushごとに検証します。図: PRとmainでどの実行を残し、どの差分でループ検査を省くか
変更点
scripts/test-loop.shを省略対象は
.github/PULL_REQUEST_TEMPLATE.mdとskills/da-pr/reference/pr-template.md。PRではベースとマージ結果を、mainではpush前後を比較します。差分が空、比較元が不明、あるいは別のファイルの削除・改名を含む場合もループ検査を実行します。手元の./scripts/check.shは全検査を実行します。動作確認
node scripts/test-ci-loop.mjsは実際のGitリポジトリで10ケース成功。対象外ファイルの改名を見落とす変更を一時コピーに入れると、該当ケースで終了コード1になりました。gate.sh verify --jsonはok: true、12項目を実行。GitHub Actionsの条件式も評価し、別PRと3回のmain pushにそれぞれ異なるグループが割り当てられることを確かめました。一時リポジトリでPRテンプレートだけを変更し、CIと同じ
./scripts/check.sh --ci "$base"を実行した結果(終了コード0)。最終コミット
805295bのGitHub Actionsは6ジョブすべて成功しました。macOSは初回にランナーの割り当てがなく、ジョブ単独の再実行でループ検査を含む全検査を完了しました。手元のmacOS(arm64、bash 3.2)でも./scripts/check.shが終了コード0で完了しました。macOSの実行ログ