test+docs: API 키 안내 경로 단위 테스트 + ops 문서 #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Full | |
| # Tier 2 — master push 직후에만 도는 통합 회귀 게이트 (목표 ≤ 10분). | |
| # PR 단계에서는 돌지 않음 (ci-fast 만). master merge 후 regression 검증 책임. | |
| # realdata-suite path-filter matrix 는 본 파일에서만 실행 (PR 에서 제거). | |
| on: | |
| push: | |
| branches: [master] | |
| workflow_dispatch: {} | |
| concurrency: | |
| group: ci-full-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # 전체 Python 3.12 / 3.13 matrix + integration + requires_data (fixture 기반). | |
| # 이전 ci.yml 의 `test` job 과 동등. | |
| test-full: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest pytest-asyncio pytest-cov hypothesis pytest-benchmark pytest-xdist | |
| pip install -e .[all] | |
| # realData/heavy/freshInstall 제외 — 이들은 realdata-suite / ci-nightly 담당. | |
| - name: Run tests (pytest-xdist parallel) | |
| env: | |
| DARTLAB_DATA_DIR: ${{ github.workspace }}/tests/fixtures | |
| PYTEST_MEMORY_LIMIT_MB: "1900" | |
| DARTLAB_TEST_LOCKED: "1" | |
| run: | | |
| pytest tests/ -n 2 --dist loadfile --tb=short \ | |
| -m "not requires_data and not heavy and not realData and not freshInstall" \ | |
| --ignore=tests/test_fixture_analysis_real.py \ | |
| --ignore=tests/test_fixture_credit_real.py \ | |
| --ignore=tests/test_fixture_review_real.py \ | |
| --ignore=tests/realData \ | |
| --cov=dartlab --cov-report=term-missing --cov-report=html --cov-report=xml \ | |
| --cov-fail-under=40 --benchmark-disable | |
| - name: Upload coverage to Codecov | |
| if: matrix.python-version == '3.12' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: coverage.xml | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload coverage report | |
| if: matrix.python-version == '3.12' | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: coverage-report | |
| path: htmlcov/ | |
| # Fixture 기반 integration 테스트 — 큰 메모리 필요한 파일 격리 실행. | |
| fixture-integration: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest pytest-asyncio hypothesis pytest-benchmark | |
| pip install -e .[all] | |
| - name: Run fixture integration tests (high memory, sequential) | |
| env: | |
| DARTLAB_DATA_DIR: ${{ github.workspace }}/tests/fixtures | |
| PYTEST_MEMORY_LIMIT_MB: "5000" | |
| DARTLAB_TEST_LOCKED: "1" | |
| run: | | |
| for f in tests/test_fixture_analysis_real.py tests/test_fixture_credit_real.py tests/test_fixture_review_real.py; do | |
| echo "=== $f ===" | |
| pytest "$f" --tb=short -q --benchmark-disable -p no:cacheprovider || exit 1 | |
| done | |
| # Cross-OS smoke — Windows/macOS 경로·인코딩·라인엔딩 회귀. | |
| # PR 에서는 제거 (ubuntu 만으로도 대부분 커버), master 에서만 3 OS 검증. | |
| cross-os-smoke: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install minimal deps | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest pytest-asyncio hypothesis build pytest-cov pytest-benchmark | |
| pip install -e . | |
| # shell: bash — Windows 에서 기본 PowerShell 은 backslash 연속 미지원. | |
| # 단일 라인으로 써도 되지만 가독성 위해 bash 명시. Linux/macOS 도 bash 기본. | |
| - name: Run unit + bundle tests | |
| env: | |
| PYTHONIOENCODING: utf-8 | |
| DARTLAB_TEST_LOCKED: "1" | |
| shell: bash | |
| run: python -X utf8 -m pytest tests/test_bundledResources.py tests/test_wheelPackaging.py -m "unit and not heavy" --tb=short --no-cov --benchmark-disable | |
| - name: Silent-fail lint | |
| shell: bash | |
| run: python -X utf8 scripts/dev/checkSilentFail.py | |
| # realData 스위트 path-filter matrix — master push 에만 실행. | |
| # PR 에서는 돌지 않음 (ci-fast 책임은 smoke + unit 까지). | |
| realdata-plan: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tests: ${{ steps.plan.outputs.tests }} | |
| hasAny: ${{ steps.plan.outputs.hasAny }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Plan realData tests by path diff | |
| id: plan | |
| env: | |
| GITHUB_BASE_REF: ${{ github.event.pull_request.base.ref || '' }} | |
| run: | | |
| python -X utf8 .github/scripts/planRealdata.py > /tmp/tests.json | |
| echo "plan 결과:" | |
| cat /tmp/tests.json | |
| echo | |
| COUNT=$(python -c "import json; print(len(json.load(open('/tmp/tests.json'))))") | |
| echo "tests=$(cat /tmp/tests.json)" >> $GITHUB_OUTPUT | |
| if [ "$COUNT" -gt 0 ]; then | |
| echo "hasAny=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "hasAny=false" >> $GITHUB_OUTPUT | |
| fi | |
| realdata-suite: | |
| needs: realdata-plan | |
| if: ${{ needs.realdata-plan.outputs.hasAny == 'true' }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| test_file: ${{ fromJson(needs.realdata-plan.outputs.tests) }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| cache: "pip" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest pytest-asyncio pytest-rerunfailures hypothesis | |
| pip install -e .[all] | |
| - name: Run ${{ matrix.test_file }} | |
| env: | |
| DARTLAB_DATA_DIR: ${{ github.workspace }}/tests/fixtures | |
| PYTEST_MEMORY_LIMIT_MB: "6000" | |
| DARTLAB_TEST_LOCKED: "1" | |
| run: | | |
| bash scripts/dev/test-realdata.sh tests/realData/${{ matrix.test_file }} -v --tb=short |