-
Notifications
You must be signed in to change notification settings - Fork 34
304 lines (262 loc) · 9.38 KB
/
wheels.yml
File metadata and controls
304 lines (262 loc) · 9.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
name: Build Python Wheels
on:
push:
branches: [ main, python ]
tags:
- 'v*'
pull_request:
branches: [ main ]
paths:
- 'python-kalign/**'
- 'lib/**'
- 'CMakeLists.txt'
- 'pyproject.toml'
- '.github/workflows/wheels.yml'
workflow_dispatch:
inputs:
publish_target:
description: "Publish target (manual runs only)"
required: true
default: "none"
type: choice
options:
- none
- testpypi
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }} (${{ matrix.cibw_archs }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
cibw_archs: "x86_64"
- os: macos-14
cibw_archs: "x86_64"
- os: macos-14
cibw_archs: "arm64"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel build
- name: Build wheels
env:
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* cp313-*
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
# Set minimum macOS version to match OpenMP requirements
CIBW_ENVIRONMENT_MACOS: >
CMAKE_BUILD_PARALLEL_LEVEL=2
OMP_NUM_THREADS=1
MACOSX_DEPLOYMENT_TARGET=14.0
CMAKE_OSX_DEPLOYMENT_TARGET=14.0
# Linux specific settings - handle different package managers
CIBW_BEFORE_ALL_LINUX: >
(yum install -y cmake3) ||
(apt-get update && apt-get install -y cmake) ||
(apk add --no-cache cmake)
CIBW_REPAIR_WHEEL_COMMAND_LINUX: auditwheel repair -w {dest_dir} {wheel}
# macOS specific settings
CIBW_BEFORE_ALL_MACOS: |
brew install --formula cmake libomp || echo "Dependencies may already be installed"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
# Environment variables for builds
CIBW_ENVIRONMENT: >
CMAKE_BUILD_PARALLEL_LEVEL=2
OMP_NUM_THREADS=1
# Skip testing during wheel build to avoid cross-compilation issues
CIBW_TEST_SKIP: "*"
run: |
python -m cibuildwheel --output-dir wheelhouse
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Build sdist
run: |
python -m build --sdist --outdir dist/
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
test_install:
name: Test wheel installation
needs: [build_wheels]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14]
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download wheels
uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-*
merge-multiple: true
path: wheelhouse/
- name: Test installation and import
run: |
# Let pip find and install the appropriate wheel
echo "=== Available wheels ==="
ls -la wheelhouse/*.whl
# Determine the distribution name from the wheel filenames (PEP 427)
# e.g. kalign_test-3.4.5-...whl -> kalign-test
DIST_NAME="$(ls wheelhouse/*.whl | head -n 1 | xargs basename | cut -d- -f1 | tr '_' '-')"
echo "=== Detected dist name: ${DIST_NAME} ==="
echo "=== Installing wheel ==="
pip install --find-links wheelhouse/ "${DIST_NAME}" --force-reinstall
# Check what got installed
echo "=== Checking installed packages ==="
pip list | grep -E 'kalign' || true
# Check the kalign module structure
echo "=== Checking kalign module ==="
python -c "
import sys
print('Python version:', sys.version)
print('Attempting to import kalign...')
try:
import kalign
print('✓ kalign imported successfully')
print('kalign location:', kalign.__file__)
import os
kalign_dir = os.path.dirname(kalign.__file__)
print('kalign dir contents:', sorted(os.listdir(kalign_dir)))
# Check for _core specifically
core_files = [f for f in os.listdir(kalign_dir) if '_core' in f]
print('_core files found:', core_files)
except ImportError as e:
print('✗ Import failed:', str(e))
import os
import site
print('Site packages:', site.getsitepackages())
for site_dir in site.getsitepackages():
kalign_path = os.path.join(site_dir, 'kalign')
if os.path.exists(kalign_path):
print(f'Found kalign at {kalign_path}')
print('Contents:', sorted(os.listdir(kalign_path)))
break
sys.exit(1)
"
# Test the installation
python -c "
import kalign
print('kalign version:', kalign.__version__)
# Test basic functionality
sequences = ['ATCGATCG', 'ATCGTCG', 'ATCGATCG']
aligned = kalign.align(sequences, seq_type='dna')
print('Number of aligned sequences:', len(aligned))
print('Alignment lengths:', [len(seq) for seq in aligned])
assert len(aligned) == 3
assert all(len(seq) == len(aligned[0]) for seq in aligned)
print('✓ Basic alignment test passed')
# Test with different sequence types
protein_seqs = ['MKTAYIAKQRQ', 'MKTAYIAKQ', 'MKTAYIAK']
aligned_proteins = kalign.align(protein_seqs, seq_type='protein')
print('✓ Protein alignment test passed')
print('All tests passed successfully!')
"
test_ecosystem:
name: Test ecosystem integrations
needs: [build_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-*
merge-multiple: true
path: wheelhouse/
- name: Install kalign with all extras
run: |
DIST_NAME="$(ls wheelhouse/*.whl | head -n 1 | xargs basename | cut -d- -f1 | tr '_' '-')"
pip install --find-links wheelhouse/ "${DIST_NAME}[all]" --force-reinstall
pip install pytest
- name: Verify ecosystem packages are installed
run: |
python -c "import Bio; print(f'Biopython {Bio.__version__}')"
python -c "import skbio; print(f'scikit-bio {skbio.__version__}')"
python -c "import pandas; print(f'pandas {pandas.__version__}')"
python -c "import matplotlib; print(f'matplotlib {matplotlib.__version__}')"
- name: Run ecosystem tests (fail if any skipped)
run: |
pytest tests/python/test_ecosystem_real.py -v --tb=short 2>&1 | tee test_output.txt
# Fail if any tests were skipped — all ecosystem deps should be present
if grep -q "skipped" test_output.txt; then
echo "ERROR: Some ecosystem tests were skipped — all deps should be installed"
exit 1
fi
upload_pypi:
name: Upload to PyPI
needs: [build_wheels, build_sdist, test_install, test_ecosystem]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
id-token: write
environment:
name: pypi
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: cibw-*
merge-multiple: true
path: dist/
- name: Publish to PyPI (trusted publishing)
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: dist/
upload_testpypi:
name: Upload to TestPyPI
needs: [build_wheels, build_sdist, test_install, test_ecosystem]
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && inputs.publish_target == 'testpypi'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: cibw-*
merge-multiple: true
path: dist/
- name: Publish to TestPyPI (API token)
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
packages_dir: dist/
repository-url: https://test.pypi.org/legacy/
verbose: true