1+ name : Code Quality Checks
2+ on :
3+ push :
4+ branches :
5+ - main
6+ pull_request :
7+ branches :
8+ - main
9+ workflow_dispatch :
10+ jobs :
11+ check-linting :
12+ runs-on : ubuntu-latest
13+ strategy :
14+ matrix :
15+ python-version : [3.8, 3.9, "3.10"]
16+ steps :
17+ # ----------------------------------------------
18+ # check-out repo and set-up python
19+ # ----------------------------------------------
20+ - name : Check out repository
21+ uses : actions/checkout@v2
22+ - name : Set up python ${{ matrix.python-version }}
23+ id : setup-python
24+ uses : actions/setup-python@v2
25+ with :
26+ python-version : ${{ matrix.python-version }}
27+ # ----------------------------------------------
28+ # ----- install & configure poetry -----
29+ # ----------------------------------------------
30+ - name : Install Poetry
31+ uses : snok/install-poetry@v1
32+ with :
33+ virtualenvs-create : true
34+ virtualenvs-in-project : true
35+ installer-parallel : true
36+
37+ # ----------------------------------------------
38+ # load cached venv if cache exists
39+ # ----------------------------------------------
40+ - name : Load cached venv
41+ id : cached-poetry-dependencies
42+ uses : actions/cache@v2
43+ with :
44+ path : .venv
45+ key : venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
46+ # ----------------------------------------------
47+ # install dependencies if cache does not exist
48+ # ----------------------------------------------
49+ - name : Install dependencies
50+ if : steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
51+ run : poetry install --no-interaction --no-root
52+ # ----------------------------------------------
53+ # install your root project, if required
54+ # ----------------------------------------------
55+ - name : Install library
56+ run : poetry install --no-interaction
57+ # ----------------------------------------------
58+ # black the code
59+ # ----------------------------------------------
60+ - name : Black
61+ run : poetry run black --check src
62+
63+ check-types :
64+ runs-on : ubuntu-latest
65+ strategy :
66+ matrix :
67+ python-version : [3.8, 3.9, "3.10"]
68+ steps :
69+ # ----------------------------------------------
70+ # check-out repo and set-up python
71+ # ----------------------------------------------
72+ - name : Check out repository
73+ uses : actions/checkout@v2
74+ - name : Set up python ${{ matrix.python-version }}
75+ id : setup-python
76+ uses : actions/setup-python@v2
77+ with :
78+ python-version : ${{ matrix.python-version }}
79+ # ----------------------------------------------
80+ # ----- install & configure poetry -----
81+ # ----------------------------------------------
82+ - name : Install Poetry
83+ uses : snok/install-poetry@v1
84+ with :
85+ virtualenvs-create : true
86+ virtualenvs-in-project : true
87+ installer-parallel : true
88+
89+ # ----------------------------------------------
90+ # load cached venv if cache exists
91+ # ----------------------------------------------
92+ - name : Load cached venv
93+ id : cached-poetry-dependencies
94+ uses : actions/cache@v2
95+ with :
96+ path : .venv
97+ key : venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
98+ # ----------------------------------------------
99+ # install dependencies if cache does not exist
100+ # ----------------------------------------------
101+ - name : Install dependencies
102+ if : steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
103+ run : poetry install --no-interaction --no-root
104+ # ----------------------------------------------
105+ # install your root project, if required
106+ # ----------------------------------------------
107+ - name : Install library
108+ run : poetry install --no-interaction
109+ # ----------------------------------------------
110+ # mypy the code
111+ # ----------------------------------------------
112+ - name : Mypy
113+ run : |
114+ mkdir .mypy_cache # Workaround for bad error message "error: --install-types failed (no mypy cache directory)"; see https://github.com/python/mypy/issues/10768#issuecomment-2178450153
115+ poetry run mypy --install-types --non-interactive src
0 commit comments