본문 바로가기
C.W.K.
Stream
Lesson 06 of 13 · published

아티팩트

~10 min · artifacts, upload, download

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

단일 워크플로 실행이 끝나도 남는 파일

아티팩트는 한 작업이 업로드하고, 같은 워크플로 실행 안에 있는 다른 작업이나 실행 UI에서 90일 동안 다운로드할 수 있는 파일이나 디렉토리야. 서로 다른 러너에서 돌아가는 작업들 사이에 데이터를 전달할 때 쓰는 방법이지.

주로 이렇게 활용해:

  • 테스트 리포트(JUnit XML, 커버리지 HTML).
  • 빌드 출력값(dist/, tar로 묶은 컨테이너 이미지).
  • 엔드투엔드 테스트 스크린샷.
  • 실패했을 때의 로그와 디버그 번들.

두 가지 액션

  • actions/upload-artifact@v4 — 작업이 끝날 때 업로드.
  • actions/download-artifact@v4 — 다른 작업이 시작할 때 다운로드(같은 실행에 한함).

v4는 v3보다 훨씬 빨라(저장 백엔드가 다르거든). 그리고 이름 짓는 규칙도 바뀌었어. 한 번의 실행 안에서 아티팩트 이름은 고유해야 해. 매트릭스를 쓴다면 이름에 매트릭스 차원을 포함시켜.

Code

업로드 + 매트릭스 인식 이름 짓기 + 다운로드·yaml
jobs:
  test:
    strategy:
      matrix:
        python: ['3.10', '3.11', '3.12']
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: pytest --junitxml=report.xml
      - if: always()
        uses: actions/upload-artifact@v4
        with:
          # name unique per matrix cell
          name: pytest-report-py${{ matrix.python }}
          path: report.xml
          retention-days: 14

  publish-report:
    needs: test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@v4
        with:
          # download every artifact whose name starts with pytest-report-
          pattern: pytest-report-*
          merge-multiple: true
      - run: ls -lah

External links

Exercise

테스트가 돌아가는 워크플로를 하나 골라봐. JUnit XML이나 커버리지 HTML을 if: always()와 함께 아티팩트로 업로드해. 실패한 실행에서 다운로드할 수 있는지 확인해봐.

Progress

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

댓글 0

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

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