Skip to content

Commit d56718f

Browse files
committed
add twine check
1 parent 40f325d commit d56718f

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

.github/workflows/wheels.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,36 +71,38 @@ jobs:
7171
run: |
7272
python -m cibuildwheel --output-dir wheelhouse
7373
74-
# Verify wheels before upload.
75-
- name: Verify wheels before upload
74+
# Copy wheels to artifact.
75+
- name: Copy wheels to artifact
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: wheels-${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.python }}
79+
path: ./wheelhouse/*.whl
80+
81+
- name: Verify wheels
7682
run: |
83+
pip install twine
7784
python -c "
7885
import zipfile
7986
import glob
8087
for wheel in glob.glob('./wheelhouse/*.whl'):
8188
try:
8289
with zipfile.ZipFile(wheel, 'r') as zf:
8390
zf.testzip()
84-
print(f'✓ {wheel} is valid')
91+
print(f'✓ {wheel} is valid ZIP')
8592
except Exception as e:
8693
print(f'✗ {wheel} is corrupted: {e}')
8794
exit(1)
8895
"
89-
90-
# Copy wheels to artifact.
91-
- name: Copy wheels to artifact
92-
uses: actions/upload-artifact@v4
93-
with:
94-
name: wheels-${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.python }}
95-
path: ./wheelhouse/*.whl
96-
96+
echo "twine check wheels..."
97+
twine check --strict ./wheelhouse/*.whl
9798
9899
upload_pypi:
99100
name: Upload wheels to PyPI
100101
runs-on: ubuntu-latest
101102
if: ${{ github.event.inputs.upload == '1'}}
102103
needs: [wheels]
103104
environment: pypi
105+
verbose: true
104106

105107
steps:
106108
- uses: actions/download-artifact@v4
@@ -112,6 +114,7 @@ jobs:
112114
# Verify downloaded wheels before upload.
113115
- name: Verify downloaded wheels
114116
run: |
117+
pip install twine
115118
python -c "
116119
import zipfile
117120
import glob
@@ -121,11 +124,13 @@ jobs:
121124
with zipfile.ZipFile(wheel, 'r') as zf:
122125
zf.testzip()
123126
size = os.path.getsize(wheel)
124-
print(f'✓ {wheel} is valid ({size:,} bytes)')
127+
print(f'✓ {wheel} is valid ZIP ({size:,} bytes)')
125128
except Exception as e:
126129
print(f'✗ {wheel} is corrupted: {e}')
127130
exit(1)
128131
"
132+
echo "twine check wheels..."
133+
twine check --strict dist/*.whl
129134
130135
- uses: pypa/gh-action-pypi-publish@v1.13.0
131136
with:

0 commit comments

Comments
 (0)