Skip to content

Commit fa4555d

Browse files
Switch to general build workflow
1 parent cafd966 commit fa4555d

5 files changed

Lines changed: 149 additions & 249 deletions

File tree

.github/workflows/docker/buildwheel.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/docker/shared.env

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/wheels.yml

Lines changed: 23 additions & 219 deletions
Original file line numberDiff line numberDiff line change
@@ -1,237 +1,41 @@
1-
name: Build and test wheels
1+
name: Publish Python release
22

33
on:
44
push:
5-
branches:
6-
- main
7-
- test
8-
tags:
9-
- '*'
5+
branches: [test-publish]
106
release:
117
types: [published]
128

13-
14-
env:
15-
FORCE_COLOR: 1
16-
179
jobs:
18-
OSX:
19-
runs-on: macos-latest
20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
python: [3.11, 3.12, 3.13, 3.14]
24-
steps:
25-
- name: Checkout
26-
uses: actions/checkout@v6.0.2
27-
- name: Set up Python ${{ matrix.python }}
28-
uses: actions/setup-python@v6.1.0
29-
with:
30-
python-version: ${{ matrix.python }}
31-
- name: Install deps
32-
run: |
33-
pip install build
34-
- name: Build Wheel
35-
run: |
36-
cd python
37-
python -m build --wheel --config-setting=--plat-name=macosx_10_9_universal2
38-
- name: Delocate to bundle dynamic libs
39-
run: |
40-
cd python
41-
pip install delocate
42-
delocate-wheel -v dist/*.whl
43-
- name: Upload Wheels
44-
uses: actions/upload-artifact@v6.0.0
45-
with:
46-
name: osx-wheel-${{ matrix.python }}
47-
path: python/dist
10+
build-wheels:
11+
uses: tskit-dev/.github/.github/workflows/build-wheels.yml@main
12+
with:
13+
pyproject-directory: python
4814

49-
windows:
50-
runs-on: windows-latest
51-
strategy:
52-
fail-fast: false
53-
matrix:
54-
python: [3.11, 3.12, 3.13, 3.14]
55-
wordsize: [64]
56-
steps:
57-
- name: Checkout
58-
uses: actions/checkout@v6.0.2
59-
- name: Install deps
60-
env:
61-
PYTHON: "py -${{ matrix.python }}-${{ matrix.wordsize }}"
62-
shell: bash
63-
run: |
64-
set -ex
65-
${PYTHON} -m pip install build
66-
- name: Build Wheel
67-
env:
68-
PYTHON: "py -${{ matrix.python }}-${{ matrix.wordsize }}"
69-
shell: bash
70-
run: |
71-
set -ex
72-
git reset --hard
73-
cd python
74-
${PYTHON} -VV
75-
# For some reason I can't work out the C compiler is not following symlinks
76-
rm -r lib
77-
mkdir lib
78-
cp -r --dereference ../c/subprojects lib/.
79-
cp -r --dereference ../c/tskit lib/.
80-
cp ../c/tskit.h lib/.
81-
${PYTHON} -m build --wheel
82-
- name: Upload Wheels
83-
uses: actions/upload-artifact@v6.0.0
84-
with:
85-
name: win-wheel-${{ matrix.python }}-${{ matrix.wordsize }}
86-
path: python/dist
87-
88-
manylinux:
89-
runs-on: ubuntu-24.04
90-
steps:
91-
- name: Checkout
92-
uses: actions/checkout@v6.0.2
93-
94-
- name: Set up Python 3.11
95-
uses: actions/setup-python@v6.1.0
96-
with:
97-
python-version: 3.11
98-
99-
- name: Build sdist
100-
shell: bash
101-
run: |
102-
cd python
103-
python -m pip install build
104-
python -m build --sdist
105-
106-
- name: Upload sdist
107-
uses: actions/upload-artifact@v6.0.0
108-
with:
109-
name: sdist
110-
path: python/dist
111-
112-
- name: Build wheels in docker
113-
shell: bash
114-
run: |
115-
docker run --rm -v `pwd`:/project -w /project quay.io/pypa/manylinux2014_x86_64 bash .github/workflows/docker/buildwheel.sh
116-
117-
- name: Upload Wheels
118-
uses: actions/upload-artifact@v6.0.0
119-
with:
120-
name: linux-wheels
121-
path: python/dist/wheelhouse
122-
123-
OSX-test:
124-
needs: ['OSX']
125-
strategy:
126-
fail-fast: false
127-
matrix:
128-
python: [3.11, 3.12, 3.13, 3.14]
129-
runner: [macos-15, macos-15-intel]
130-
include:
131-
- runner: macos-15
132-
arch: arm64
133-
- runner: macos-15-intel
134-
arch: x86_64
135-
runs-on: ${{ matrix.runner }}
136-
steps:
137-
- name: Download wheels
138-
uses: actions/download-artifact@v7.0.0
139-
with:
140-
name: osx-wheel-${{ matrix.python }}
141-
- name: Set up Python ${{ matrix.python }}
142-
uses: actions/setup-python@v6.1.0
143-
with:
144-
python-version: ${{ matrix.python }}
145-
- name: Verify architecture
146-
run: |
147-
arch_name=$(uname -m)
148-
echo "Running on architecture: $arch_name"
149-
if [[ "$arch_name" != "${{ matrix.arch }}" ]]; then
150-
echo "Error: Expected ${{ matrix.arch }} but got $arch_name"
151-
exit 1
152-
fi
153-
- name: Install wheel and test
154-
run: |
155-
python -VV
156-
# Install the local wheel
157-
pip install ./tskit-*.whl
158-
python -c "import tskit; import platform; print(f'Running on {platform.machine()} architecture')"
159-
160-
windows-test:
161-
needs: ['windows']
162-
runs-on: windows-latest
163-
strategy:
164-
fail-fast: false
165-
matrix:
166-
python: [3.11, 3.12, 3.13, 3.14]
167-
wordsize: [64]
168-
steps:
169-
- name: Download wheels
170-
uses: actions/download-artifact@v7.0.0
171-
with:
172-
name: win-wheel-${{ matrix.python }}-${{ matrix.wordsize }}
173-
- name: Set up Python ${{ matrix.python }}
174-
uses: actions/setup-python@v6.1.0
175-
with:
176-
python-version: ${{ matrix.python }}
177-
- name: Install wheel and test
178-
shell: bash
179-
run: |
180-
python -VV
181-
# Install the local wheel
182-
python -m pip install *.whl
183-
python -c "import tskit"
184-
185-
manylinux-test:
186-
runs-on: ubuntu-24.04
187-
needs: ['manylinux']
188-
strategy:
189-
fail-fast: false
190-
matrix:
191-
python: [3.11, 3.12, 3.13, 3.14]
192-
include:
193-
- python: 3.11
194-
wheel: cp311
195-
- python: 3.12
196-
wheel: cp312
197-
- python: 3.13
198-
wheel: cp313
199-
- python: 3.14
200-
wheel: cp314
201-
steps:
202-
- name: Download wheels
203-
uses: actions/download-artifact@v7.0.0
204-
with:
205-
name: linux-wheels
206-
- name: Set up Python
207-
uses: actions/setup-python@v6.1.0
208-
with:
209-
python-version: ${{ matrix.python }}
210-
- name: Install wheel and test
211-
run: |
212-
python -VV
213-
# Install the local wheel
214-
pip install ./tskit-*-${{ matrix.wheel }}-*.whl
215-
python -c "import tskit"
216-
217-
PyPI_Upload:
15+
publish:
21816
runs-on: ubuntu-24.04
21917
environment: release
220-
needs: ['windows-test', 'OSX-test', 'manylinux-test']
18+
needs: [ 'build-wheels' ]
22119
permissions:
22220
id-token: write
22321
steps:
224-
- name: Download all
22+
- name: Download artifacts
22523
uses: actions/download-artifact@v7.0.0
226-
- name: Move to dist
227-
run: |
228-
mkdir dist
229-
cp */*.{whl,gz} dist/.
24+
with:
25+
pattern: build-*
26+
path: dist
27+
merge-multiple: true
28+
29+
- name: Show artifacts
30+
run: ls -lah dist
31+
23032
- name: Publish distribution to Test PyPI
231-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && !contains(github.event.ref, 'C_')
33+
if: github.event_name == 'push' && github.ref_name == 'test-publish'
23234
uses: pypa/gh-action-pypi-publish@v1.13.0
23335
with:
234-
repository_url: https://test.pypi.org/legacy/
235-
- name: Publish distribution to PRODUCTION PyPI
236-
if: github.event_name == 'release' && !startsWith(github.event.release.tag_name, 'C_')
36+
repository-url: https://test.pypi.org/legacy/
37+
verbose: true
38+
39+
- name: Publish distribution to Production PyPI
40+
if: github.event_name == 'release'
23741
uses: pypa/gh-action-pypi-publish@v1.13.0

python/pyproject.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ docs = [
9494
"pandas",
9595
]
9696

97+
98+
wheels = [
99+
"cibuildwheel",
100+
]
101+
97102
# Fully pin lint requirements for determinism.
98103
lint = [
99104
"clang-format==21.1.8",
@@ -153,3 +158,15 @@ known-third-party = [
153158
"numpy",
154159
"pytest",
155160
]
161+
162+
[tool.cibuildwheel]
163+
build = ["cp311-*", "cp312-*", "cp313-*", "cp314-*"]
164+
build-frontend = "build"
165+
build-verbosity = 1
166+
test-command = [
167+
"python -c \"import _tskit\"",
168+
"tskit --help",
169+
]
170+
171+
[tool.cibuildwheel.linux]
172+
archs = ["x86_64"]

0 commit comments

Comments
 (0)