@@ -30,39 +30,43 @@ jobs:
30
30
31
31
steps :
32
32
- uses : actions/checkout@v3
33
+ - name : Install poetry
34
+ run : pipx install poetry
33
35
- name : Set up Python
34
36
uses : actions/setup-python@v4
35
37
with :
36
38
python-version : ' 3.8'
37
39
- name : Install ruff
38
40
run : |
39
- python -m pip install --upgrade pip
40
- pip install ruff
41
+ poetry env use 3.8
42
+ poetry install --only lint --no-interaction --no-root
41
43
- name : Lint with ruff
42
44
run : |
43
- ruff check --format=github ethicml
45
+ poetry run ruff check --format=github ethicml
44
46
- name : Lint with ruff
45
47
run : |
46
- ruff check --format=github tests
48
+ poetry run ruff check --format=github tests
47
49
48
50
format_with_black :
49
51
50
52
runs-on : ubuntu-latest
51
53
52
54
steps :
53
55
- uses : actions/checkout@v3
56
+ - name : Install poetry
57
+ run : pipx install poetry
54
58
- name : Set up Python
55
59
uses : actions/setup-python@v4
56
60
with :
57
61
python-version : ' 3.8'
58
62
- name : Install black
59
63
run : |
60
- python -m pip install --upgrade pip
61
- pip install 'black<=23'
64
+ poetry env use 3.8
65
+ poetry install --only format --no-interaction --no-root
62
66
- name : Format with black
63
67
run : |
64
- python -m black --check -l 100 -t py38 -S ethicml/
65
- python -m black --check -l 100 -t py38 -S tests/
68
+ poetry run black --check -l 100 -t py38 -S ethicml/
69
+ poetry run black --check -l 100 -t py38 -S tests/
66
70
67
71
check_docstrings :
68
72
@@ -135,7 +139,7 @@ jobs:
135
139
run : |
136
140
# keep the following in sync with `test_with_pytest`!
137
141
poetry env use 3.8
138
- poetry install --no-interaction --no-root -E all --with ci --with torchcpu
142
+ poetry install --no-interaction --no-root -E all --with ci --with torchcpu --without lint --without format
139
143
- name : Test import
140
144
run : |
141
145
poetry run python -c "import ethicml"
@@ -166,16 +170,25 @@ jobs:
166
170
run : |
167
171
# keep the following in sync with `test_full_dependencies`!
168
172
poetry env use 3.8
169
- poetry install --no-interaction --no-root -E all --with ci --with torchcpu
173
+ poetry install --no-interaction --no-root -E all --with ci --with torchcpu --without lint --without format
170
174
171
175
# ----------------------------------------------
172
176
# ----- Run MyPy -----
173
177
# ----------------------------------------------
174
178
- name : Type check with mypy
175
179
if : ${{ github.event_name == 'merge_group' }}
176
180
run : |
177
- poetry run python run_mypy.py
178
- poetry run python run_mypy_tests.py
181
+ poetry run mypy ethicml
182
+ poetry run mypy --warn-unused-ignores ethicml || true
183
+
184
+ # ----------------------------------------------
185
+ # ----- Run MyPy on tests -----
186
+ # ----------------------------------------------
187
+ - name : Type check tests with mypy
188
+ if : ${{ github.event_name == 'merge_group' }}
189
+ run : |
190
+ poetry run mypy tests
191
+ poetry run mypy --warn-unused-ignores tests || true
179
192
180
193
# ----------------------------------------------
181
194
# ----- Run Tests -----
0 commit comments