|
8 | 8 | workflow_dispatch: |
9 | 9 |
|
10 | 10 | jobs: |
| 11 | + detect_changes: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + outputs: |
| 14 | + relevant: ${{ steps.filter.outputs.relevant }} |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v6 |
| 17 | + with: |
| 18 | + fetch-depth: 0 |
| 19 | + - id: filter |
| 20 | + uses: dorny/paths-filter@v3 |
| 21 | + with: |
| 22 | + filters: | |
| 23 | + relevant: |
| 24 | + - "commitizen/**" |
| 25 | + - "tests/**" |
| 26 | + - ".github/workflows/**" |
11 | 27 | python-check: |
| 28 | + needs: detect_changes |
12 | 29 | strategy: |
13 | 30 | matrix: |
14 | 31 | python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] |
15 | 32 | platform: [ubuntu-22.04, macos-latest, windows-latest] |
16 | 33 | runs-on: ${{ matrix.platform }} |
17 | 34 | steps: |
| 35 | + - name: No relevant changes, fast-path success |
| 36 | + if: ${{ needs.detect_changes.outputs.relevant != 'true' }} |
| 37 | + run: echo "No relevant file changes; skipping tests and linters." |
| 38 | + |
18 | 39 | - uses: actions/checkout@v6 |
| 40 | + if: ${{ needs.detect_changes.outputs.relevant == 'true' }} |
19 | 41 | with: |
20 | 42 | fetch-depth: 0 |
21 | 43 | - name: Set up Python ${{ matrix.python-version }} |
22 | 44 | uses: astral-sh/setup-uv@v7 |
| 45 | + if: ${{ needs.detect_changes.outputs.relevant == 'true' }} |
23 | 46 | with: |
24 | 47 | python-version: ${{ matrix.python-version }} |
25 | 48 | - name: Install dependencies |
| 49 | + if: ${{ needs.detect_changes.outputs.relevant == 'true' }} |
26 | 50 | run: | |
27 | 51 | uv --version |
28 | 52 | uv sync --frozen --group base --group test --group linters |
29 | 53 | - name: Run tests and linters |
| 54 | + if: ${{ needs.detect_changes.outputs.relevant == 'true' }} |
30 | 55 | run: | |
31 | 56 | git config --global user.email "action@github.com" |
32 | 57 | git config --global user.name "GitHub Action" |
33 | 58 | uv run --no-sync poe ci |
34 | 59 | shell: bash |
35 | 60 | - name: Upload coverage to Codecov |
36 | 61 | uses: codecov/codecov-action@v5 |
| 62 | + if: ${{ needs.detect_changes.outputs.relevant == 'true' }} |
37 | 63 | with: |
38 | 64 | token: ${{ secrets.CODECOV_TOKEN }} |
39 | 65 | - name: Upload test results to Codecov |
40 | 66 | uses: codecov/codecov-action@v5 |
41 | | - if: ${{ !cancelled() }} |
| 67 | + if: ${{ needs.detect_changes.outputs.relevant == 'true' && !cancelled() }} |
42 | 68 | with: |
43 | 69 | token: ${{ secrets.CODECOV_TOKEN }} |
44 | 70 | report_type: test_results |
0 commit comments