Skip to content

Commit 5a2e1c1

Browse files
authored
♻️ simplify reusable Python CI workflow (cda-tum#591)
## Description This PR simplifies the CI pipeline a little by combining two jobs into one and, as a consequence, saving one runner that has to spin up just to run a single command. ## Checklist: <!--- This checklist serves as a reminder of a couple of things that ensure your pull request will be merged swiftly. --> - [x] The pull request only contains commits that are related to it. - [x] I have added appropriate tests and documentation. - [x] I have made sure that all CI jobs on GitHub pass. - [x] The pull request introduces no new warnings and follows the project's style guidelines. --------- Signed-off-by: burgholzer <burgholzer@me.com>
1 parent 202cc17 commit 5a2e1c1

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

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

+10-17
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,11 @@ jobs:
4343
uses: rui314/setup-mold@v1
4444
- uses: hynek/build-and-inspect-python-package@v2
4545
id: baipp
46-
outputs:
47-
python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_array }}
48-
49-
max-python-version:
50-
name: 🐍 Determine maximum supported Python version
51-
needs: dist
52-
runs-on: ubuntu-latest
53-
steps:
54-
# use jq to get the last element of the array
55-
- run: echo "max-python-version=$(echo '${{ needs.dist.outputs.python-versions }}' | jq --raw-output '.[-1]')" >> $GITHUB_OUTPUT
46+
- name: 🐍 Determine maximum supported Python version
47+
run: echo "max-python-version=$(echo '${{ steps.baipp.outputs.supported_python_classifiers_json_array }}' | jq --raw-output '.[-1]')" >> $GITHUB_OUTPUT
5648
id: max-python-version
5749
outputs:
50+
python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_array }}
5851
max-python-version: ${{ steps.max-python-version.outputs.max-python-version }}
5952

6053
python-tests-ubuntu:
@@ -75,17 +68,17 @@ jobs:
7568

7669
python-tests-macos:
7770
name: 🍎 ${{ matrix.python-version }} ${{ matrix.runs-on }}
78-
needs: [dist, max-python-version]
71+
needs: [dist]
7972
strategy:
8073
fail-fast: false
8174
matrix:
8275
python-version:
8376
- ${{ fromJson(needs.dist.outputs.python-versions)[0] }}
84-
- ${{ needs.max-python-version.outputs.max-python-version }}
77+
- ${{ needs.dist.outputs.max-python-version }}
8578
runs-on: [macos-13] # test Intel architecture
8679
include:
8780
- runs-on: macos-14 # test Apple Silicon architecture
88-
python-version: ${{ needs.max-python-version.outputs.max-python-version }} # testing Apple Silicon on 3.8 is blocked by https://github.com/actions/setup-python/issues/808
81+
python-version: ${{ needs.dist.outputs.max-python-version }} # testing Apple Silicon on 3.8 is blocked by https://github.com/actions/setup-python/issues/808
8982
uses: ./.github/workflows/reusable-python-tests.yml
9083
with:
9184
runs-on: ${{ matrix.runs-on }}
@@ -97,13 +90,13 @@ jobs:
9790

9891
python-tests-windows:
9992
name: 🏁 ${{ matrix.python-version }}
100-
needs: [dist, max-python-version]
93+
needs: [dist]
10194
strategy:
10295
fail-fast: false
10396
matrix:
10497
python-version:
10598
- ${{ fromJson(needs.dist.outputs.python-versions)[0] }}
106-
- ${{ needs.max-python-version.outputs.max-python-version }}
99+
- ${{ needs.dist.outputs.max-python-version }}
107100
uses: ./.github/workflows/reusable-python-tests.yml
108101
with:
109102
runs-on: windows-latest
@@ -115,13 +108,13 @@ jobs:
115108

116109
minimums:
117110
name: 🔧 Minimums
118-
needs: [dist, max-python-version]
111+
needs: [dist]
119112
strategy:
120113
fail-fast: false
121114
matrix:
122115
python-version:
123116
- ${{ fromJson(needs.dist.outputs.python-versions)[0] }}
124-
- ${{ needs.max-python-version.outputs.max-python-version }}
117+
- ${{ needs.dist.outputs.max-python-version }}
125118
uses: ./.github/workflows/reusable-python-minimums.yml
126119
with:
127120
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)