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