Skip to content

build: examples extras 통합 — 예제 01~03 일괄 설치 지원 #10

build: examples extras 통합 — 예제 01~03 일괄 설치 지원

build: examples extras 통합 — 예제 01~03 일괄 설치 지원 #10

Workflow file for this run

name: CI
# 트리거: PR / main 푸시 — test 계열만 (wheel 빌드 + 배포는 publish.yml)
# 문서·라이선스·gitignore 전용 변경은 paths-ignore 로 스킵 (런타임·빌드 영향 없음)
on:
push:
branches: [main]
paths-ignore:
- '**.md'
- 'docs/**'
- 'LICENSE*'
- '.gitignore'
pull_request:
branches: [main]
paths-ignore:
- '**.md'
- 'docs/**'
- 'LICENSE*'
- '.gitignore'
workflow_dispatch: {}
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# * 메인 테스트 + 린트 + 타입체크
# abi3-py39 wheel 로 빌드는 한 번이지만 런타임 동작은 버전별 검증 필요 → Linux × 전 버전.
# macOS / Windows 는 OS 레이어 스모크이므로 py3.12 하나만.
test:
name: Test (${{ matrix.os }} / py${{ matrix.python }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, python: "3.9", lint: true }
- { os: ubuntu-latest, python: "3.10" }
- { os: ubuntu-latest, python: "3.11" }
- { os: ubuntu-latest, python: "3.12" }
- { os: ubuntu-latest, python: "3.13" }
- { os: macos-latest, python: "3.12" }
- { os: windows-latest, python: "3.12" }
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: astral-sh/setup-uv@v8.1.0
with:
python-version: ${{ matrix.python }}
- run: uv sync --no-install-project --group all
- run: uv run maturin develop --release
- name: Run pytest (not slow) with coverage
run: uv run pytest tests/ -m "not slow" --cov=rhwp --cov-report=term-missing -v
- name: Run pyright (normal)
if: matrix.lint
run: |
uv run pyright python/ \
tests/test_smoke.py tests/test_parse.py tests/test_text_extraction.py \
tests/test_errors.py tests/test_svg_rendering.py tests/test_pdf_rendering.py \
tests/test_langchain_loader.py tests/conftest.py tests/type_check_samples.py
- name: Run pyright (intentional errors — expect 4)
if: matrix.lint
run: |
set +e
uv run pyright --outputjson tests/type_check_errors.py > pyright-errors.json
count=$(uv run python -c "import json; print(json.load(open('pyright-errors.json'))['summary']['errorCount'])")
echo "intentional error count: $count"
if [ "$count" != "4" ]; then
echo "::error::expected 4 intentional errors, got $count"
exit 1
fi
# * PDF 렌더링 — 느려서 별도 잡
test-slow:
name: Test slow (Linux / py3.12 — PDF)
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: astral-sh/setup-uv@v8.1.0
with:
python-version: "3.12"
- run: uv sync --no-install-project --group testing
- run: uv run maturin develop --release
- run: uv run pytest tests/ -m slow -v
# * extras 미설치 시 langchain 테스트가 importorskip 로 auto-skip 되는지 검증
test-core-only:
name: Test without extras (importorskip auto-skip)
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: astral-sh/setup-uv@v8.1.0
with:
python-version: "3.12"
- name: Install pytest only (no langchain extras — intentional)
run: |
uv venv
uv pip install pytest
- run: uv run maturin develop --release
- name: Run pytest — langchain tests must auto-skip via importorskip
# ^ 파일-레벨 importorskip 은 해당 파일 전체를 skip 1개로 카운트
run: |
uv run pytest tests/ -m "not slow" -v | tee pytest-output.txt
if ! grep -qE '(^|[^0-9])1 skipped([^0-9]|$)' pytest-output.txt; then
echo "::error::expected test_langchain_loader.py to auto-skip via importorskip"
exit 1
fi