Skip to content

Commit 2a08afd

Browse files
authored
Update main.yml
1 parent d87bb91 commit 2a08afd

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,14 @@ jobs:
5252
id: get-pytorch-versions
5353
run: |
5454
VERSIONS=$(
55-
curl -s https://pypi.org/pypi/torch/json | jq -r '.releases | keys[]' | # get versions
56-
grep -v '^1\.' | grep -E '\.[0]+$' | sort -rV | sed 's/\.0$//' | # remove versions <2.0; strip "patch" from versions
57-
jq -R . | jq -sc . # to JSON array
55+
curl -s https://pypi.org/pypi/torch/json | jq -r '.releases | keys[]' |
56+
# remove versions <2.0; strip "patch" from versions
57+
grep -v '^1\.' | grep -E '\.[0]+$' | sort -V | sed 's/\.0$//' |
58+
# to JSON array
59+
jq -R . | jq -sc .
5860
)
5961
echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
62+
# e.g. ["2.0","2.1","2.2","2.3","2.4"]
6063
6164
test:
6265
runs-on: ubuntu-latest
@@ -70,19 +73,18 @@ jobs:
7073
steps:
7174
- uses: actions/checkout@v4
7275

73-
- name: Inject (python, pytorch) test dependencies into pixi.toml
76+
- name: Inject (python / pytorch) test deps into pixi.toml / pyproject.toml
7477
run: |
7578
sed -i 's/python = "3.8.1"/python = "${{ matrix.python }}.*"/' pixi.toml
76-
sed -i '/\[feature\.package\]/i [feature.test.pypi-dependencies]\ntorch = "~=${{ matrix.pytorch }}"\n' pixi.toml
77-
sed -i '/\[environments\]/a test = { features = ["package", "dev", "test"], solve-group = "default" }' pixi.toml
79+
sed -i 's/torch>=2.0.0/torch~=${{ matrix.pytorch }}/' pyproject.toml
7880
7981
- uses: prefix-dev/[email protected]
8082
with:
8183
pixi-version: v0.27.1
8284
locked: false
8385
frozen: false
8486
cache: false
85-
environments: test
86-
activate-environment: test
87+
environments: default
88+
activate-environment: default
8789

8890
- run: pytest tests

0 commit comments

Comments
 (0)