This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Attempt to fix weird mypy failures on ignored files #15409
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,9 +65,59 @@ jobs: | |
- run: .ci/scripts/check_lockfile.py | ||
|
||
lint: | ||
uses: "matrix-org/backend-meta/.github/workflows/python-poetry-ci.yml@v2" | ||
with: | ||
typechecking-extras: "all" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Poetry | ||
uses: matrix-org/setup-python-poetry@v1 | ||
with: | ||
install-project: "false" | ||
|
||
- name: Import order (isort) | ||
run: poetry run isort --check --diff . | ||
|
||
- name: Code style (black) | ||
run: poetry run black --check --diff . | ||
|
||
- name: Semantic checks (ruff) | ||
# --quiet suppresses the update check. | ||
run: poetry run ruff --quiet . | ||
|
||
lint-mypy: | ||
runs-on: ubuntu-latest | ||
name: Typechecking | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Poetry | ||
uses: matrix-org/setup-python-poetry@v1 | ||
with: | ||
# We want to make use of type hints in optional dependencies too. | ||
extras: all | ||
# We have seen odd mypy failures that were resolved when we started | ||
# installing the project again: | ||
# https://github.com/matrix-org/synapse/pull/15376#issuecomment-1498983775 | ||
# To make CI green, err towards caution and install the project. | ||
install-project: "true" | ||
|
||
- name: Install Rust | ||
uses: dtolnay/[email protected] | ||
- uses: Swatinem/rust-cache@v2 | ||
|
||
# NB: I have two concerns with this action: | ||
# 1. We occasionally see odd mypy problems that aren't reproducible | ||
# locally with clean caches. I suspect some dodgy caching behaviour. | ||
# 2. The action uses GHA machinery that's deprecated | ||
# (https://github.com/AustinScola/mypy-cache-github-action/issues/277) | ||
# It may be simpler to use actions/cache ourselves to restore .mypy_cache. | ||
- name: Restore/persist mypy's cache | ||
uses: AustinScola/mypy-cache-github-action@df56268388422ee282636ee2c7a9cc55ec644a41 | ||
|
||
- name: Run mypy | ||
run: poetry run mypy | ||
|
||
lint-crlf: | ||
runs-on: ubuntu-latest | ||
|
@@ -165,6 +215,7 @@ jobs: | |
if: ${{ !cancelled() }} # Run this even if prior jobs were skipped | ||
needs: | ||
- lint | ||
- lint-mypy | ||
- lint-crlf | ||
- lint-newsfile | ||
- lint-pydantic | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes here are ripped from https://github.com/matrix-org/backend-meta/blob/5f4b6ba12a2c87d9b743f2f8fe261d4c9841a1d5/.github/workflows/python-poetry-ci.yml#L18-L60, except that in the mypy job I've installed rust and used a rust cache.