|
1 | 1 | name: Build |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: |
6 | | - - master |
7 | | - pull_request: |
8 | | - branches: |
9 | | - - master |
10 | | - |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
11 | 10 | env: |
12 | | - MAIN_PYTHON_VERSION: "3.12" |
| 11 | + MAIN_PYTHON_VERSION: "3.12" |
| 12 | + |
| 13 | +concurrency: |
| 14 | + # Cancel previous workflow run when a new commit is pushed to a feature branch |
| 15 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 16 | + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} |
13 | 17 |
|
14 | 18 | jobs: |
15 | | - test: |
16 | | - name: "${{ matrix.os }}: ${{ matrix.python-version }}" |
17 | | - runs-on: ${{ matrix.os }} |
18 | | - strategy: |
19 | | - fail-fast: false |
20 | | - matrix: |
21 | | - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] |
22 | | - os: [ubuntu-24.04, windows-latest] |
| 19 | + changed-files: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + name: Get changed files |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v5 |
| 24 | + |
| 25 | + - name: Get changed python files |
| 26 | + id: raw-changed-python-files |
| 27 | + uses: tj-actions/changed-files@v46 |
| 28 | + with: |
| 29 | + files: | |
| 30 | + **.py |
| 31 | + uv.lock |
| 32 | +
|
| 33 | + test: |
| 34 | + name: "${{ matrix.os }}: ${{ matrix.python-version }}" |
| 35 | + runs-on: ${{ matrix.os }} |
| 36 | + strategy: |
| 37 | + fail-fast: false |
| 38 | + matrix: |
| 39 | + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] |
| 40 | + os: [ubuntu-24.04, windows-latest] |
23 | 41 |
|
24 | | - steps: |
25 | | - - uses: actions/checkout@v5 |
26 | | - - name: Set up Python ${{ matrix.python-version }} |
27 | | - uses: actions/setup-python@v5 |
28 | | - with: |
29 | | - python-version: ${{ matrix.python-version }} |
30 | | - - name: Install dependencies |
31 | | - run: | |
32 | | - python -m pip install --upgrade pip |
33 | | - pip install .[dev] |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v5 |
| 44 | + - name: Install uv and set the Python version |
| 45 | + uses: astral-sh/setup-uv@v6 |
| 46 | + with: |
| 47 | + python-version: ${{ matrix.python-version }} |
| 48 | + enable-cache: true |
| 49 | + - name: Install dependencies |
| 50 | + run: | |
| 51 | + uv sync --frozen --all-extras --dev |
| 52 | + - name: Run tests with coverage |
| 53 | + run: | |
| 54 | + uv run poe test-with-coverage -v |
| 55 | + - name: Upload coverage reports |
| 56 | + if: matrix.os == 'ubuntu-24.04' && matrix.python-version == env.MAIN_PYTHON_VERSION |
| 57 | + uses: actions/upload-artifact@v4 |
| 58 | + with: |
| 59 | + name: coverage-${{ github.run_id }} |
| 60 | + path: reports |
| 61 | + retention-days: 30 |
34 | 62 |
|
35 | | - - name: Run tests |
36 | | - run: | |
37 | | - pytest -v |
38 | | - style: |
39 | | - name: Style |
40 | | - runs-on: ubuntu-latest |
41 | | - steps: |
42 | | - - uses: actions/checkout@v5 |
43 | | - - name: Set up Python ${{ env.MAIN_PYTHON_VERSION }} |
44 | | - uses: actions/setup-python@v5 |
45 | | - with: |
46 | | - python-version: ${{ env.MAIN_PYTHON_VERSION }} |
47 | | - - name: Install dependencies |
48 | | - run: | |
49 | | - python -m pip install --upgrade pip |
50 | | - pip install .[dev] |
51 | | - - name: Check style with Ruff |
52 | | - run: | |
53 | | - ruff check --output-format=github . |
54 | | - - name: Check format with Ruff |
55 | | - run: | |
56 | | - ruff format --check . |
| 63 | + style: |
| 64 | + name: Style |
| 65 | + runs-on: ubuntu-latest |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v5 |
| 68 | + - name: Install uv and set the Python version |
| 69 | + uses: astral-sh/setup-uv@v6 |
| 70 | + with: |
| 71 | + python-version: ${{ env.MAIN_PYTHON_VERSION }} |
| 72 | + enable-cache: true |
| 73 | + - name: Install dependencies |
| 74 | + run: | |
| 75 | + uv sync --frozen --group dev |
| 76 | + - name: Check style with Ruff |
| 77 | + run: | |
| 78 | + uv run ruff check --output-format=github |
| 79 | + - name: Check format with Ruff |
| 80 | + run: | |
| 81 | + uv run ruff format --check |
0 commit comments