|
65 | 65 | - run: .ci/scripts/check_lockfile.py
|
66 | 66 |
|
67 | 67 | lint:
|
68 |
| - uses: "matrix-org/backend-meta/.github/workflows/python-poetry-ci.yml@v2" |
69 |
| - with: |
70 |
| - typechecking-extras: "all" |
| 68 | + runs-on: ubuntu-latest |
| 69 | + steps: |
| 70 | + - name: Checkout repository |
| 71 | + uses: actions/checkout@v3 |
| 72 | + |
| 73 | + - name: Setup Poetry |
| 74 | + uses: matrix-org/setup-python-poetry@v1 |
| 75 | + with: |
| 76 | + install-project: "false" |
| 77 | + |
| 78 | + - name: Import order (isort) |
| 79 | + run: poetry run isort --check --diff . |
| 80 | + |
| 81 | + - name: Code style (black) |
| 82 | + run: poetry run black --check --diff . |
| 83 | + |
| 84 | + - name: Semantic checks (ruff) |
| 85 | + # --quiet suppresses the update check. |
| 86 | + run: poetry run ruff --quiet . |
| 87 | + |
| 88 | + lint-mypy: |
| 89 | + runs-on: ubuntu-latest |
| 90 | + name: Typechecking |
| 91 | + steps: |
| 92 | + - name: Checkout repository |
| 93 | + uses: actions/checkout@v3 |
| 94 | + |
| 95 | + - name: Setup Poetry |
| 96 | + uses: matrix-org/setup-python-poetry@v1 |
| 97 | + with: |
| 98 | + # We want to make use of type hints in optional dependencies too. |
| 99 | + extras: all |
| 100 | + # We have seen odd mypy failures that were resolved when we started |
| 101 | + # installing the project again: |
| 102 | + # https://github.com/matrix-org/synapse/pull/15376#issuecomment-1498983775 |
| 103 | + # To make CI green, err towards caution and install the project. |
| 104 | + install-project: "true" |
| 105 | + |
| 106 | + - name: Install Rust |
| 107 | + |
| 108 | + - uses: Swatinem/rust-cache@v2 |
| 109 | + |
| 110 | + # NB: I have two concerns with this action: |
| 111 | + # 1. We occasionally see odd mypy problems that aren't reproducible |
| 112 | + # locally with clean caches. I suspect some dodgy caching behaviour. |
| 113 | + # 2. The action uses GHA machinery that's deprecated |
| 114 | + # (https://github.com/AustinScola/mypy-cache-github-action/issues/277) |
| 115 | + # It may be simpler to use actions/cache ourselves to restore .mypy_cache. |
| 116 | + - name: Restore/persist mypy's cache |
| 117 | + uses: AustinScola/mypy-cache-github-action@df56268388422ee282636ee2c7a9cc55ec644a41 |
| 118 | + |
| 119 | + - name: Run mypy |
| 120 | + run: poetry run mypy |
71 | 121 |
|
72 | 122 | lint-crlf:
|
73 | 123 | runs-on: ubuntu-latest
|
@@ -165,6 +215,7 @@ jobs:
|
165 | 215 | if: ${{ !cancelled() }} # Run this even if prior jobs were skipped
|
166 | 216 | needs:
|
167 | 217 | - lint
|
| 218 | + - lint-mypy |
168 | 219 | - lint-crlf
|
169 | 220 | - lint-newsfile
|
170 | 221 | - lint-pydantic
|
|
0 commit comments