Skip to content

Build

Build #43

Workflow file for this run

name: Build
on:
push:
pull_request:
release:
types:
- published
env:
CIBW_SKIP: cp36-* cp37-* cp38-* pp* *i686 *win32
# cibuildhweel macOS configuration
CIBW_ARCHS_MACOS: native
# cibuildhweel linux configuration
CIBW_ARCHS_LINUX: x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2
CIBW_BEFORE_ALL_LINUX: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain=stable --profile=minimal -y
CIBW_ENVIRONMENT_LINUX: 'PATH="$HOME/.cargo/bin:$PATH"'
# cibuildhweel Windows configuration
CIBW_ARCHS_WINDOWS: AMD64
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an Intel runner, macos-latest is an ARM runner
os: [macos-13, macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: python -m pip install cibuildwheel==2.21.3
- run: echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | cut -d '.' -f 1-2)" >> $GITHUB_ENV
if: startsWith(matrix.os, 'macos')
- run: python -m cibuildwheel
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}
path: wheelhouse
test_library:
name: Test library on ${{ matrix.os }} with Python ${{ matrix.python }} and numpy ${{ matrix.numpy }}
runs-on: ${{ matrix.os }}
needs: [build_wheels]
strategy:
matrix:
numpy: ["==1.26.4", ">=2"]
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
# macos-13 is an Intel runner, macos-latest is an ARM runner
os: [macos-13, macos-latest, ubuntu-latest, windows-latest]
exclude:
# this configuration yields 'Windows fatal exception: access violation'
# this may get fixed in a maintenance upgrade of 1.26.x (x > 4)
- numpy: ==1.26.4
os: windows-latest
python: 3.13
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.os }}
path: wheelhouse
- run: python -m pip install toml
- run: python -m pip install 'numpy${{ matrix.numpy }}'
- run: python .github/workflows/install_dependencies.py
- run: ls wheelhouse
- run: python -m pip install --no-index --find-links wheelhouse aedat
- run: python test.py
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*.tar.gz
upload_pypi:
name: Upload wheels and sidst to PyPI
runs-on: ubuntu-latest
needs: [build_wheels, test_library, build_sdist]
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
path: wheelhouse
pattern: "*"
merge-multiple: true
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- run: mv wheelhouse/* dist/
- uses: pypa/gh-action-pypi-publish@v1.8.14
with:
password: ${{ secrets.PYPI_API_TOKEN }}