Skip to content

Commit bdbfdcc

Browse files
authored
Improve CI.yml definition (#453)
Previously, we had some weird bugs with the CI pipeline sometimes failing (#400), but not always reproducible. Namely, sometimes the CI failed, due to `mypy` not finding the `sdk` types when running from the `compliance_tool` environment. Since currently, we are at a point where it is impossible to reproduce the failing CI (at least for me), I decided to clean up the job definitions a little bit and make some things more explicit. Namely, instead of calling scripts like `pip` or `mypy` from their PATH, we now explicitly call them via `python -m pip` and `python -m mypy`. This theoretically ensures, that it always uses the script we just installed with the dependencies and not something the VM already had in its path via `actions/setup-python@v5`. This should ensure that a script like `mypy` actually has all the necessary dependencies installed. Secondly, we had a `pip install -e ../sdk[dev]`, therefore installing the development dependencies of the `sdk` in the `compliance_tool` CI check. This is technically incorrect, since we use the `sdk` as external dependency and therefore shouldn't depend on the development dependencies. I therefore removed this. Lastly, the `sdk-readme-codeblocks` check uses `bash` syntax. In theory, the Ubuntu environment should use `bash` by default, but now it is made explicit. Fixes #400 (hopefully)
1 parent f831016 commit bdbfdcc

1 file changed

Lines changed: 27 additions & 26 deletions

File tree

.github/workflows/ci.yml

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install Python dependencies
2323
run: |
2424
python -m pip install --upgrade pip
25-
pip install -r ./check_python_versions_requirements.txt
25+
python -m pip install -r ./check_python_versions_requirements.txt
2626
- name: Check Supported Python Versions
2727
run: |
2828
python check_python_versions_supported.py \
@@ -85,17 +85,17 @@ jobs:
8585
- name: Install Python dependencies
8686
run: |
8787
python -m pip install --upgrade pip
88-
pip install .[dev]
88+
python -m pip install .[dev]
8989
- name: Setup test config and CouchDB database server
9090
run: |
9191
python test/_helper/setup_testdb.py -u "admin" -p "$COUCHDB_ADMIN_PASSWORD"
9292
- name: Test with coverage + unittest
9393
run: |
94-
coverage run --source=basyx -m unittest
94+
python -m coverage run --source=basyx -m unittest
9595
- name: Report test coverage
9696
if: ${{ always() }}
9797
run: |
98-
coverage report -m
98+
python -m coverage report -m
9999
100100
sdk-static-analysis:
101101
# This job runs static code analysis, namely pycodestyle and mypy
@@ -112,13 +112,13 @@ jobs:
112112
- name: Install Python dependencies
113113
run: |
114114
python -m pip install --upgrade pip
115-
pip install .[dev]
115+
python -m pip install .[dev]
116116
- name: Check typing with MyPy
117117
run: |
118-
mypy basyx test
118+
python -m mypy basyx test
119119
- name: Check code style with PyCodestyle
120120
run: |
121-
pycodestyle --count --max-line-length 120 basyx test
121+
python -m pycodestyle --count --max-line-length 120 basyx test
122122
123123
sdk-readme-codeblocks:
124124
# This job runs the same static code analysis (mypy and pycodestyle) on the codeblocks in our docstrings.
@@ -135,16 +135,17 @@ jobs:
135135
- name: Install Python dependencies
136136
run: |
137137
python -m pip install --upgrade pip
138-
pip install .[dev]
138+
python -m pip install .[dev]
139139
- name: Check typing with MyPy
140+
shell: bash
140141
run: |
141-
mypy <(codeblocks python README.md)
142+
python -m mypy <(python -m codeblocks python README.md)
142143
- name: Check code style with PyCodestyle
143144
run: |
144-
codeblocks --wrap python README.md | pycodestyle --count --max-line-length 120 -
145+
python -m codeblocks --wrap python README.md | python -m pycodestyle --count --max-line-length 120 -
145146
- name: Run readme codeblocks with Python
146147
run: |
147-
codeblocks python README.md | python
148+
python -m codeblocks python README.md | python
148149
149150
sdk-docs:
150151
# This job checks, if the automatically generated documentation using sphinx can be compiled
@@ -161,7 +162,7 @@ jobs:
161162
- name: Install Python dependencies
162163
run: |
163164
python -m pip install --upgrade pip
164-
pip install .[docs]
165+
python -m pip install .[docs]
165166
- name: Check documentation for errors
166167
run: |
167168
SPHINXOPTS="-a -E -n -W --keep-going" make -C docs html
@@ -181,7 +182,7 @@ jobs:
181182
- name: Install dependencies
182183
run: |
183184
python -m pip install --upgrade pip
184-
pip install build
185+
python -m pip install build
185186
- name: Create source and wheel dist
186187
run: |
187188
python -m build
@@ -223,15 +224,15 @@ jobs:
223224
# install the local sdk in editable mode so it does not get overwritten
224225
run: |
225226
python -m pip install --upgrade pip
226-
pip install -e ../sdk[dev]
227-
pip install .[dev]
227+
python -m pip install ../sdk
228+
python -m pip install .[dev]
228229
- name: Test with coverage + unittest
229230
run: |
230-
coverage run --source=aas_compliance_tool -m unittest
231+
python -m coverage run --source=aas_compliance_tool -m unittest
231232
- name: Report test coverage
232233
if: ${{ always() }}
233234
run: |
234-
coverage report -m
235+
python -m coverage report -m
235236
236237
compliance-tool-static-analysis:
237238
# This job runs static code analysis, namely pycodestyle and mypy
@@ -250,14 +251,14 @@ jobs:
250251
# install the local sdk in editable mode so it does not get overwritten
251252
run: |
252253
python -m pip install --upgrade pip
253-
pip install -e ../sdk[dev]
254-
pip install .[dev]
254+
python -m pip install ../sdk
255+
python -m pip install .[dev]
255256
- name: Check typing with MyPy
256257
run: |
257-
mypy aas_compliance_tool test
258+
python -m mypy aas_compliance_tool test
258259
- name: Check code style with PyCodestyle
259260
run: |
260-
pycodestyle --count --max-line-length 120 aas_compliance_tool test
261+
python -m pycodestyle --count --max-line-length 120 aas_compliance_tool test
261262
262263
compliance-tool-package:
263264
# This job checks if we can build our compliance_tool package
@@ -275,7 +276,7 @@ jobs:
275276
- name: Install dependencies
276277
run: |
277278
python -m pip install --upgrade pip
278-
pip install build
279+
python -m pip install build
279280
- name: Create source and wheel dist
280281
run: |
281282
python -m build
@@ -301,14 +302,14 @@ jobs:
301302
- name: Install Python dependencies
302303
run: |
303304
python -m pip install --upgrade pip
304-
pip install ../../sdk
305-
pip install .[dev]
305+
python -m pip install ../../sdk
306+
python -m pip install .[dev]
306307
- name: Check typing with MyPy
307308
run: |
308-
mypy .
309+
python -m mypy .
309310
- name: Check code style with PyCodestyle
310311
run: |
311-
pycodestyle --count --max-line-length 120 .
312+
python -m pycodestyle --count --max-line-length 120 .
312313
313314
server-package:
314315
# This job checks if we can build our server package

0 commit comments

Comments
 (0)