C.W.K.
Stream
Lesson 09 of 12 · published

첫 번째 진짜 workflow

~14 min · walkthrough, starter, python

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

0 에서 green Python CI 까지

이 lesson 은 실제로 유지할 만한 완전한 첫 workflow 를 만들어. 프로젝트는 pytest + ruff 인 작은 Python 패키지. 목표는 PR 과 main 에서 lint, type-check, test.

Repo 레이아웃

  • pyproject.toml — Python 버전 + ruff + pytest + mypy pin.
  • src/mypkg/
  • tests/
  • .github/workflows/ci.yml — 쓸 거.

Workflow 가 하는 일

  1. PR + main push + 수동 dispatch 시 trigger.
  2. 단일 job quality-checks, ubuntu-latest.
  3. Checkout, Python 3.12 setup, cache 와 함께 deps 설치, lint, type-check, test.
  4. 같은 PR 의 in-progress run 취소.

아래 workflow 를 한 문서처럼 읽어. 보면: 모든 줄이 자리를 벌어. 장식 없음.

Code

.github/workflows/ci.yml — 전체·yaml
name: ci
run-name: ci on ${{ github.actor }} / ${{ github.head_ref || github.ref_name }}

on:
  pull_request: {}
  push:
    branches: [main]
  workflow_dispatch: {}

permissions: read-all

concurrency:
  group: ci-${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  quality-checks:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.12'
          cache: pip

      - name: Install
        run: |
          python -m pip install --upgrade pip
          pip install -e '.[dev]'

      - name: Lint
        run: ruff check .

      - name: Format check
        run: ruff format --check .

      - name: Type check
        run: mypy src

      - name: Test
        run: pytest -q --cov=src --cov-report=term-missing

External links

Exercise

이 workflow 를 아빠 Python repo 에 넣고, install / test 명령을 프로젝트에 맞게 조정, push. Actions tab 에서 run 봐. Red 면 fix 는 workflow 가 아니라 프로젝트 쪽에 있어 — 그게 핵심.

Progress

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

댓글 0

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

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