Skip to content

Commit c256b51

Browse files
authored
♻️ unify Python testing (#32)
♻️ unify Python tests
1 parent 0b6eabc commit c256b51

File tree

2 files changed

+13
-74
lines changed

2 files changed

+13
-74
lines changed

.github/workflows/reusable-python-ci.yml

+4-59
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ name: 🐍 • CI
33
on:
44
workflow_call:
55
inputs:
6-
skip-testing-latest-python:
7-
description: "Whether to skip testing on the latest Python version"
8-
default: false
9-
type: boolean
106
setup-z3:
117
description: "Whether to set up Z3"
128
default: false
@@ -42,74 +38,23 @@ jobs:
4238
# set up mold as linker for faster C++ builds
4339
- name: Set up mold as linker
4440
uses: rui314/setup-mold@v1
45-
# run the build-and-inspect-python-package action (outputs supported Python versions)
4641
- uses: hynek/build-and-inspect-python-package@v2
47-
id: baipp
48-
# reduce the list of Python versions by one if the latest Python version is to be skipped
49-
- name: 🐍 Conditionally reduce the list of considered Python versions
50-
run: echo "supported-python-versions=$(echo '${{ steps.baipp.outputs.supported_python_classifiers_json_array }}' | jq -rc 'if ${{ inputs.skip-testing-latest-python }} then .[:-1] else . end')" >> $GITHUB_OUTPUT
51-
id: supported-python-versions
52-
# determine the maximum supported Python version
53-
- name: 🐍 Determine maximum supported Python version
54-
run: echo "max-python-version=$(echo '${{ steps.supported-python-versions.outputs.supported-python-versions }}' | jq --raw-output '.[-1]')" >> $GITHUB_OUTPUT
55-
id: max-python-version
56-
outputs:
57-
python-versions: ${{ steps.supported-python-versions.outputs.supported-python-versions }}
58-
max-python-version: ${{ steps.max-python-version.outputs.max-python-version }}
59-
60-
python-tests-ubuntu:
61-
name: 🐧 ${{ matrix.python-version }}
62-
needs: dist
63-
strategy:
64-
fail-fast: false
65-
matrix:
66-
# runs Python testing for all supported Python versions on Ubuntu
67-
python-version: ${{ fromJson(needs.dist.outputs.python-versions) }}
68-
uses: ./.github/workflows/reusable-python-tests.yml
69-
with:
70-
runs-on: ubuntu-latest
71-
python-version: ${{ matrix.python-version }}
72-
setup-z3: ${{ inputs.setup-z3 }}
73-
z3-version: ${{ inputs.z3-version }}
7442

75-
python-tests-macos:
76-
name: 🍎 ${{ matrix.python-version }} ${{ matrix.runs-on }}
77-
needs: [dist]
43+
python-tests:
44+
name: 🐍 ${{ matrix.runs-on }}
7845
strategy:
7946
fail-fast: false
8047
matrix:
81-
# runs Python testing for the minimum and maximum supported Python versions on macOS
82-
python-version:
83-
- ${{ fromJson(needs.dist.outputs.python-versions)[0] }}
84-
- ${{ needs.dist.outputs.max-python-version }}
85-
runs-on: [macos-13, macos-14]
48+
runs-on: [ubuntu-latest, macos-13, macos-14, windows-latest]
8649
uses: ./.github/workflows/reusable-python-tests.yml
8750
with:
8851
runs-on: ${{ matrix.runs-on }}
89-
python-version: ${{ matrix.python-version }}
90-
setup-z3: ${{ inputs.setup-z3 }}
91-
z3-version: ${{ inputs.z3-version }}
92-
93-
python-tests-windows:
94-
name: 🏁 ${{ matrix.python-version }}
95-
needs: [dist]
96-
strategy:
97-
fail-fast: false
98-
matrix:
99-
# runs Python testing for the minimum and maximum supported Python versions on Windows
100-
python-version:
101-
- ${{ fromJson(needs.dist.outputs.python-versions)[0] }}
102-
- ${{ needs.dist.outputs.max-python-version }}
103-
uses: ./.github/workflows/reusable-python-tests.yml
104-
with:
105-
runs-on: windows-latest
106-
python-version: ${{ matrix.python-version }}
10752
setup-z3: ${{ inputs.setup-z3 }}
10853
z3-version: ${{ inputs.z3-version }}
10954

11055
python-coverage-upload:
11156
name: 📈
112-
needs: [python-tests-ubuntu, python-tests-macos, python-tests-windows]
57+
needs: [python-tests]
11358
runs-on: ubuntu-latest
11459
permissions:
11560
id-token: write

.github/workflows/reusable-python-tests.yml

+9-15
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ on:
33
workflow_call:
44
inputs:
55
runs-on:
6-
description: "The platform to run the tests on (ubuntu-latest, macos-latest, windows-latest)"
7-
required: true
8-
type: string
9-
python-version:
10-
description: "The Python version to use"
6+
description: "The platform to run the tests on"
117
required: true
128
type: string
139
setup-z3:
@@ -21,7 +17,7 @@ on:
2117

2218
jobs:
2319
python-tests:
24-
name: 🐍 ${{ inputs.python-version }} ${{ inputs.runs-on }}
20+
name: 🐍 ${{ inputs.runs-on }}
2521
runs-on: ${{ inputs.runs-on }}
2622
env:
2723
FORCE_COLOR: 3
@@ -46,7 +42,7 @@ jobs:
4642
with:
4743
prepend_symlinks_to_path: false
4844
windows_compile_environment: msvc
49-
override_cache_key: python-tests-${{ inputs.runs-on }}-${{ inputs.python-version }}
45+
override_cache_key: python-tests-${{ inputs.runs-on }}
5046
# set up mold as linker for faster C++ builds (Linux only)
5147
- name: Set up mold as linker (Linux only)
5248
uses: rui314/setup-mold@v1
@@ -58,17 +54,15 @@ jobs:
5854
enable-cache: true
5955
# set up nox for convenient testing
6056
- uses: wntrblm/[email protected]
61-
with:
62-
python-versions: ${{ inputs.python-version }}
6357
# run the nox minimums session (assumes a nox session named "minimums" exists) with coverage
64-
- name: Test on 🐍 ${{ inputs.python-version }} with minimal versions
65-
run: nox -s minimums-${{ inputs.python-version }} --verbose -- --cov --cov-report=xml:coverage-${{ inputs.python-version }}-${{ inputs.runs-on }}.xml
58+
- name: 🐍 Test with minimal versions
59+
run: nox -s minimums --verbose -- --cov --cov-report=xml:coverage-${{ inputs.runs-on }}.xml --cov-append
6660
# run the nox tests session (assumes a nox session named "tests" exists) with coverage
67-
- name: Test on 🐍 ${{ inputs.python-version }}
68-
run: nox -s tests-${{ inputs.python-version }} --verbose -- --cov --cov-report=xml:coverage-${{ inputs.python-version }}-${{ inputs.runs-on }}.xml --cov-append
61+
- name: 🐍 Test
62+
run: nox -s tests --verbose -- --cov --cov-report=xml:coverage-${{ inputs.runs-on }}.xml --cov-append
6963
# upload the report as an artifact to GitHub so that it can later be uploaded to Codecov
70-
- name: Upload coverage report for 🐍 ${{ inputs.python-version }} on ${{ inputs.runs-on }}
64+
- name: Upload 🐍 coverage report for ${{ inputs.runs-on }}
7165
uses: actions/upload-artifact@v4
7266
with:
73-
name: coverage-${{ inputs.python-version }}-${{ inputs.runs-on }}
67+
name: coverage-${{ inputs.runs-on }}
7468
path: coverage-*

0 commit comments

Comments
 (0)