|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test-core: |
| 11 | + name: Core Tests (No Optional Deps) |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v3 |
| 19 | + - name: Set up Python ${{ matrix.python-version }} |
| 20 | + uses: actions/setup-python@v4 |
| 21 | + with: |
| 22 | + python-version: ${{ matrix.python-version }} |
| 23 | + - name: Install core dependencies only |
| 24 | + run: | |
| 25 | + pip install uv |
| 26 | + uv sync --group dev |
| 27 | + - name: Run core tests |
| 28 | + run: | |
| 29 | + uv run pytest -m core -v |
| 30 | +
|
| 31 | + test-all: |
| 32 | + name: All Tests (With Optional Deps) |
| 33 | + needs: test-core |
| 34 | + runs-on: ubuntu-latest |
| 35 | + strategy: |
| 36 | + matrix: |
| 37 | + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] |
| 38 | + |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v3 |
| 41 | + - name: Set up Python ${{ matrix.python-version }} |
| 42 | + uses: actions/setup-python@v4 |
| 43 | + with: |
| 44 | + python-version: ${{ matrix.python-version }} |
| 45 | + - name: Install all dependencies |
| 46 | + run: | |
| 47 | + pip install uv |
| 48 | + uv sync --group dev --group typing --group examples |
| 49 | + - name: Run all tests |
| 50 | + run: | |
| 51 | + uv run pytest -v |
| 52 | +
|
| 53 | + coverage: |
| 54 | + name: Coverage Report |
| 55 | + runs-on: ubuntu-latest |
| 56 | + permissions: |
| 57 | + contents: write |
| 58 | + pull-requests: write |
| 59 | + |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v3 |
| 62 | + |
| 63 | + - name: Set up Python 3.12 |
| 64 | + uses: actions/setup-python@v4 |
| 65 | + with: |
| 66 | + python-version: "3.12" |
| 67 | + |
| 68 | + - name: Install dependencies |
| 69 | + run: | |
| 70 | + pip install uv |
| 71 | + uv sync --all-extras --all-groups |
| 72 | +
|
| 73 | + - name: Run tests with coverage |
| 74 | + run: | |
| 75 | + uv run coverage run -m pytest |
| 76 | + uv run coverage xml |
| 77 | + uv run coverage html |
| 78 | + uv run coverage report |
| 79 | +
|
| 80 | + - name: Coverage comment |
| 81 | + if: github.event_name == 'pull_request' |
| 82 | + uses: py-cov-action/python-coverage-comment-action@v3 |
| 83 | + with: |
| 84 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 85 | + MINIMUM_GREEN: 85 |
| 86 | + MINIMUM_ORANGE: 70 |
| 87 | + |
| 88 | + - name: Store coverage report |
| 89 | + uses: actions/upload-artifact@v4 |
| 90 | + with: |
| 91 | + name: coverage-report |
| 92 | + path: htmlcov/ |
0 commit comments