|
| 1 | +# Linting, formatting, type checks |
| 2 | +name: Linting |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + - release |
| 9 | + tags: |
| 10 | + - "*" |
| 11 | + pull_request: { } |
| 12 | + |
| 13 | +jobs: |
| 14 | + linting: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + name: Linting |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v6 |
| 19 | + with: |
| 20 | + submodules: 'recursive' |
| 21 | + - name: Set up Python 3.11 |
| 22 | + uses: actions/setup-python@v6 |
| 23 | + with: |
| 24 | + python-version: "3.11" |
| 25 | + - name: Install dependencies |
| 26 | + run: | |
| 27 | + python -m pip install --upgrade pip |
| 28 | + pip install -r requirements.txt |
| 29 | + - name: Lint with ruff |
| 30 | + run: ruff check --output-format=github . |
| 31 | + |
| 32 | + code-formatting: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + name: Code Format |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v6 |
| 37 | + with: |
| 38 | + submodules: 'recursive' |
| 39 | + - name: Set up Python 3.11 |
| 40 | + uses: actions/setup-python@v6 |
| 41 | + with: |
| 42 | + python-version: "3.11" |
| 43 | + - name: Install dependencies |
| 44 | + run: | |
| 45 | + python -m pip install --upgrade pip setuptools |
| 46 | + pip install -r requirements.txt |
| 47 | + - name: Check with ruff |
| 48 | + run: ruff format --check . |
| 49 | + |
| 50 | + typechecks: |
| 51 | + runs-on: ubuntu-latest |
| 52 | + name: Type Checks |
| 53 | + strategy: |
| 54 | + fail-fast: false |
| 55 | + matrix: |
| 56 | + python-version: [ "3.11", "3.12", "3.13" ] |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v6 |
| 59 | + with: |
| 60 | + submodules: 'recursive' |
| 61 | + - name: Set up Python ${{ matrix.python-version }} |
| 62 | + uses: actions/setup-python@v6 |
| 63 | + with: |
| 64 | + python-version: ${{ matrix.python-version }} |
| 65 | + - name: Install dependencies |
| 66 | + run: | |
| 67 | + python -m pip install --upgrade pip setuptools |
| 68 | + pip install -r requirements.txt |
| 69 | + - name: Run type checks |
| 70 | + run: | |
| 71 | + mypy --config-file pyproject.toml --junit-xml mypy-${{ matrix.python-version }}.xml . |
| 72 | + - name: Upload Unit Test Results |
| 73 | + if: always() |
| 74 | + uses: actions/upload-artifact@v5 |
| 75 | + with: |
| 76 | + name: MyPy Test Results (Python ${{ matrix.python-version }}) |
| 77 | + path: mypy-${{ matrix.python-version }}.xml |
| 78 | + |
| 79 | + test-event-file: |
| 80 | + name: "Publish Test Results Event File" |
| 81 | + runs-on: ubuntu-latest |
| 82 | + steps: |
| 83 | + - name: Upload |
| 84 | + uses: actions/upload-artifact@v5 |
| 85 | + with: |
| 86 | + name: Event File |
| 87 | + path: ${{ github.event_path }} |
0 commit comments