Skip to content

Commit 6d1191a

Browse files
deps(workflows): bump actions/{upload,download}-artifact from 3 to 4 (#200)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Xuehai Pan <[email protected]>
1 parent 2769849 commit 6d1191a

File tree

2 files changed

+55
-37
lines changed

2 files changed

+55
-37
lines changed

.github/workflows/build.yml

Lines changed: 52 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
TORCHOPT_NO_EXTENSIONS: "true"
7979

8080
- name: Upload artifact
81-
uses: actions/upload-artifact@v3
81+
uses: actions/upload-artifact@v4
8282
with:
8383
name: build
8484
path: dist/*
@@ -97,12 +97,13 @@ jobs:
9797
make pytest
9898
9999
build-wheels-py38:
100-
name: Build wheels for Python ${{ matrix.python-version }} on ubuntu-latest
101-
runs-on: ubuntu-latest
100+
name: Build wheels for Python ${{ matrix.python-version }} on ${{ matrix.os }}
101+
runs-on: ${{ matrix.os }}
102102
needs: [build]
103103
if: github.repository == 'metaopt/torchopt' && (github.event_name != 'push' || startsWith(github.ref, 'refs/tags/'))
104104
strategy:
105105
matrix:
106+
os: [ubuntu-latest]
106107
python-version: ["3.8"] # sync with requires-python in pyproject.toml
107108
fail-fast: false
108109
timeout-minutes: 60
@@ -140,19 +141,20 @@ jobs:
140141
output-dir: wheelhouse
141142
config-file: "{package}/pyproject.toml"
142143

143-
- uses: actions/upload-artifact@v3
144+
- uses: actions/upload-artifact@v4
144145
with:
145-
name: wheels-py38
146+
name: wheels-${{ matrix.python-version }}-${{ matrix.os }}
146147
path: wheelhouse/*.whl
147148
if-no-files-found: error
148149

149150
build-wheels:
150-
name: Build wheels for Python ${{ matrix.python-version }} on ubuntu-latest
151-
runs-on: ubuntu-latest
151+
name: Build wheels for Python ${{ matrix.python-version }} on ${{ matrix.os }}
152+
runs-on: ${{ matrix.os }}
152153
needs: [build, build-wheels-py38]
153154
if: github.repository == 'metaopt/torchopt' && (github.event_name != 'push' || startsWith(github.ref, 'refs/tags/'))
154155
strategy:
155156
matrix:
157+
os: [ubuntu-latest]
156158
python-version: ["3.9", "3.10", "3.11"] # sync with requires-python in pyproject.toml
157159
fail-fast: false
158160
timeout-minutes: 60
@@ -190,15 +192,47 @@ jobs:
190192
output-dir: wheelhouse
191193
config-file: "{package}/pyproject.toml"
192194

193-
- uses: actions/upload-artifact@v3
195+
- uses: actions/upload-artifact@v4
194196
with:
195-
name: wheels
197+
name: wheels-${{ matrix.python-version }}-${{ matrix.os }}
196198
path: wheelhouse/*.whl
197199
if-no-files-found: error
198200

199-
publish:
201+
list-artifacts:
202+
name: List artifacts
200203
runs-on: ubuntu-latest
201204
needs: [build, build-wheels-py38, build-wheels]
205+
if: github.repository == 'metaopt/torchopt' && (github.event_name != 'push' || startsWith(github.ref, 'refs/tags/'))
206+
timeout-minutes: 15
207+
steps:
208+
- name: Download built sdist
209+
uses: actions/download-artifact@v4
210+
with:
211+
# unpacks default artifact into dist/
212+
# if `name: artifact` is omitted, the action will create extra parent dir
213+
name: build
214+
path: dist
215+
216+
- name: Download built wheels
217+
uses: actions/download-artifact@v4
218+
with:
219+
pattern: wheels-*
220+
path: dist
221+
merge-multiple: true
222+
223+
- name: List distributions
224+
run: ls -lh dist/*
225+
226+
- name: Upload artifacts
227+
uses: actions/upload-artifact@v4
228+
with:
229+
name: artifacts
230+
path: dist/*
231+
if-no-files-found: error
232+
233+
publish:
234+
runs-on: ubuntu-latest
235+
needs: [list-artifacts]
202236
if: |
203237
github.repository == 'metaopt/torchopt' && github.event_name != 'pull_request' &&
204238
(github.event_name != 'workflow_dispatch' || github.event.inputs.task == 'build-and-publish') &&
@@ -236,28 +270,12 @@ jobs:
236270
exit 1
237271
fi
238272
239-
- name: Download built sdist
240-
uses: actions/download-artifact@v3
241-
with:
242-
# unpacks default artifact into dist/
243-
# if `name: artifact` is omitted, the action will create extra parent dir
244-
name: build
245-
path: dist
246-
247-
- name: Download built wheels
248-
uses: actions/download-artifact@v3
249-
with:
250-
# unpacks default artifact into dist/
251-
# if `name: artifact` is omitted, the action will create extra parent dir
252-
name: wheels-py38
253-
path: dist
254-
255-
- name: Download built wheels
256-
uses: actions/download-artifact@v3
273+
- name: Download built artifacts
274+
uses: actions/download-artifact@v4
257275
with:
258276
# unpacks default artifact into dist/
259277
# if `name: artifact` is omitted, the action will create extra parent dir
260-
name: wheels
278+
name: artifacts
261279
path: dist
262280

263281
- name: List distributions
@@ -269,10 +287,10 @@ jobs:
269287
with:
270288
user: __token__
271289
password: ${{ secrets.TESTPYPI_UPLOAD_TOKEN }}
272-
repository_url: https://test.pypi.org/legacy/
290+
repository-url: https://test.pypi.org/legacy/
273291
verbose: true
274-
print_hash: true
275-
skip_existing: true
292+
print-hash: true
293+
skip-existing: true
276294

277295
- name: Publish to PyPI
278296
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
@@ -281,5 +299,5 @@ jobs:
281299
user: __token__
282300
password: ${{ secrets.PYPI_UPLOAD_TOKEN }}
283301
verbose: true
284-
print_hash: true
285-
skip_existing: true
302+
print-hash: true
303+
skip-existing: true

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ repos:
3030
hooks:
3131
- id: clang-format
3232
- repo: https://github.com/astral-sh/ruff-pre-commit
33-
rev: v0.1.7
33+
rev: v0.1.8
3434
hooks:
3535
- id: ruff
3636
args: [--fix, --exit-non-zero-on-fix]
3737
- repo: https://github.com/PyCQA/isort
38-
rev: 5.13.0
38+
rev: 5.13.2
3939
hooks:
4040
- id: isort
4141
- repo: https://github.com/psf/black
42-
rev: 23.11.0
42+
rev: 23.12.0
4343
hooks:
4444
- id: black-jupyter
4545
- repo: https://github.com/asottile/pyupgrade

0 commit comments

Comments
 (0)