|
| 1 | +name: Run Checks |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "main" ] |
| 8 | + merge_group: |
| 9 | + |
| 10 | +jobs: |
| 11 | + test: |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + python: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ] |
| 15 | + os: [ ubuntu-latest, macos-latest, windows-latest ] |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4.2.2 |
| 19 | + - name: Set up Python |
| 20 | + uses: actions/setup-python@v5.3.0 |
| 21 | + with: |
| 22 | + python-version: ${{ matrix.python }} |
| 23 | + |
| 24 | + - name: Get Python Version |
| 25 | + id: get_python_version |
| 26 | + run: echo "python_version=$(python --version)" >> $GITHUB_OUTPUT |
| 27 | + shell: bash |
| 28 | + |
| 29 | + - name: Cache dependencies |
| 30 | + uses: actions/cache@v4 |
| 31 | + with: |
| 32 | + path: .venv |
| 33 | + key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/pdm.lock') }} |
| 34 | + restore-keys: | |
| 35 | + ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies |
| 36 | + - name: Install PDM |
| 37 | + run: pip install pdm |
| 38 | + |
| 39 | + - name: Install Dependencies |
| 40 | + run: pdm install |
| 41 | + |
| 42 | + - name: Check formatting |
| 43 | + run: pdm run ruff format . --check |
| 44 | + |
| 45 | + - name: Run mypy |
| 46 | + run: pdm mypy --show-error-codes |
| 47 | + |
| 48 | + - name: Lint |
| 49 | + run: pdm run ruff check . |
| 50 | + |
| 51 | + - name: Run pytest without coverage |
| 52 | + if: matrix.os != 'ubuntu-latest' |
| 53 | + run: pdm test |
| 54 | + env: |
| 55 | + TASKIPY: true |
| 56 | + |
| 57 | + - name: Run pytest with coverage |
| 58 | + if: matrix.os == 'ubuntu-latest' |
| 59 | + run: pdm test_with_coverage |
| 60 | + env: |
| 61 | + TASKIPY: true |
| 62 | + |
| 63 | + - run: mv .coverage .coverage.${{ matrix.python }} |
| 64 | + if: matrix.os == 'ubuntu-latest' |
| 65 | + |
| 66 | + - name: Store coverage report |
| 67 | + uses: actions/upload-artifact@v4.4.3 |
| 68 | + if: matrix.os == 'ubuntu-latest' |
| 69 | + with: |
| 70 | + name: coverage-${{ matrix.python }} |
| 71 | + path: .coverage.${{ matrix.python }} |
| 72 | + if-no-files-found: error |
| 73 | + include-hidden-files: true |
0 commit comments