-
Notifications
You must be signed in to change notification settings - Fork 4
60 lines (49 loc) · 1.66 KB
/
python-poetry-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Linting
on:
workflow_call:
inputs:
typechecking-extras:
description: >
Space-separated list of package extras to install when type checking.
(I.e. the entries in `pyproject.toml`'s `[tool.poetry.extras]` section.)
Defaults to no extras.
# In the future I'd like to change setup-python-poetry to install all extras
# by default, using e.g. an implementation of
# https://github.com/python-poetry/poetry/issues/3413
type: string
required: false
default: ""
jobs:
style:
runs-on: ubuntu-latest
name: Style checks
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 .
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: "${{ inputs.typechecking-extras }}"
install-project: "false"
- name: Restore/persist mypy's cache
uses: AustinScola/mypy-cache-github-action@df56268388422ee282636ee2c7a9cc55ec644a41
- name: Run mypy
run: poetry run mypy