Interview Prep/CI/CD/GitHub Actions

What is the `needs` + `strategy.matrix` pattern for fan-out and fan-in?

AdvancedConceptGitHub Actions
Answer

A planning job computes a list (changed services, test shards) and outputs it as JSON; a matrix job fans out over fromJSON(...); a final gate job with needs: [matrix-job] fans in, so one required check represents all shards. The gate must use if: always() and fail explicitly if the matrix result is not success, otherwise a skipped matrix would show as green.

gate:
  needs: test
  if: always()
  runs-on: ubuntu-latest
  steps:
    - run: test "${{ needs.test.result }}" = "success"
All CI/CD questions

More on GitHub Actions