Skip to content

Commit 77ae65d

Browse files
authored
Automatically generate pytorch versions for testing
1 parent 6702522 commit 77ae65d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/workflows/main.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,25 @@ jobs:
4343

4444
##
4545

46+
get-pytorch-versions:
47+
runs-on: ubuntu-latest
48+
outputs:
49+
pytorch-versions: ${{ steps.get-pytorch-versions.outputs.versions }}
50+
steps:
51+
- name: Get PyTorch versions
52+
id: get-pytorch-versions
53+
run: |
54+
VERSIONS=($(curl -s https://pypi.org/pypi/torch/json | jq -r '.releases | keys[]' | grep -v '^1\.' | grep -E '\.[0]+$' | sort -rV | sed 's/\.0$//') | jq -R . | jq -sc .)
55+
echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
56+
4657
test:
4758
runs-on: ubuntu-latest
59+
needs: get-pytorch-versions
4860
strategy:
4961
fail-fast: false
5062
matrix:
5163
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
52-
pytorch: ["2.0", "2.1", "2.2", "2.3", "2.4"]
64+
pytorch: ${{fromJson(needs.get-pytorch-versions.outputs.versions)}}
5365

5466
steps:
5567
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)