|
| 1 | +name: check |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + tags-ignore: ["**"] |
| 7 | + pull_request: |
| 8 | + schedule: |
| 9 | + - cron: "0 8 * * *" |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: check-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + test: |
| 17 | + name: test ${{ matrix.py }} - ${{ matrix.os }} |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + py: |
| 23 | + - "pypy3.10" # ahead to start it earlier because takes longer |
| 24 | + - "3.13" |
| 25 | + - "3.12" |
| 26 | + - "3.11" |
| 27 | + - "3.10" |
| 28 | + - "3.9" |
| 29 | + - "3.8" |
| 30 | + os: |
| 31 | + - ubuntu-latest |
| 32 | + - windows-latest |
| 33 | + - macos-latest |
| 34 | + |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + fetch-depth: 0 |
| 39 | + - name: Install the latest version of uv |
| 40 | + uses: astral-sh/setup-uv@v3 |
| 41 | + with: |
| 42 | + enable-cache: true |
| 43 | + cache-dependency-glob: "pyproject.toml" |
| 44 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + - name: Add .local/bin to Windows PATH |
| 46 | + if: runner.os == 'Windows' |
| 47 | + shell: bash |
| 48 | + run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH |
| 49 | + - name: Install tox |
| 50 | + run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv |
| 51 | + - name: Install Python |
| 52 | + run: uv python install --python-preference only-managed ${{ matrix.py }} |
| 53 | + - name: Setup test suite |
| 54 | + run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.py }} |
| 55 | + - name: Run test suite |
| 56 | + if: ${{ !startsWith(matrix.py, 'pypy')}} |
| 57 | + run: tox run --skip-pkg-install -e ${{ matrix.py }} |
| 58 | + env: |
| 59 | + PYTEST_ADDOPTS: "-vv --durations=20" |
| 60 | + DIFF_AGAINST: HEAD |
| 61 | + - name: Run test suite without coverage |
| 62 | + if: ${{ startsWith(matrix.py, 'pypy')}} |
| 63 | + run: tox run --skip-pkg-install -e ${{ matrix.py }} |
| 64 | + env: |
| 65 | + PYTEST_ADDOPTS: "-vv --durations=20" |
| 66 | + - name: Rename coverage report file |
| 67 | + if: ${{ !startsWith(matrix.py, 'pypy')}} |
| 68 | + run: | |
| 69 | + import os; import sys |
| 70 | + os.rename(f".tox/.coverage.${{ matrix.py }}", f".tox/.coverage.${{ matrix.py }}-{sys.platform}") |
| 71 | + shell: python |
| 72 | + - name: Upload coverage data |
| 73 | + if: ${{ !startsWith(matrix.py, 'pypy')}} |
| 74 | + uses: actions/upload-artifact@v4 |
| 75 | + with: |
| 76 | + include-hidden-files: true |
| 77 | + name: .coverage.${{ matrix.os }}.${{ matrix.py }} |
| 78 | + path: ".tox/.coverage.*" |
| 79 | + retention-days: 3 |
| 80 | + |
| 81 | + coverage: |
| 82 | + name: Combine coverage |
| 83 | + runs-on: ubuntu-latest |
| 84 | + needs: test |
| 85 | + steps: |
| 86 | + - uses: actions/checkout@v4 |
| 87 | + with: |
| 88 | + fetch-depth: 0 |
| 89 | + - name: Install the latest version of uv |
| 90 | + uses: astral-sh/setup-uv@v3 |
| 91 | + with: |
| 92 | + enable-cache: true |
| 93 | + cache-dependency-glob: "pyproject.toml" |
| 94 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 95 | + - name: Add .local/bin to Windows PATH |
| 96 | + if: runner.os == 'Windows' |
| 97 | + shell: bash |
| 98 | + run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH |
| 99 | + - name: install hatch |
| 100 | + run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv |
| 101 | + - name: Setup coverage tool |
| 102 | + run: tox -e coverage --notest |
| 103 | + - name: Download coverage data |
| 104 | + uses: actions/download-artifact@v4 |
| 105 | + with: |
| 106 | + path: .tox |
| 107 | + pattern: .coverage.* |
| 108 | + merge-multiple: true |
| 109 | + - name: Combine and report coverage |
| 110 | + run: tox -e coverage --skip-pkg-install |
| 111 | + - name: Upload HTML report |
| 112 | + uses: actions/upload-artifact@v4 |
| 113 | + with: |
| 114 | + name: html-report |
| 115 | + path: .tox/htmlcov |
| 116 | + |
| 117 | + check: |
| 118 | + name: ${{ matrix.tox_env }} - ${{ matrix.os }} |
| 119 | + runs-on: ${{ matrix.os }} |
| 120 | + strategy: |
| 121 | + fail-fast: false |
| 122 | + matrix: |
| 123 | + os: |
| 124 | + - ubuntu-latest |
| 125 | + - windows-latest |
| 126 | + tox_env: |
| 127 | + - dev |
| 128 | + - type |
| 129 | + - docs |
| 130 | + - readme |
| 131 | + exclude: |
| 132 | + - { os: windows-latest, tox_env: readme } |
| 133 | + steps: |
| 134 | + - uses: actions/checkout@v4 |
| 135 | + with: |
| 136 | + fetch-depth: 0 |
| 137 | + - name: Install the latest version of uv |
| 138 | + uses: astral-sh/setup-uv@v3 |
| 139 | + with: |
| 140 | + enable-cache: true |
| 141 | + cache-dependency-glob: "pyproject.toml" |
| 142 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 143 | + - name: Add .local/bin to Windows PATH |
| 144 | + if: runner.os == 'Windows' |
| 145 | + shell: bash |
| 146 | + run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH |
| 147 | + - name: Install tox |
| 148 | + run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv |
| 149 | + - name: Setup test suite |
| 150 | + run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.tox_env }} |
| 151 | + - name: Run test suite |
| 152 | + run: tox run --skip-pkg-install -e ${{ matrix.tox_env }} |
0 commit comments