Skip to content

Commit f8b7c95

Browse files
authored
Merge pull request #53 from stackhpc/refactor-tox-matrix
Refactor tox workflow, remove Python 3.6, and switch to Ubuntu latest runners
2 parents 801c394 + 4809caa commit f8b7c95

File tree

2 files changed

+74
-41
lines changed

2 files changed

+74
-41
lines changed

.github/workflows/tag-and-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name: Tag & Release
99
required: false
1010
jobs:
1111
turnstyle:
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-latest
1313
name: Serialise runs of this workflow
1414
permissions:
1515
actions: read
@@ -28,7 +28,7 @@ jobs:
2828
env:
2929
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3030
tag:
31-
runs-on: ubuntu-20.04
31+
runs-on: ubuntu-latest
3232
env:
3333
naming-things-is-hard-repository: stackhpc/naming-things-is-hard
3434
name: Automatic tagging for ${{ github.ref_name }} 🏷
@@ -59,7 +59,7 @@ jobs:
5959
run: naming-things-is-hard/os-downstream-tag.py --release $(basename $(git rev-parse --abbrev-ref HEAD))
6060
release:
6161
needs: [tag]
62-
runs-on: ubuntu-20.04
62+
runs-on: ubuntu-latest
6363
name: Release newly generated tag 🏷
6464
steps:
6565
- name: Github checkout 🛎 [${{ github.repository }}]

.github/workflows/tox.yml

Lines changed: 71 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,62 +3,95 @@ name: Tox Workflow
33
'on':
44
workflow_call:
55
jobs:
6-
tox:
7-
runs-on: ubuntu-20.04
8-
strategy:
9-
fail-fast: false
10-
matrix:
11-
environment: [pep8,py3]
12-
python-minor-version: [6,8,10,12]
13-
is-not-python36:
14-
- ${{
6+
7+
define-matrix:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
tox-matrix: ${{ steps.matrix.outputs.tox-matrix }}
11+
steps:
12+
- name: Define Tox matrix
13+
id: matrix
14+
env:
15+
PY3_8: ${{
16+
(github.base_ref == 'stackhpc/yoga') ||
17+
(github.ref == 'refs/heads/stackhpc/yoga') ||
18+
(github.base_ref == 'stackhpc/zed') ||
19+
(github.ref == 'refs/heads/stackhpc/zed') ||
20+
(github.base_ref == 'stackhpc/2023.1') ||
21+
(github.ref == 'refs/heads/stackhpc/2023.1') ||
22+
(((github.base_ref == 'stackhpc/2024.1') ||
23+
(github.ref == 'refs/heads/stackhpc/2024.1')) &&
24+
(github.repository != 'stackhpc/kayobe'))
25+
}}
26+
PY3_10: ${{
1527
(github.base_ref == 'stackhpc/zed') ||
1628
(github.ref == 'refs/heads/stackhpc/zed') ||
1729
(github.base_ref == 'stackhpc/2023.1') ||
1830
(github.ref == 'refs/heads/stackhpc/2023.1') ||
19-
(github.base_ref == 'stackhpc/2023.2') ||
20-
(github.ref == 'refs/heads/stackhpc/2023.2') ||
2131
(github.base_ref == 'stackhpc/2024.1') ||
2232
(github.ref == 'refs/heads/stackhpc/2024.1') ||
2333
(github.base_ref == 'stackhpc/2025.1') ||
2434
(github.ref == 'refs/heads/stackhpc/2025.1') ||
2535
(github.base_ref == 'stackhpc/master') ||
2636
(github.ref == 'refs/heads/stackhpc/master')
27-
}}
28-
is-not-python38:
29-
- ${{
30-
((github.repository == 'stackhpc/kayobe') &&
31-
((github.base_ref == 'stackhpc/2024.1') ||
32-
(github.ref == 'refs/heads/stackhpc/2024.1'))) ||
37+
}}
38+
PY3_12: ${{
3339
(github.base_ref == 'stackhpc/2025.1') ||
3440
(github.ref == 'refs/heads/stackhpc/2025.1') ||
3541
(github.base_ref == 'stackhpc/master') ||
3642
(github.ref == 'refs/heads/stackhpc/master')
37-
}}
38-
is-primarily-python312:
39-
- ${{
43+
}}
44+
PEP8_8: ${{
45+
(github.base_ref == 'stackhpc/yoga') ||
46+
(github.ref == 'refs/heads/stackhpc/yoga')
47+
}}
48+
PEP8_10: ${{
49+
(github.base_ref == 'stackhpc/zed') ||
50+
(github.ref == 'refs/heads/stackhpc/zed') ||
51+
(github.base_ref == 'stackhpc/2023.1') ||
52+
(github.ref == 'refs/heads/stackhpc/2023.1') ||
53+
(github.base_ref == 'stackhpc/2024.1') ||
54+
(github.ref == 'refs/heads/stackhpc/2024.1')
55+
}}
56+
PEP8_12: ${{
4057
(github.base_ref == 'stackhpc/2025.1') ||
4158
(github.ref == 'refs/heads/stackhpc/2025.1') ||
4259
(github.base_ref == 'stackhpc/master') ||
4360
(github.ref == 'refs/heads/stackhpc/master')
44-
}}
45-
exclude:
46-
- environment: pep8
47-
python-minor-version: 6
48-
- is-not-python36: true
49-
python-minor-version: 6
50-
- is-not-python36: true
51-
environment: pep8
52-
python-minor-version: 8
53-
- is-not-python36: false
54-
python-minor-version: 10
55-
- is-not-python38: true
56-
python-minor-version: 8
57-
- is-primarily-python312: true
58-
environment: pep8
59-
python-minor-version: 10
60-
- is-primarily-python312: false
61-
python-minor-version: 12
61+
}}
62+
run: |
63+
# Create a matrix based on the environment and Python minor version
64+
output="["
65+
if [[ $PY3_8 == 'true' ]]; then
66+
output+="{'environment': 'py3', 'python-minor-version': 8},"
67+
fi
68+
if [[ $PY3_10 == 'true' ]]; then
69+
output+="{'environment': 'py3', 'python-minor-version': 10},"
70+
fi
71+
if [[ $PY3_12 == 'true' ]]; then
72+
output+="{'environment': 'py3', 'python-minor-version': 12},"
73+
fi
74+
if [[ $PEP8_8 == 'true' ]]; then
75+
output+="{'environment': 'pep8', 'python-minor-version': 8},"
76+
fi
77+
if [[ $PEP8_10 == 'true' ]]; then
78+
output+="{'environment': 'pep8', 'python-minor-version': 10},"
79+
fi
80+
if [[ $PEP8_12 == 'true' ]]; then
81+
output+="{'environment': 'pep8', 'python-minor-version': 12},"
82+
fi
83+
# remove trailing comma
84+
output="${output%,}"
85+
output+="]"
86+
echo "tox-matrix=$output" >> $GITHUB_OUTPUT
87+
88+
tox:
89+
runs-on: ubuntu-latest
90+
needs: define-matrix
91+
strategy:
92+
fail-fast: false
93+
matrix:
94+
include: ${{ fromJSON(needs.define-matrix.outputs.tox-matrix) }}
6295

6396
name: Tox ${{ matrix.environment }} with Python 3.${{ matrix.python-minor-version }}
6497
steps:

0 commit comments

Comments
 (0)