Skip to content

Commit 6fc0189

Browse files
[CI] Part 2 of many (- WIP PR #82 -)
1 parent f40d336 commit 6fc0189

File tree

3 files changed

+121
-137
lines changed

3 files changed

+121
-137
lines changed

.github/workflows/Tests.yml

Lines changed: 38 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343

4444

4545
BOOTSTRAP:
46-
if: ${{ always() }}
46+
if: ${{ !cancelled() }}
4747
needs: BUILD
4848
runs-on: ubuntu-latest
4949
defaults:
@@ -54,22 +54,22 @@ jobs:
5454
strategy:
5555
fail-fast: false
5656
matrix:
57-
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
57+
python-version: ["3.10", "3.11", "3.12"]
5858
lang-var: ["de.utf-8", "jp.utf-8"]
5959
experimental: [true]
6060
include:
6161
- python-version: 3.7
6262
lang-var: "en_US.utf-8"
63-
experimental: false
63+
experimental: true
6464
- python-version: 3.8
6565
lang-var: "en_US.utf-8"
66-
experimental: false
66+
experimental: true
6767
- python-version: 3.9
6868
lang-var: "de.utf-8"
69-
experimental: false
69+
experimental: true
7070
- python-version: 3.9
7171
lang-var: "jp.utf-8"
72-
experimental: false
72+
experimental: true
7373
- python-version: 3.9
7474
lang-var: "en_US.utf-8"
7575
experimental: false
@@ -93,7 +93,7 @@ jobs:
9393
python-version: ${{ matrix.python-version }}
9494
- name: Setup dependencies
9595
run: |
96-
python -m pip install --upgrade "pip>=21.0" "setuptools>=45.0" "wheel>=0.37"
96+
python -m pip install --upgrade "pip>=24.3.1" "setuptools>=45.0" "wheel>=0.37"
9797
pip install -r ./requirements.txt
9898
pip install -r ./test-requirements.txt || true
9999
- name: Pre-build
@@ -126,12 +126,12 @@ jobs:
126126
run: |
127127
make -j1 -f Makefile purge || true ;
128128
make -j1 -f Makefile clean || true ;
129-
if: ${{ always() }}
129+
if: ${{ !cancelled() }}
130130
shell: bash
131131

132132

133133
MATS:
134-
if: ${{ always() }}
134+
if: ${{ !cancelled() }}
135135
needs: BUILD
136136
runs-on: ubuntu-latest
137137
defaults:
@@ -140,7 +140,7 @@ jobs:
140140
timeout-minutes: 10
141141
strategy:
142142
matrix:
143-
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
143+
python-version: ["3.9.20", "3.10", "3.11", "3.12"]
144144
env:
145145
PYTHON_VERSION: ${{ matrix.python-version }}
146146
LANG: "en_US.utf-8"
@@ -169,105 +169,26 @@ jobs:
169169
- name: Post-Clean
170170
id: post
171171
run: make -j1 -f Makefile clean || true ;
172-
if: ${{ always() }}
173-
172+
if: ${{ !cancelled() }}
174173

175-
COVERAGE-MATS:
174+
COVERAGE:
176175
if: ${{ success() }}
177176
needs: [BUILD, MATS]
178177
runs-on: ${{ matrix.os }}
179178
timeout-minutes: 10
180179
strategy:
181180
matrix:
182181
os: [ubuntu-latest, macos-latest, windows-latest]
183-
python-version: ["3.11", "3.12"]
184-
env:
185-
OS: ${{ matrix.os }}
186-
PYTHON_VERSION: ${{ matrix.python-version }}
187-
LANG: "en_US.utf-8"
188-
COVERAGE_RCFILE: ./.coveragerc
189-
COV_CORE_SOURCE: ./
190-
COV_CORE_CONFIG: ./.coveragerc
191-
COV_CORE_DATAFILE: ./coverage.xml
192-
CODECLIMATE_REPO_TOKEN: ${{ secrets.CODECLIMATE_TOKEN }}
193-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
194-
steps:
195-
- uses: actions/checkout@v4
196-
- name: Setup Python ${{ matrix.python-version }}
197-
uses: actions/setup-python@v5
198-
with:
199-
python-version: ${{ matrix.python-version }}
200-
- name: Install dependencies for python ${{ matrix.python-version }} on ${{ matrix.os }}
201-
run: |
202-
pip install --upgrade "pip>=21.0" "setuptools>=45.0" "wheel>=0.37"
203-
pip install -r ./requirements.txt
204-
pip install -r ./test-requirements.txt || true
205-
- name: Install code-climate tools for ${{ matrix.python-version }}
206-
if: ${{ runner.os }} != "Linux"
207-
shell: bash
208-
run: if [ "$OS" == "macos-latest" ] ; then ./tests/fetch_cc-test-reporter || true ; fi ;
209-
- name: Install deepsource tools for ${{ matrix.python-version }}
210-
if: ${{ runner.os }} == "Linux"
211-
shell: bash
212-
run: |
213-
if [ "$OS" == "ubuntu-latest" ] ; then (curl https://deepsource.io/cli | sh) || true ; else echo "SKIP deepsource" ; fi ;
214-
- name: Pre-Clean
215-
id: clean
216-
run: make -j1 -f Makefile clean || true ;
217-
- name: Generate Coverage for py3.9 on ${{ matrix.os }}
218-
if: ${{ runner.python-version }} == "3.9"
219-
run: make -f Makefile test ;
220-
- name: Generate Coverage for py${{ matrix.python-version }} on ${{ matrix.os }}
221-
if: ${{ runner.python-version }} != "3.9"
222-
run: make -f Makefile test-pytest ;
223-
- name: Upload Python ${{ matrix.python-version }} coverage to Codecov
224-
uses: codecov/codecov-action@v5
225-
with:
226-
token: ${{ secrets.CODECOV_TOKEN }}
227-
files: ./coverage.xml
228-
directory: .
229-
flags: ${{ matrix.os }},${{ matrix.python-version }}
230-
name: pythonrepo-github-${{ matrix.os }}-${{ matrix.python-version }}
231-
verbose: true
232-
fail_ci_if_error: false
233-
- name: Upload Python ${{ matrix.python-version }} Artifact
234-
uses: actions/upload-artifact@v4
235-
with:
236-
name: Test-Report-${{ matrix.os }}-${{ matrix.python-version }}
237-
path: ./test-reports/
238-
if-no-files-found: ignore
239-
- name: code-climate for ${{ matrix.python-version }}
240-
if: ${{ runner.os }} != "Linux"
241-
shell: bash
242-
run: |
243-
if [ "$OS" == "macos-latest" ] ; then ./cc-test-reporter after-build --exit-code 0 || true ; else echo "SKIP code climate" ; fi ;
244-
- name: deepsource for ${{ matrix.python-version }}
245-
if: ${{ runner.os }} == "Linux"
246-
shell: bash
247-
run: |
248-
if [ "$OS" == "ubuntu-latest" ] ; then ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml 2>/dev/null || true ; else echo "SKIP deepsource" ; fi ;
249-
- name: Post-Clean
250-
id: post
251-
run: make -j1 -f Makefile clean || true ;
252-
if: ${{ always() }}
253-
254-
COVERAGE:
255-
if: ${{ success() }}
256-
needs: [BUILD, MATS, COVERAGE-MATS]
257-
runs-on: ${{ matrix.os }}
258-
timeout-minutes: 10
259-
strategy:
260-
matrix:
261-
os: [ubuntu-latest, macos-13, windows-latest]
262-
python-version: [3.7, 3.8, 3.9, "3.10"]
182+
python-version: ["3.9", "3.10", "3.11", "3.12"]
263183
env:
264184
OS: ${{ matrix.os }}
265185
PYTHON_VERSION: ${{ matrix.python-version }}
266186
LANG: "en_US.utf-8"
267187
COVERAGE_RCFILE: ./.coveragerc
268188
COV_CORE_SOURCE: ./
269189
COV_CORE_CONFIG: ./.coveragerc
270-
COV_CORE_DATAFILE: ./coverage.xml
190+
COV_CORE_DATAFILE: ./coverage.xml\
191+
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
271192
CODECLIMATE_REPO_TOKEN: ${{ secrets.CODECLIMATE_TOKEN }}
272193
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
273194
steps:
@@ -276,20 +197,18 @@ jobs:
276197
uses: actions/setup-python@v5
277198
with:
278199
python-version: ${{ matrix.python-version }}
200+
- name: Fix braindead windows ${{ matrix.python-version }} on ${{ matrix.os }}
201+
if: ${{ !cancelled() && runner.os == 'Windows' }}
202+
run: python -m pip install --upgrade pip
279203
- name: Install dependencies for python ${{ matrix.python-version }} on ${{ matrix.os }}
280204
run: |
281-
pip install --upgrade "pip>=21.0" "setuptools>=45.0" "wheel>=0.37" ;
205+
pip install --upgrade "pip>=24.3.1" "setuptools>=45.0" "wheel>=0.37" ;
282206
pip install -r ./requirements.txt ;
283207
pip install -r ./test-requirements.txt || true ;
284208
- name: Install code-climate tools for ${{ matrix.python-version }}
285-
if: ${{ runner.os }} == "Linux"
286-
shell: bash
287-
run: if [ "$OS" == "ubuntu-latest" ] ; then ./tests/fetch_cc-test-reporter || true ; fi ;
288-
- name: Install deepsource tools for ${{ matrix.python-version }}
289-
if: ${{ runner.os }} == "Linux"
209+
if: ${{ !cancelled() && runner.os != 'Windows' }}
290210
shell: bash
291-
run: |
292-
if [ "$OS" == "ubuntu-latest" ] ; then (curl https://deepsource.io/cli | sh) || true ; else echo "SKIP deepsource" ; fi ;
211+
run: ./tests/fetch_cc-test-reporter || true ;
293212
- name: Pre-Clean
294213
id: clean
295214
run: make -j1 -f Makefile clean || true ;
@@ -316,7 +235,7 @@ jobs:
316235
path: ./test-reports/
317236
if-no-files-found: ignore
318237
- name: code-climate for ${{ matrix.python-version }}
319-
if: ${{ runner.os }} == "Linux"
238+
if: ${{ !cancelled() && runner.os != 'Windows' }}
320239
shell: bash
321240
run: |
322241
if [ "$OS" == "ubuntu-latest" ] ; then ./cc-test-reporter after-build --exit-code 0 || true ; else echo "SKIP code climate" ; fi ;
@@ -328,7 +247,7 @@ jobs:
328247
- name: Post-Clean
329248
id: post
330249
run: make -j1 -f Makefile clean || true ;
331-
if: ${{ always() }}
250+
if: ${{ !cancelled() }}
332251

333252
STYLE:
334253
if: ${{ success() }}
@@ -337,18 +256,18 @@ jobs:
337256
timeout-minutes: 10
338257

339258
env:
340-
PYTHON_VERSION: '3.10'
259+
PYTHON_VERSION: '3.12'
341260
LANG: "en_US.utf-8"
342261

343262
steps:
344263
- uses: actions/checkout@v4
345264
- name: Setup Python
346265
uses: actions/setup-python@v5
347266
with:
348-
python-version: "3.10"
267+
python-version: "3.12"
349268
- name: Install dependencies for python Linters
350269
run: |
351-
pip install --upgrade "pip>=21.0" "setuptools>=45.0" "wheel>=0.37" ;
270+
pip install --upgrade "pip>=24.3.1" "setuptools>=45.0" "wheel>=0.37" ;
352271
pip install -r ./requirements.txt ;
353272
pip install -r ./test-requirements.txt || true ;
354273
- name: Pre-Clean
@@ -361,7 +280,7 @@ jobs:
361280
- name: Post-Clean
362281
id: post
363282
run: make -j1 -f Makefile clean || true ;
364-
if: ${{ always() }}
283+
if: ${{ !cancelled() }}
365284

366285

367286
INTEGRATION:
@@ -392,11 +311,11 @@ jobs:
392311
python-version: ${{ matrix.python-version }}
393312
- name: Install dependencies for python ${{ matrix.python-version }} on ${{ matrix.os }}
394313
run: |
395-
pip install --upgrade "pip>=21.0" "setuptools>=45.0" "wheel>=0.37" ;
314+
pip install --upgrade "pip>=24.3.1" "setuptools>=45.0" "wheel>=0.37" ;
396315
pip install -r ./requirements.txt ;
397316
pip install -r ./test-requirements.txt || true ;
398-
- name: Install code-climate tools for ${{ matrix.python-version }}
399-
if: ${{ runner.os }} != "Linux"
317+
- name: Install code-climate tools for ${{ matrix.python-version }} on ${{ matrix.os }}
318+
if: ${{ !cancelled() && runner.os != 'Windows' }}
400319
run: if [ $OS == macos-latest ] ; then ./tests/fetch_cc-test-reporter || true ; fi ;
401320
shell: bash
402321
- name: Pre-Clean
@@ -430,17 +349,17 @@ jobs:
430349
path: ./test-reports/
431350
if-no-files-found: ignore
432351
- name: code-climate for ${{ matrix.python-version }}
433-
if: ${{ runner.os }} != "Linux"
352+
if: ${{ !cancelled() && runner.os != 'Windows' }}
434353
run: |
435-
if [ "$OS" == "macos-latest" ] ; then ./cc-test-reporter after-build --exit-code 0 || true ; else echo "SKIP code climate" ; fi ;
354+
./cc-test-reporter after-build --exit-code 0 || true ;
436355
- name: Post-purge
437356
id: post-uninstall
438357
run: make -j1 -f Makefile purge || true ;
439-
if: ${{ always() }}
358+
if: ${{ !cancelled() }}
440359
- name: Post-Clean
441360
id: post-z-end
442361
run: make -j1 -f Makefile clean || true ;
443-
if: ${{ always() }}
362+
if: ${{ !cancelled() }}
444363

445364

446365
TOX:
@@ -450,18 +369,18 @@ jobs:
450369
timeout-minutes: 30
451370

452371
env:
453-
PYTHON_VERSION: '3.10'
372+
PYTHON_VERSION: '3.12'
454373
LANG: 'en_US.utf-8'
455374

456375
steps:
457376
- uses: actions/checkout@v4
458377
- name: Setup Python
459378
uses: actions/setup-python@v5
460379
with:
461-
python-version: "3.10"
380+
python-version: "3.12"
462381
- name: Install dependencies for Tox
463382
run: |
464-
pip install --upgrade "pip>=21.0" "setuptools>=45.0" "wheel>=0.37" "tox>=3.0";
383+
pip install --upgrade "pip>=24.3.1" "setuptools>=45.0" "wheel>=0.37" "tox>=3.0";
465384
pip install -r ./requirements.txt ;
466385
pip install -r ./test-requirements.txt || true ;
467386
- name: Pre-Clean
@@ -472,4 +391,4 @@ jobs:
472391
- name: Post-Clean
473392
id: post
474393
run: make -j1 -f Makefile clean || true ;
475-
if: ${{ always() }}
394+
if: ${{ !cancelled() }}

Makefile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,14 @@ init:
176176

177177
install: init build must_be_root
178178
$(QUIET)$(PYTHON) -m pip install $(PIP_COMMON_FLAGS) $(PIP_ENV_FLAGS) -e "git+https://github.com/reactive-firewall/python-repo.git#egg=pythonrepo"
179-
$(QUITE)$(WAIT)
179+
$(QUIET)$(WAIT)
180180
$(QUIET)$(ECHO) "$@: Done."
181181

182182
user-install: build
183183
$(QUIET)$(PYTHON) -m pip install $(PIP_COMMON_FLAGS) $(PIP_ENV_FLAGS) --user "pip>=24.3.1" "setuptools>=75.0" "wheel>=0.44" "build>=1.1.1" 2>$(ERROR_LOG_PATH) || true
184184
$(QUIET)$(PYTHON) -m pip install $(PIP_COMMON_FLAGS) $(PIP_ENV_FLAGS) --user -r "https://raw.githubusercontent.com/reactive-firewall/python-repo/stable/requirements.txt" 2>$(ERROR_LOG_PATH) || true
185185
$(QUIET)$(PYTHON) -m pip install $(PIP_COMMON_FLAGS) $(PIP_ENV_FLAGS) --user -e "git+https://github.com/reactive-firewall/python-repo.git#egg=pythonrepo"
186-
$(QUITE)$(WAIT)
186+
$(QUIET)$(WAIT)
187187
$(QUIET)$(ECHO) "$@: Done."
188188

189189
uninstall:
@@ -200,6 +200,7 @@ legacy-purge: clean uninstall
200200

201201
purge: legacy-purge
202202
$(QUIET)$(RM) ./cc-test-reporter 2>$(ERROR_LOG_PATH) || :
203+
$(QUIET)$(RM) ./ds-cli.sh 2>$(ERROR_LOG_PATH) || :
203204
$(QUIET)$(RM) ./test-reports/*.xml 2>$(ERROR_LOG_PATH) || :
204205
$(QUIET)$(RMDIR) ./test-reports/ 2>$(ERROR_LOG_PATH) || :
205206
$(QUIET)$(ECHO) "$@: Done."
@@ -209,15 +210,15 @@ test-reports:
209210
$(QUIET)$(BSMARK) ./test-reports 2>$(ERROR_LOG_PATH) >$(ERROR_LOG_PATH) || true ;
210211
$(QUIET)$(ECHO) "$@: Done."
211212

212-
test-reqs: test-reports init
213+
test-reqs: cc-test-reporter test-reports init
213214
$(QUIET)$(PYTHON) -m pip install $(PIP_COMMON_FLAGS) $(PIP_ENV_FLAGS) -r tests/requirements.txt 2>$(ERROR_LOG_PATH) || true
214215

215216
just-test: cleanup
216217
$(QUIET)$(COVERAGE) run -p --source=pythonrepo -m unittest discover --verbose --buffer -s ./tests -t $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) || $(PYTHON) -m unittest discover --verbose --buffer -s ./tests -t ./ || DO_FAIL="exit 2" ;
217-
$(QUITE)$(WAIT) ;
218+
$(QUIET)$(WAIT) ;
218219
$(QUIET)$(DO_FAIL) ;
219220

220-
test: just-test
221+
test: just-test cc-test-reporter
221222
$(QUIET)$(DO_FAIL) ;
222223
$(QUIET)$(COVERAGE) combine 2>$(ERROR_LOG_PATH) || : ;
223224
$(QUIET)$(COVERAGE) report -m --include=* 2>$(ERROR_LOG_PATH) || : ;
@@ -227,9 +228,11 @@ test-tox: cleanup
227228
$(QUIET)tox -v -- || tail -n 500 .tox/py*/log/py*.log 2>/dev/null
228229
$(QUIET)$(ECHO) "$@: Done."
229230

230-
test-pytest: cleanup MANIFEST.in must_have_pytest test-reports
231+
test-pytest: cleanup MANIFEST.in cc-test-reporter must_have_pytest test-reports
231232
$(QUIET)$(PYTHON) -m pytest --cache-clear --doctest-glob=pythonrepo/*.py --doctest-modules --cov=. --cov-append --cov-report=xml --junitxml=test-reports/junit.xml -v --rootdir=. || DO_FAIL="exit 2" ;
232-
$(QUITE)$(WAIT) ;
233+
$(QUIET)./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml || : ;
234+
$(QUIET)./cc-test-reporter after-build --exit-code 0 -t coverage.py -r $(CC_TEST_REPORTER_ID) || : ;
235+
$(QUIET)$(WAIT) ;
233236
$(QUIET)$(DO_FAIL) ;
234237
$(QUIET)$(ECHO) "$@: Done."
235238

@@ -239,6 +242,12 @@ test-style: cleanup
239242
$(QUIET)tests/check_spelling 2>/dev/null || true
240243
$(QUIET)$(ECHO) "$@: Done."
241244

245+
cc-test-reporter: tests/fetch_cc-test-reporter
246+
$(QUIET)tests/fetch_cc-test-reporter ;
247+
$(QUIET)$(WAIT) ;
248+
$(QUIET)$(DO_FAIL) ;
249+
$(QUIET)$(ECHO) "$@: Done."
250+
242251
must_have_flake:
243252
$(QUIET)runner=`$(PYTHON) -m pip freeze --all | grep --count -oF flake` ; \
244253
if test $$runner -le 0 ; then $(ECHO) "No Linter found for test." ; exit 126 ; fi

0 commit comments

Comments
 (0)