|
1 | | -name: Binary wheels |
| 1 | +name: Publish Python release |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: |
6 | | - - main |
7 | | - - test |
8 | | - tags: |
9 | | - - '*' |
| 5 | + branches: [test-publish] |
10 | 6 | release: |
11 | 7 | types: [published] |
12 | 8 |
|
13 | 9 | jobs: |
14 | | - OSX: |
15 | | - name: Build ${{ matrix.os }} - ${{ matrix.python }} |
16 | | - runs-on: ${{ matrix.os }} |
17 | | - strategy: |
18 | | - matrix: |
19 | | - os: [macos-15-intel, macos-14, macos-15, macos-26] |
20 | | - python: [3.11, 3.12, 3.13, 3.14] |
21 | | - steps: |
22 | | - - name: Checkout |
23 | | - uses: actions/checkout@v6.0.2 |
24 | | - with: |
25 | | - submodules: true |
26 | | - - name: Set up Python ${{ matrix.python }} |
27 | | - uses: actions/setup-python@v6.1.0 |
28 | | - with: |
29 | | - python-version: ${{ matrix.python }} |
30 | | - - name: Install deps |
31 | | - run: | |
32 | | - brew install gsl |
33 | | - python -m pip install --upgrade pip build |
34 | | - - name: Build Wheel (arm64) |
35 | | - if: matrix.os != 'macos-15-intel' |
36 | | - run: | |
37 | | - export PLAT="arm64" |
38 | | - export _PYTHON_HOST_PLATFORM="macosx-11.0-arm64" |
39 | | - export CFLAGS+=" -arch arm64" |
40 | | - export CXXFLAGS+=" -arch arm64" |
41 | | - export ARCHFLAGS=$OLDARCHFLAGS |
42 | | - export ARCHFLAGS+=" -arch arm64" |
43 | | - export CPPFLAGS+=" -arch arm64" |
44 | | - export LDFLAGS+=" -arch arm64" |
45 | | - python -m build --wheel |
46 | | - - name: Build Wheel (x86_64) |
47 | | - if: matrix.os == 'macos-15-intel' |
48 | | - run: | |
49 | | - export PLAT="x86_64" |
50 | | - export _PYTHON_HOST_PLATFORM="macosx-11.0-x86_64" |
51 | | - export CFLAGS+=" -arch x86_64" |
52 | | - export CXXFLAGS+=" -arch x86_64" |
53 | | - export ARCHFLAGS=$OLDARCHFLAGS |
54 | | - export ARCHFLAGS+=" -arch x86_64" |
55 | | - export CPPFLAGS+=" -arch x86_64" |
56 | | - export LDFLAGS+=" -arch x86_64" |
57 | | - python -m build --wheel |
58 | | - - name: Delocate to bundle dynamic libs |
59 | | - run: | |
60 | | - python -m pip install delocate |
61 | | - delocate-wheel -v dist/*.whl |
62 | | - - name: Upload Wheels |
63 | | - uses: actions/upload-artifact@v6.0.0 |
64 | | - with: |
65 | | - name: osx-wheel-${{ matrix.os }}-${{ matrix.python }} |
66 | | - path: dist |
67 | | - |
68 | | - Windows: |
69 | | - name: Build Windows - ${{ matrix.python }} |
70 | | - runs-on: windows-latest |
71 | | - strategy: |
72 | | - matrix: |
73 | | - python: [3.11, 3.12, 3.13, 3.14] |
74 | | - arch: [x64] |
75 | | - steps: |
76 | | - - name: Checkout |
77 | | - uses: actions/checkout@v6.0.2 |
78 | | - with: |
79 | | - submodules: true |
80 | | - - name: Set up Python ${{ matrix.python }} |
81 | | - uses: actions/setup-python@v6.1.0 |
82 | | - with: |
83 | | - python-version: ${{ matrix.python }} |
84 | | - architecture: ${{ matrix.arch }} |
85 | | - - name: Install GSL via vcpkg |
86 | | - run: | |
87 | | - vcpkg install gsl:${{ matrix.arch }}-windows |
88 | | - shell: cmd |
89 | | - - name: Install deps |
90 | | - run: | |
91 | | - python -m pip install --upgrade pip build delvewheel |
92 | | - - name: Fix windows symlinks |
93 | | - run: | |
94 | | - if (Test-Path "lwt_interface") { Remove-Item -Recurse -Force "lwt_interface" } |
95 | | - Copy-Item -Recurse "git-submodules/tskit/python/lwt_interface" "./lwt_interface" |
96 | | - shell: powershell |
97 | | - - name: Build Wheel |
98 | | - run: | |
99 | | - # The symlink fix above confuses setuptools_scm |
100 | | - $tag = git describe --tags --exact-match HEAD 2>$null |
101 | | - if ($tag) { |
102 | | - $env:SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MSPRIME = $tag |
103 | | - } |
104 | | - python -m build --wheel |
105 | | - - name: Bundle dynamic libs |
106 | | - run: | |
107 | | - $vcpkgRoot = $env:VCPKG_INSTALLATION_ROOT |
108 | | - if (-not $vcpkgRoot) { $vcpkgRoot = "C:\vcpkg" } |
109 | | - $gslBinPath = Join-Path $vcpkgRoot "installed\x64-windows\bin" |
110 | | - $env:PATH = "$gslBinPath;$env:PATH" |
111 | | - delvewheel repair dist/*.whl -w dist/ --add-path "$gslBinPath" |
112 | | - shell: powershell |
113 | | - - name: Upload Wheels |
114 | | - uses: actions/upload-artifact@v6.0.0 |
115 | | - with: |
116 | | - name: win-wheel-${{ matrix.python }} |
117 | | - path: dist |
118 | | - |
119 | | - manylinux: |
120 | | - runs-on: ubuntu-24.04 |
121 | | - steps: |
122 | | - - name: Checkout |
123 | | - uses: actions/checkout@v6.0.2 |
124 | | - with: |
125 | | - submodules: true |
126 | | - - name: Set up Python 3.11 |
127 | | - uses: actions/setup-python@v6.1.0 |
128 | | - with: |
129 | | - python-version: "3.11" |
130 | | - - name: Build sdist |
131 | | - shell: bash |
132 | | - run: | |
133 | | - python -m pip install --upgrade pip build |
134 | | - python -m build --sdist |
135 | | - - name: Upload sdist |
136 | | - uses: actions/upload-artifact@v6.0.0 |
137 | | - with: |
138 | | - name: sdist |
139 | | - path: dist |
140 | | - - name: Build wheels in docker |
141 | | - shell: bash |
142 | | - run: | |
143 | | - docker run --rm -v `pwd`:/project -w /project quay.io/pypa/manylinux2014_x86_64 bash .github/workflows/docker/buildwheel.sh |
144 | | -
|
145 | | - - name: Upload Wheels |
146 | | - uses: actions/upload-artifact@v6.0.0 |
147 | | - with: |
148 | | - name: linux-wheels |
149 | | - path: dist/wheelhouse |
150 | | - |
151 | | - OSX-test: |
152 | | - name: Test ${{ matrix.os }} - ${{ matrix.python }} |
153 | | - needs: ['OSX'] |
154 | | - runs-on: ${{ matrix.os }} |
155 | | - strategy: |
156 | | - matrix: |
157 | | - os: [macos-15-intel, macos-14, macos-15, macos-26] |
158 | | - python: [3.11, 3.12, 3.13, 3.14] |
159 | | - steps: |
160 | | - - name: Download wheels |
161 | | - uses: actions/download-artifact@v7.0.0 |
162 | | - with: |
163 | | - name: osx-wheel-${{ matrix.os }}-${{ matrix.python }} |
164 | | - - name: Set up Python ${{ matrix.python }} |
165 | | - uses: actions/setup-python@v6.1.0 |
166 | | - with: |
167 | | - python-version: ${{ matrix.python }} |
168 | | - - name: Install wheel and test |
169 | | - run: | |
170 | | - python -VV |
171 | | - # Install the local wheel |
172 | | - python -m pip install numpy newick>=1.3.0 tskit>=0.5.2 demes>=0.2 |
173 | | - python -m pip install msprime --no-index --only-binary msprime -f . |
174 | | - python -c "import msprime" |
175 | | - msp simulate 10 tmp.trees |
176 | | - tskit info tmp.trees |
177 | | - tskit provenances tmp.trees |
| 10 | + build-wheels: |
| 11 | + uses: tskit-dev/.github/.github/workflows/build-wheels.yml@main |
| 12 | + # with: |
| 13 | + # os-list: '["windows-2025"]' #, "ubuntu-24.04"]' |
178 | 14 |
|
179 | | - manylinux-test: |
180 | | - runs-on: ubuntu-24.04 |
181 | | - needs: ['manylinux'] |
182 | | - strategy: |
183 | | - matrix: |
184 | | - python: [3.11, 3.12, 3.13, 3.14] |
185 | | - steps: |
186 | | - - name: Download wheels |
187 | | - uses: actions/download-artifact@v7.0.0 |
188 | | - with: |
189 | | - name: linux-wheels |
190 | | - - name: Set up Python |
191 | | - uses: actions/setup-python@v6.1.0 |
192 | | - with: |
193 | | - python-version: ${{ matrix.python }} |
194 | | - - name: Install wheel and test |
195 | | - run: | |
196 | | - python -VV |
197 | | - # Install the local wheel |
198 | | - python -m pip install numpy newick demes |
199 | | - python -m pip install --no-dependencies msprime --no-index --only-binary msprime -f . |
200 | | - python -m pip install tskit |
201 | | - python -c "import msprime" |
202 | | - msp simulate 10 tmp.trees |
203 | | - tskit info tmp.trees |
204 | | - tskit provenances tmp.trees |
205 | | -
|
206 | | -
|
207 | | - Windows-test: |
208 | | - runs-on: windows-latest |
209 | | - needs: ['Windows'] |
210 | | - strategy: |
211 | | - matrix: |
212 | | - python: [3.11, 3.12, 3.13, 3.14] |
213 | | - steps: |
214 | | - - name: Download wheels |
215 | | - uses: actions/download-artifact@v7.0.0 |
216 | | - with: |
217 | | - name: win-wheel-${{ matrix.python }} |
218 | | - - name: Set up Python ${{ matrix.python }} |
219 | | - uses: actions/setup-python@v6.1.0 |
220 | | - with: |
221 | | - python-version: ${{ matrix.python }} |
222 | | - - name: Install wheel and test |
223 | | - run: | |
224 | | - python -VV |
225 | | - python -m pip install numpy newick>=1.3.0 tskit>=0.5.2 demes>=0.2 |
226 | | - python -m pip install msprime --no-index --only-binary msprime -f . |
227 | | - python -c "import msprime" |
228 | | - msp simulate 10 tmp.trees |
229 | | - tskit info tmp.trees |
230 | | - tskit provenances tmp.trees |
231 | | -
|
232 | | - PyPI_Upload: |
| 15 | + publish: |
233 | 16 | runs-on: ubuntu-24.04 |
234 | 17 | environment: release |
235 | | - needs: ['OSX-test', 'manylinux-test', 'Windows-test'] |
| 18 | + needs: [ 'build-wheels' ] |
236 | 19 | permissions: |
237 | 20 | id-token: write |
238 | 21 | steps: |
239 | | - - name: Download all |
| 22 | + - name: Download artifacts |
240 | 23 | uses: actions/download-artifact@v7.0.0 |
241 | | - - name: Move to dist |
242 | | - run: | |
243 | | - mkdir dist |
244 | | - cp */*.{whl,gz} dist/. |
245 | | - # Windows wheels have different naming pattern |
246 | | - if [ -d "win-wheel"* ]; then cp win-wheel*/*.whl dist/. || true; fi |
| 24 | + with: |
| 25 | + pattern: build-* |
| 26 | + path: dist |
| 27 | + merge-multiple: true |
| 28 | + |
| 29 | + - name: Show artifacts |
| 30 | + run: ls -lah dist |
| 31 | + |
247 | 32 | - name: Publish distribution to Test PyPI |
248 | | - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 33 | + if: github.event_name == 'push' && github.ref_name == 'test-publish' |
249 | 34 | uses: pypa/gh-action-pypi-publish@v1.13.0 |
250 | 35 | with: |
251 | | - repository_url: https://test.pypi.org/legacy/ |
252 | | - - name: Publish distribution to PRODUCTION PyPI |
| 36 | + repository-url: https://test.pypi.org/legacy/ |
| 37 | + verbose: true |
| 38 | + |
| 39 | + - name: Publish distribution to Production PyPI |
253 | 40 | if: github.event_name == 'release' |
254 | 41 | uses: pypa/gh-action-pypi-publish@v1.13.0 |
0 commit comments