Skip to content

Commit c2ad941

Browse files
andifejustinchuby
andauthored
Update build-and-test.yml (#235)
Signed-off-by: Andreas Fehlner <[email protected]> Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Justin Chu <[email protected]>
1 parent f55423a commit c2ad941

File tree

2 files changed

+56
-20
lines changed

2 files changed

+56
-20
lines changed

.github/workflows/build-and-test.yml

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ jobs:
5353
pip install abi3audit
5454
abi3audit --strict -v --report ./wheelhouse/*.whl
5555
if: ${{ contains(fromJSON('["cp312", "cp313"]'), matrix.python) }}
56-
- uses: actions/upload-artifact@v5
56+
- uses: actions/upload-artifact@v6
5757
with:
58-
name: artifact-${{ matrix.os }}-${{ matrix.python }}
58+
name: wheels-${{ matrix.os }}-${{ matrix.python }}
5959
path: ./wheelhouse/*.whl
6060

6161
build_sdist:
@@ -78,28 +78,68 @@ jobs:
7878
7979
- uses: actions/upload-artifact@v6
8080
with:
81+
name: sdist
8182
path: dist/*.tar.gz
8283

84+
collect_dist:
85+
name: Collect distributions
86+
runs-on: ubuntu-latest
87+
needs: [build_wheels, build_sdist]
88+
89+
steps:
90+
- name: Download wheels
91+
uses: actions/download-artifact@v7
92+
with:
93+
pattern: wheels-*
94+
path: dist
95+
merge-multiple: true
96+
97+
- name: Download sdist
98+
uses: actions/download-artifact@v7
99+
with:
100+
name: sdist
101+
path: dist
102+
103+
- name: Verify distributions
104+
run: |
105+
echo "Wheels:"
106+
ls -lh dist/*.whl
107+
echo
108+
echo "Source distributions:"
109+
ls -lh dist/*.tar.gz
110+
111+
- name: Twine check
112+
run: |
113+
pip install -U twine packaging
114+
twine check dist/*
115+
116+
- name: Upload merged dist
117+
uses: actions/upload-artifact@v6
118+
with:
119+
name: dist
120+
path: dist/*
121+
83122
release:
84123
name: Release
85-
environment:
86-
name: release
87-
url: https://pypi.org/p/onnxoptimizer
88124
runs-on: ubuntu-latest
125+
needs: collect_dist
126+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
127+
89128
permissions:
90129
id-token: write
91-
92-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
93-
needs: [build_wheels, build_sdist]
130+
131+
environment:
132+
name: release
133+
url: https://pypi.org/p/onnxoptimizer
134+
94135
steps:
95-
- uses: actions/download-artifact@v7
136+
- name: Download distributions
137+
uses: actions/download-artifact@v7
96138
with:
97-
name: artifact
139+
name: dist
98140
path: dist
99-
100-
- name: Publish distribution 📦 to PyPI
101-
if: startsWith(github.ref, 'refs/tags/v')
141+
142+
- name: Publish to PyPI
102143
uses: pypa/gh-action-pypi-publish@release/v1
103144
with:
104-
repository-url: https://upload.pypi.org/legacy/
105145
attestations: true

pyproject.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
dynamic = ["version"]
77
name = "onnxoptimizer"
88
description = "ONNX Optimizer"
9-
license = 'Apache-2.0'
10-
license-files = [
11-
"LICENSE"
12-
]
9+
license = "Apache-2.0"
1310
authors = [
1411
{name = 'ONNX Optimizer Authors', email = "[email protected]"},
1512
]
@@ -38,13 +35,12 @@ requires = [
3835
build-backend = "setuptools.build_meta"
3936

4037
[tool.pytest.ini_options]
41-
# addopts = --nbval --current-env
4238
addopts = "-n auto"
4339
testpaths = [
4440
"onnxoptimizer/test/"
4541
]
4642

47-
[[tool.mypy]]
43+
[tool.mypy]
4844
# follow-imports = silent # TODO remove this
4945
mypy_path = "stubs:third_party/onnx/third_party/pybind11"
5046
strict_optional = true

0 commit comments

Comments
 (0)