Skip to content

Commit 6855629

Browse files
committed
Updated workflow to automatically detect python version(s)
1 parent c828b71 commit 6855629

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

.github/workflows/github-actions.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,35 @@ on:
55
pull_request:
66
branches: main
77
jobs:
8+
generate_python_matrix:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
python_versions: ${{ steps.set-matrix.outputs.python_versions }}
12+
min_python_version: ${{ steps.set-matrix.outputs.min_python_version }}
13+
steps:
14+
- name: Checkout STUMPY
15+
uses: actions/checkout@v4
16+
with:
17+
repository: stumpy-dev/stumpy
18+
- name: Upgrade Pip, Install Minimum Requirements
19+
run: |
20+
python -m pip install --upgrade pip pandas lxml packaging
21+
shell: bash
22+
- name: Generate Python versions
23+
id: set-matrix
24+
run: |
25+
MIN_PYTHON=$(python ./versions.py -mode min | grep python | awk '{print $2}')
26+
MAX_PYTHON=$(python ./versions.py -mode max | grep python | awk '{print $2}')
27+
echo "python_versions=$(python ./versions.py -mode range $MIN_PYTHON $MAX_PYTHON)" >> $GITHUB_OUTPUT
28+
echo "min_python_version=$($MIN_PYTHON)" >> $GITHUB_OUTPUT
29+
shell: bash
830
minimum-version-testing:
31+
needs: generate_python_matrix:
932
runs-on: ${{ matrix.os }}
1033
strategy:
1134
matrix:
1235
os: [ubuntu-latest, macos-latest, windows-latest]
13-
python-version: ['3.10']
36+
python-version: ${{ fromJSON(needs.generate_python_matrix.outputs.min_python_version) }}
1437
steps:
1538
- uses: actions/checkout@v4
1639
- name: Set Up Python
@@ -59,11 +82,12 @@ jobs:
5982
run: ./test.sh unit
6083
shell: bash
6184
unit-testing:
85+
needs: generate_python_matrix
6286
runs-on: ${{ matrix.os }}
6387
strategy:
6488
matrix:
6589
os: [ubuntu-latest, macos-latest, windows-latest]
66-
python-version: ['3.10', '3.11', '3.12', '3.13']
90+
python-version: ${{ fromJSON(needs.generate_python_matrix.outputs.python_versions) }}
6791
steps:
6892
- uses: actions/checkout@v4
6993
- name: Set Up Python
@@ -106,11 +130,12 @@ jobs:
106130
run: ./test.sh unit
107131
shell: bash
108132
coverage-testing:
133+
needs: generate_python_matrix
109134
runs-on: ${{ matrix.os }}
110135
strategy:
111136
matrix:
112137
os: [ubuntu-latest, macos-latest, windows-latest]
113-
python-version: ['3.10', '3.11', '3.12', '3.13']
138+
python-version: ${{ fromJSON(needs.generate_python_matrix.outputs.python_versions) }}
114139
steps:
115140
- uses: actions/checkout@v4
116141
- name: Set Up Python

0 commit comments

Comments
 (0)