@@ -26,62 +26,40 @@ jobs:
26
26
- run : uv run --frozen pyright
27
27
if : success() || failure()
28
28
29
+ # #
30
+
31
+ get-pytorch-versions :
32
+ runs-on : ubuntu-latest
33
+ outputs :
34
+ versions : ${{ steps.get-pytorch-versions.outputs.versions }}
35
+ steps :
36
+ - name : Get PyTorch versions
37
+ id : get-pytorch-versions
38
+ run : |
39
+ VERSIONS=$(
40
+ curl -s https://pypi.org/pypi/torch/json | jq -r '.releases | keys[]' |
41
+ # remove versions <2.0; strip "patch" from versions
42
+ grep -v '^1\.' | grep -E '\.[0]+$' | sort -V | sed 's/\.0$//' |
43
+ # to JSON array
44
+ jq -R . | jq -sc .
45
+ )
46
+ echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
47
+ # e.g. ["2.0","2.1","2.2","2.3","2.4"]
48
+
29
49
test :
30
50
runs-on : ubuntu-latest
51
+ needs : get-pytorch-versions
52
+ strategy :
53
+ fail-fast : false
54
+ matrix :
55
+ python : ["3.9", "3.10", "3.11", "3.12"]
56
+ pytorch : ${{fromJson(needs.get-pytorch-versions.outputs.versions)}}
57
+
31
58
steps :
32
59
- uses : actions/checkout@v4
33
60
-
uses :
astral-sh/[email protected]
34
61
with :
35
62
version : " 0.5.0"
36
- python-version-file : " .python-version"
37
- enable-cache : true
38
- - run : uv sync
39
- - run : uv run --frozen pytest tests/test_ci.py
40
- if : success() || failure()
41
-
42
- # #
43
-
44
- # get-pytorch-versions:
45
- # runs-on: ubuntu-latest
46
- # outputs:
47
- # versions: ${{ steps.get-pytorch-versions.outputs.versions }}
48
- # steps:
49
- # - name: Get PyTorch versions
50
- # id: get-pytorch-versions
51
- # run: |
52
- # VERSIONS=$(
53
- # curl -s https://pypi.org/pypi/torch/json | jq -r '.releases | keys[]' |
54
- # # remove versions <2.0; strip "patch" from versions
55
- # grep -v '^1\.' | grep -E '\.[0]+$' | sort -V | sed 's/\.0$//' |
56
- # # to JSON array
57
- # jq -R . | jq -sc .
58
- # )
59
- # echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
60
- # # e.g. ["2.0","2.1","2.2","2.3","2.4"]
61
-
62
- # test:
63
- # runs-on: ubuntu-latest
64
- # needs: get-pytorch-versions
65
- # strategy:
66
- # fail-fast: false
67
- # matrix:
68
- # python: ["3.9", "3.10", "3.11", "3.12"]
69
- # pytorch: ${{fromJson(needs.get-pytorch-versions.outputs.versions)}}
70
-
71
- # steps:
72
- # - uses: actions/checkout@v4
73
-
74
- # - name: Inject (python / pytorch) test deps into pixi.toml / pyproject.toml
75
- # run: |
76
- # sed -i 's/python = "3.9"/python = "${{ matrix.python }}.*"/' pixi.toml
77
- # sed -i 's/torch>=2.0.0/torch~=${{ matrix.pytorch }}/' pyproject.toml
78
-
79
- # - uses: prefix-dev/[email protected]
80
- # with:
81
- # pixi-version: v0.27.1
82
- # locked: false
83
- # frozen: false
84
- # cache: false
85
- # environments: default
86
- # activate-environment: default
87
- # - run: pytest tests/test_ci.py
63
+ - if : contains('2.0,2.1,2.2', matrix.pytorch)
64
+ run : echo "NUMPY_VERSION='--with numpy<2'" >> $GITHUB_ENV
65
+ - run : uv run --python ${{ matrix.python }} --with torch~=${{ matrix.pytorch }} ${{ env.NUMPY_VERSION }} pytest --verbose tests/test_ci.py
0 commit comments