Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import commits from branch #67

Merged
merged 3 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 35 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches: ["main"]
pull_request:

jobs:
jobs:
check-code-style:
name: Check code style
runs-on: ubuntu-latest
Expand All @@ -13,11 +13,17 @@ jobs:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v2

- name: Setup Poetry
uses: matrix-org/setup-python-poetry@v1
with:
python-version: "3.11"
- run: python -m pip install tox "poetry==1.8.3"
- run: tox -e check_codestyle
install-project: "false"

- name: Run ruff check
run: poetry run ruff check --output-format=github .

- name: Run ruff format
run: poetry run ruff format --check .

check-types:
name: Check types with Mypy
Expand All @@ -26,12 +32,31 @@ jobs:
- run: sudo apt-get install -y libmagic1
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v2
uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@v2

- name: Setup Poetry
uses: matrix-org/setup-python-poetry@v1
with:
python-version: "3.11"
- run: python -m pip install tox "poetry==1.8.3"
- run: tox -e check_types
# 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"

# Cribbed from
# https://github.com/AustinScola/mypy-cache-github-action/blob/85ea4f2972abed39b33bd02c36e341b28ca59213/src/restore.ts#L10-L17
- name: Restore/persist mypy's cache
uses: actions/cache@v4
with:
path: |
.mypy_cache
key: mypy-cache-${{ github.context.sha }}
restore-keys: mypy-cache-

- name: Run mypy
run: poetry run mypy


unit-tests:
name: Unit tests
Expand Down
11 changes: 11 additions & 0 deletions config.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,20 @@ scan:

# List of allowed MIME types. If a file has a MIME type that's not in this list, its
# scan is considered failed.
# Unrecognised binary files are considered to be `application/octet-stream`.
# Unrecognised text files are considered to be `text/plain`.
# Optional, defaults to allowing all MIME types.
allowed_mimetypes: ["image/jpeg"]

# List of blocked MIME types.
# If specified, `allowed_mimetypes` must not be specified as well.
# If specified, a file whose MIME type is on this list will produce a scan that is
# considered failed.
# Unrecognised binary files are considered to be `application/octet-stream`.
# Unrecognised text files are considered to be `text/plain`.
# Optional.
# blocked_mimetypes: ["image/jpeg"]

# Configuration of scan result caching.
#
# Results are stored in a cache to avoid having to download and scan a file twice. There
Expand Down
5 changes: 4 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[mypy]
strict = true
strict = true
files =
tests/,
src/
Empty file modified perf/scanner_perf.py
100644 → 100755
Empty file.
203 changes: 29 additions & 174 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading