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

다중 버전 테스트

~11 min · matrix, versions, compatibility

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

지원하는 버전에 대해 테스트

README 에 'Python 3.10-3.12 지원' 이라 적혀 있으면, CI 가 매 PR 에 그걸 증명해야 해. 그 없이 그 지원 주장은 발견되기를 기다리는 거짓말이야.

기본 패턴: 지원하는 차원에 대한 matrix. 차원 예:

  • 언어 버전 (Python 3.10, 3.11, 3.12, 3.13).
  • OS (ubuntu-latest, macos-latest, windows-latest).
  • Database driver (postgres 14, 15, 16).
  • Framework 버전 (Django 4.2, 5.0).

각 matrix cell 은 자기 job, 병렬로 돌고 자기 log 가짐. UI 의 job 이름은 template 기반 (예: test (python-3.12, ubuntu-latest)).

비용 discipline

Naive 4×3 matrix 는 PR 당 12 run. 비용 급증. 타협 두 개:

  • main 엔 full matrix, PR 엔 smoke matrix. PR 은 Linux 의 최저 + 최고 버전만. Main 이 full matrix.
  • Linux 실패 시 느린 OS 취소. Job level fail-fast: true 로 첫 실패 시 전체 matrix 중단.

Code

Python × OS matrix + smoke vs full 전략·yaml
jobs:
  test:
    name: test (py${{ matrix.python }}, ${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: true
      matrix:
        python: ['3.10', '3.11', '3.12']
        os: [ubuntu-latest]
        include:
          # Add macOS only on push to main
          - python: '3.12'
            os: macos-latest
          - python: '3.12'
            os: windows-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with: { python-version: '${{ matrix.python }}' }
      - run: pip install -e '.[dev]' && pytest -q

External links

Exercise

프로젝트가 실제로 지원한다고 주장하는 언어 버전 범위 골라 (README + pyproject/package.json 확인). 모든 버전 test 하는 matrix 추가. Cell 하나라도 fail 하면 결정: 코드 수정 또는 지원 주장 업데이트.

Progress

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

댓글 0

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

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