|
| 1 | +--- |
1 | 2 | name: check
|
2 |
| - |
3 | 3 | on:
|
4 | 4 | push:
|
5 |
| - branches: |
6 |
| - - main |
| 5 | + branches: [main] |
7 | 6 | pull_request:
|
8 |
| - branches: |
9 |
| - - main |
10 |
| - schedule: |
11 |
| - - cron: "0 0 * * 0" |
12 |
| - |
| 7 | + branches: [main] |
| 8 | +env: |
| 9 | + latest-python-version: 3.13 |
13 | 10 | jobs:
|
14 |
| - lint: |
15 |
| - uses: ./.github/workflows/.hatch-run.yml |
16 |
| - with: |
17 |
| - job-name: "python-{0}" |
18 |
| - hatch-run: "lint:all" |
19 |
| - test-matrix: |
20 |
| - uses: ./.github/workflows/.hatch-run.yml |
21 |
| - with: |
22 |
| - job-name: "python-{0} {1}" |
23 |
| - hatch-run: "test" |
24 |
| - runs-on-array: '["ubuntu-latest", "macos-latest", "windows-latest"]' |
25 |
| - python-version-array: '["3.9", "3.10", "3.11"]' |
| 11 | + py-tests: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + python-version: ['3.10', '3.11', '3.12', '3.13'] |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + - name: UV cache |
| 19 | + uses: actions/cache@v4 |
| 20 | + with: |
| 21 | + path: ~/.cache/uv |
| 22 | + key: ${{ runner.os }}-${{ matrix.python-version }}-uv-${{ hashFiles('pyproject.toml') }} |
| 23 | + - name: Install UV |
| 24 | + uses: astral-sh/setup-uv@v5 |
| 25 | + with: |
| 26 | + version: latest |
| 27 | + python-version: ${{ matrix.python-version }} |
| 28 | + enable-cache: true |
| 29 | + cache-dependency-glob: '**/pyproject.toml' |
| 30 | + - name: Run tests |
| 31 | + run: uv run dev.py cov |
| 32 | + - name: Upload coverage |
| 33 | + if: matrix.python-version == env.latest-python-version |
| 34 | + uses: actions/upload-artifact@v4 |
| 35 | + with: |
| 36 | + name: coverage-xml |
| 37 | + include-hidden-files: true |
| 38 | + path: | |
| 39 | + ${{ github.workspace }}/coverage.xml |
| 40 | + ${{ github.workspace }}/.coverage |
| 41 | + if-no-files-found: error |
| 42 | + py-coverage: |
| 43 | + runs-on: ubuntu-latest |
| 44 | + needs: py-tests |
| 45 | + if: github.ref != format('refs/heads/{0}', github.event.repository.default_branch) |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + with: {fetch-depth: 50} |
| 49 | + - name: Download new coverage |
| 50 | + uses: actions/download-artifact@v4 |
| 51 | + with: |
| 52 | + name: coverage-xml |
| 53 | + path: ${{ github.workspace }} |
| 54 | + - name: Download old coverage |
| 55 | + uses: dawidd6/action-download-artifact@v6 |
| 56 | + with: |
| 57 | + branch: ${{ github.event.pull_request.base.ref }} |
| 58 | + name: coverage-xml |
| 59 | + path: ${{ github.workspace }}/old-coverage |
| 60 | + - name: UV cache |
| 61 | + uses: actions/cache@v4 |
| 62 | + with: |
| 63 | + path: ~/.cache/uv |
| 64 | + key: ${{ runner.os }}-${{ env.latest-python-version }}-uv-${{ hashFiles('pyproject.toml') }} |
| 65 | + - run: git fetch origin main |
| 66 | + - name: Install UV |
| 67 | + run: curl -LsSf https://astral.sh/uv/install.sh | sh |
| 68 | + - name: Install Python |
| 69 | + run: uv python install ${{ matrix.python-version }} |
| 70 | + - name: Check coverage |
| 71 | + run: uv run dev.py cov --no-test --old-coverage-xml=${{ github.workspace }}/old-coverage/coverage.xml |
| 72 | + - name: Coverage summary |
| 73 | + run: uv run coverage report --format=markdown >> $GITHUB_STEP_SUMMARY |
| 74 | + py-lint: |
| 75 | + runs-on: ubuntu-latest |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v4 |
| 78 | + - name: UV cache |
| 79 | + uses: actions/cache@v4 |
| 80 | + with: |
| 81 | + path: ~/.cache/uv |
| 82 | + key: ${{ runner.os }}-${{ env.latest-python-version }}-uv-${{ hashFiles('pyproject.toml') }} |
| 83 | + - name: Install UV |
| 84 | + run: curl -LsSf https://astral.sh/uv/install.sh | sh |
| 85 | + - name: Install Python |
| 86 | + run: uv python install ${{ matrix.python-version }} |
| 87 | + - name: Check lint |
| 88 | + run: uv run dev.py lint --check |
| 89 | + py-build: |
| 90 | + runs-on: ubuntu-latest |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v4 |
| 93 | + - name: UV cache |
| 94 | + uses: actions/cache@v4 |
| 95 | + with: |
| 96 | + path: ~/.cache/uv |
| 97 | + key: ${{ runner.os }}-${{ env.latest-python-version }}-uv-${{ hashFiles('pyproject.toml') }} |
| 98 | + - name: Install UV |
| 99 | + run: curl -LsSf https://astral.sh/uv/install.sh | sh |
| 100 | + - name: Install Python |
| 101 | + run: uv python install ${{ matrix.python-version }} |
| 102 | + - name: Check lint |
| 103 | + run: uv build |
0 commit comments