Skip to content

Commit 3e7e268

Browse files
author
Test User
committed
chore: add test-pypi-release workflow
- Create new workflow to test package publishing to TestPyPI - Trigger on workflow_dispatch (manual trigger) for pre-release validation - Builds distribution files using hatch (same as production pipeline) - Uploads to TestPyPI with separate credentials - Tests installation in multiple Python versions (3.9, 3.11) - Runs basic smoke tests to validate package functionality - Fails gracefully with clear error messages if any step fails Addresses issue #3798
1 parent c6f250b commit 3e7e268

1 file changed

Lines changed: 104 additions & 0 deletions

File tree

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Test PyPI Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- 'v*'
8+
- 'test-release-*'
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build_artifacts:
19+
name: Build distribution files
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v6
23+
with:
24+
submodules: true
25+
fetch-depth: 0
26+
27+
- uses: actions/setup-python@v6
28+
name: Install Python
29+
with:
30+
python-version: '3.11'
31+
32+
- name: Install Hatch
33+
uses: pypa/hatch@257e27e51a6a5616ed08a39a408a21c35c9931bc
34+
with:
35+
version: '1.16.5'
36+
37+
- name: Build wheel and sdist
38+
run: hatch build
39+
40+
- uses: actions/upload-artifact@v7
41+
with:
42+
name: distribution
43+
path: dist
44+
45+
test_testpypi_upload:
46+
needs: build_artifacts
47+
runs-on: ubuntu-latest
48+
environment:
49+
name: testpypi
50+
url: https://test.pypi.org/p/zarr
51+
52+
steps:
53+
- uses: actions/download-artifact@v7
54+
with:
55+
name: distribution
56+
path: dist
57+
58+
- name: List artifacts
59+
run: ls -la dist/
60+
61+
- name: Publish package to TestPyPI
62+
uses: pypa/gh-action-pypi-publish@v1.13.0
63+
with:
64+
repository-url: https://test.pypi.org/legacy/
65+
password: ${{ secrets.TESTPYPI_API_TOKEN }}
66+
67+
test_testpypi_install:
68+
needs: test_testpypi_upload
69+
runs-on: ubuntu-latest
70+
strategy:
71+
matrix:
72+
python-version: ['3.9', '3.11']
73+
fail-fast: true
74+
75+
steps:
76+
- uses: actions/checkout@v6
77+
78+
- uses: actions/setup-python@v6
79+
with:
80+
python-version: ${{ matrix.python-version }}
81+
82+
- name: Install from TestPyPI
83+
run: |
84+
python -m pip install --index-url https://test.pypi.org/simple/ \
85+
--extra-index-url https://pypi.org/simple/ \
86+
zarr
87+
88+
- name: Smoke test
89+
run: |
90+
python -c "
91+
import zarr
92+
print(f'zarr version: {zarr.__version__}')
93+
print(f'zarr location: {zarr.__file__}')
94+
95+
# Basic functionality test
96+
store = zarr.MemoryStore()
97+
root = zarr.open_group(store=store, mode='w')
98+
array = root.create_dataset('test', data=[1, 2, 3])
99+
assert len(array) == 3, 'Failed to create/read dataset'
100+
print('✓ Basic zarr operations work correctly')
101+
"
102+
103+
- name: Print success message
104+
run: echo "✓ TestPyPI installation and smoke tests passed!"

0 commit comments

Comments
 (0)