본문으로 건너뛰기

8.1 CI pipeline과 artifact

CI는 package와 browser 설치, application 시작, test, report, trace 보존 단계로 구성합니다.

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- run: npm ci
- run: npx playwright install --with-deps chromium
- run: npx playwright test --project=chromium
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 14

Action major version과 Node version은 조직 정책과 공식 지원 범위를 확인해 pin합니다. npm ci와 lockfile로 test runner version을 재현합니다.

CI 운영 지표

  • Queue와 실행 시간
  • Test, project별 failure rate
  • Retry 통과와 flaky rate
  • Artifact size
  • Worker resource와 OOM
  • Shard imbalance

PR gate는 빠른 핵심 suite, merge 후 전체 browser, nightly long-running scenario로 나눌 수 있습니다. 실패 artifact는 항상 업로드하되 secret과 개인정보 보관 정책을 적용합니다.

참고: Continuous Integration, Best Practices

CI의 install, test, report, artifact 단계 재현 캡처

재현 가능한 CI

  • Lockfile 기반 npm ci
  • Project package와 맞는 Playwright browser
  • Pinned runner/container image 정책
  • Explicit locale/timezone/font
  • Local에서 그대로 실행할 수 있는 test command
  • Failure에도 실행되는 artifact upload

Worker 선택

공식 guide는 안정성과 재현성을 위해 CI에서 worker 1을 시작점으로 권장합니다. Self-hosted resource와 data isolation이 확인되면 worker를 늘리고, 더 넓은 병렬화는 shard로 분리합니다.

Cache 주의

Browser binary cache가 download를 줄일 수 있지만 version mismatch와 corruption 진단 비용이 생깁니다. node_modules 대신 package manager cache를 쓰고 install correctness를 우선합니다.

실습

  1. Clean runner에서 install부터 실행합니다.
  2. forbidOnly가 CI에서 accidental test.only를 막는지 확인합니다.
  3. Test failure에도 report가 업로드되는지 확인합니다.
  4. PR과 nightly command의 차이를 문서화합니다.