| 1 |
name: Build bitshuffle wheels and upload to PyPI |
| 2 |
|
| 3 |
on: |
| 4 |
workflow_dispatch: |
| 5 |
release: |
| 6 |
types: |
| 7 |
- published |
| 8 |
|
| 9 |
jobs: |
| 10 |
build_wheels: |
| 11 |
name: Build wheels on ${{ matrix.os }} and hdf5-${{ matrix.hdf5 }} |
| 12 |
runs-on: ${{ matrix.os }} |
| 13 |
strategy: |
| 14 |
matrix: |
| 15 |
os: [ubuntu-latest, macos-latest] |
| 16 |
hdf5: ["1.10.7", "1.14.4-3"] |
| 17 |
|
| 18 |
steps: |
| 19 |
# Checkout bitshuffle |
| 20 |
- uses: actions/checkout@v4 |
| 21 |
|
| 22 |
# Build wheels for linux and x86 platforms |
| 23 |
- name: Build wheels |
| 24 |
uses: pypa/[email protected] |
| 25 |
with: |
| 26 |
output-dir: ./wheelhouse-hdf5-${{ matrix.hdf5}} |
| 27 |
env: |
| 28 |
CIBW_SKIP: "pp* *musllinux* cp311-macosx*" |
| 29 |
CIBW_ARCHS: "x86_64" |
| 30 |
CIBW_BEFORE_ALL: | |
| 31 |
chmod +x .github/workflows/install_hdf5.sh |
| 32 |
.github/workflows/install_hdf5.sh ${{ matrix.hdf5 }} |
| 33 |
git submodule update --init |
| 34 |
# Only build Haswell wheels on x86 for compatibility |
| 35 |
CIBW_ENVIRONMENT: > |
| 36 |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib |
| 37 |
CPATH=/usr/local/include |
| 38 |
ENABLE_ZSTD=1 |
| 39 |
BITSHUFFLE_ARCH=haswell |
| 40 |
CIBW_TEST_REQUIRES: pytest |
| 41 |
# Install different version of HDF5 for unit tests to ensure the |
| 42 |
# wheels are independent of HDF5 installation |
| 43 |
# CIBW_BEFORE_TEST: | |
| 44 |
# chmod +x .github/workflows/install_hdf5.sh |
| 45 |
# .github/workflows/install_hdf5.sh 1.8.11 |
| 46 |
# Run units tests but disable test_h5plugin.py |
| 47 |
CIBW_TEST_COMMAND: pytest {package}/tests |
| 48 |
# The Github runners for macOS don't support AVX2 |
| 49 |
# instructions and so the tests will fail with SIGILL, so skip them |
| 50 |
CIBW_TEST_SKIP: "*macosx*" |
| 51 |
|
| 52 |
# Package wheels and host on CI |
| 53 |
- uses: actions/upload-artifact@v3 |
| 54 |
with: |
| 55 |
path: ./wheelhouse-hdf5-${{ matrix.hdf5 }}/*.whl |
| 56 |
|
| 57 |
build_sdist: |
| 58 |
name: Build source distribution |
| 59 |
strategy: |
| 60 |
matrix: |
| 61 |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13.0-rc.2"] |
| 62 |
|
| 63 |
runs-on: ubuntu-latest |
| 64 |
steps: |
| 65 |
- uses: actions/checkout@v4 |
| 66 |
|
| 67 |
- name: Install apt dependencies |
| 68 |
run: | |
| 69 |
sudo apt-get update |
| 70 |
sudo apt-get install -y libhdf5-serial-dev hdf5-tools pkg-config |
| 71 |
|
| 72 |
- name: Install Python |
| 73 |
uses: actions/setup-python@v5 |
| 74 |
with: |
| 75 |
python-version: ${{ matrix.python-version }} |
| 76 |
|
| 77 |
- name: Install pip dependencies |
| 78 |
run: | |
| 79 |
pip install -r requirements.txt |
| 80 |
|
| 81 |
- name: Build sdist |
| 82 |
run: python setup.py sdist |
| 83 |
|
| 84 |
- uses: actions/upload-artifact@v3 |
| 85 |
with: |
| 86 |
path: dist/*.tar.gz |
| 87 |
|
| 88 |
# Upload to PyPI |
| 89 |
upload_pypi: |
| 90 |
needs: [build_wheels, build_sdist] |
| 91 |
runs-on: ubuntu-latest |
| 92 |
# Upload to PyPI on every tag |
| 93 |
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 94 |
# Alternatively, to publish when a GitHub Release is created, use the following rule: |
| 95 |
if: github.event_name == 'release' && github.event.action == 'published' |
| 96 |
steps: |
| 97 |
- uses: actions/download-artifact@v3 |
| 98 |
with: |
| 99 |
name: artifact |
| 100 |
path: dist |
| 101 |
|
| 102 |
- uses: pypa/[email protected] |
| 103 |
with: |
| 104 |
user: __token__ |
| 105 |
password: ${{ secrets.pypi_password }} |
| 106 |
# To test: repository_url: https://test.pypi.org/legacy/ |