C.W.K.
Stream
Lesson 04 of 13 · published

Matrix 전략 심화

~14 min · matrix, include, exclude

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

Matrix 는 Cartesian 곱 그 이상

Matrix 는 나열된 차원의 모든 조합을 확장하지만, 보통 전체 곱을 돌리는 게 아니라 결과를 모양짓기 원해. 세 가지 제어:

  • include: — Cartesian 곱 위에 특정 cell (추가 필드 포함) 추가.
  • exclude: — Cartesian 곱에서 특정 cell 제거.
  • fail-fast: false — 하나 실패해도 모든 cell 계속 실행 (기본은 true).

자주 쓸 패턴

  • flag 와 함께 실험 cell 추가. 3.10-3.12 외에 continue-on-error: true 로 Python 3.13 — PR 안 막아.
  • 해당 안 되는 조합 skip. Postgres 16 + Python 3.10 은 driver 가 지원 안 할 수 있음 — exclude.
  • Cell 별 extra config 주입. 다른 DB connection string, 다른 timeout, 다른 test marker.
  • Dynamic matrix. 이전 job 의 jobs.outputs 에서 matrix 생성 (reuse track 에서 다룸).

fail-fast tradeoff

fail-fast: true (기본) 는 cell 하나 실패 즉시 나머지 cell 취소. 분 절약; 정보 손실. fail-fast: false 는 모든 거 완료까지 돔. PR 엔 true (빠른 feedback), main 엔 false (full visibility).

Code

Include / exclude / continue-on-error·yaml
jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
        python: ['3.10', '3.11', '3.12']
        exclude:
          # Skip macOS x 3.10 (slow + low value)
          - os: macos-latest
            python: '3.10'
        include:
          # Try the bleeding-edge cell, but don't fail the matrix on it
          - os: ubuntu-latest
            python: '3.13-dev'
            experimental: true
    continue-on-error: ${{ matrix.experimental == true }}
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with: { python-version: '${{ matrix.python }}' }
      - run: pip install -e . && pytest -q

External links

Exercise

기존 matrix 가져와. Runtime 의 다음 메이저 버전을 continue-on-error: true 인 실험 cell 로 추가. 일주일 후 결정: 유지 (버전 졸업) 또는 삭제 (rollback).

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.