GitHub Actions の matrix における fail-fast とは?
fail-fast は、1 つの失敗した matrix セルが他をキャンセルするかどうかを決めます。デフォルトは true です。
matrix は多数の並列ジョブを起動できます。デフォルトでは 1 つが失敗すると、GitHub は時間を節約するために残りをキャンセルします。fail-fast 設定を使うと、完全な結果が欲しいときにそれをオフにできます。
概要
matrix の strategy オプションです。fail-fast: true (デフォルト) のとき、最初に失敗した matrix ジョブが実行中および保留中のすべての兄弟をキャンセルします。false のときは、すべてのセルが完了まで実行されます。
Disabling fail-fast
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]仕組み
高速な失敗をオンにすると、GitHub は 1 つのジョブが失敗した時点で matrix を止め、素早いフィードバックを与えて分単位の時間を節約します。オフにすると、すべての組み合わせにわたる合否の全体像が得られます。
無効にすべき場合
- どの OS やバージョンが実際に失敗しているかをデバッグするとき。
- 1 つの失敗が決定的でない不安定な環境。
- 失敗があってもカバレッジの全結果が欲しいとき。
重要な理由
fail-fast は速度と網羅性のトレードオフです。オンのままにすると分単位の時間を節約でき、オフにすると環境固有の失敗を診断する際に matrix 全体を確認しやすくなります。
関連する概念
これは matrix の strategy の一部であり、失敗時の挙動を制御する continue-on-error を補完します。
重要なポイント
fail-fastは 1 つのセルが失敗すると兄弟ジョブをキャンセルします。- デフォルトは true で、完全な結果には false にします。
- オンは分単位の時間を節約し、オフはデバッグに役立ちます。
関連ガイド
What Is a Matrix Build in GitHub Actions?A matrix build runs the same job many times across combinations of variables, like multiple OS or language ve…
What Is continue-on-error in GitHub Actions?continue-on-error lets a failing step or job be treated as a non-blocking failure, so the workflow keeps goin…
What Is a Job in GitHub Actions?A job in GitHub Actions is a group of steps that runs on a single runner. Jobs run in parallel by default and…
What Are GitHub Actions Minutes?GitHub Actions minutes are the billing unit for GitHub-hosted runners: wall-clock job time, multiplied by an…