Skip to content

CMOR Wheel Build

CMOR Wheel Build #26

Workflow file for this run

name: CMOR Wheel Build
run-name: CMOR Wheel Build
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
release:
types: [published]
permissions:
contents: write
jobs:
wheels:
name: Build wheels
strategy:
fail-fast: false
matrix:
runner:
- RUNNER_OS: "ubuntu-24.04"
CIBW_ARCHS: "x86_64"
MACOSX_DEPLOYMENT_TARGET: ""
- RUNNER_OS: "macos-14"
CIBW_ARCHS: "arm64"
MACOSX_DEPLOYMENT_TARGET: "11.0"
- RUNNER_OS: "macos-15-intel"
CIBW_ARCHS: "x86_64"
MACOSX_DEPLOYMENT_TARGET: "11.0"
runs-on: ${{ matrix.runner.RUNNER_OS }}
env:
CIBW_ARCHS: ${{ matrix.runner.CIBW_ARCHS }}
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
CIBW_SKIP: "*-musllinux*"
CIBW_BEFORE_ALL: "bash {project}/ci-support/cibw-before-all.sh"
CIBW_BEFORE_BUILD: "bash {project}/ci-support/cibw-before-build.sh"
CIBW_ENVIRONMENT_LINUX: >-
CMOR_DEPS_PREFIX=/tmp/cmor-deps
CMOR_UDUNITS2_XML=/tmp/cmor-deps/share/cmor/udunits2.xml
NETCDF_C_VERSION=4.10.0
CIBW_ENVIRONMENT_MACOS: >-
CMOR_DEPS_PREFIX=/tmp/cmor-miniforge
CMOR_UDUNITS2_XML=/tmp/cmor-miniforge/share/cmor/udunits2.xml
MACOSX_DEPLOYMENT_TARGET=${{ matrix.runner.MACOSX_DEPLOYMENT_TARGET }}
LDFLAGS='-Wl,-headerpad_max_install_names'
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >-
LD_LIBRARY_PATH=$CMOR_DEPS_PREFIX/lib auditwheel repair --plat manylinux_2_28_x86_64 -w {dest_dir} {wheel}
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >-
DYLD_FALLBACK_LIBRARY_PATH=$CMOR_DEPS_PREFIX/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
CIBW_TEST_REQUIRES: "numpy typing-extensions netcdf4 pyfive hdf5plugin"
CIBW_TEST_COMMAND: "CMOR_WHEEL_ALREADY_INSTALLED=1 CMOR_TEST_DEPS_ALREADY_INSTALLED=1 bash {project}/ci-support/test-wheel.sh"
WHEEL_DIR: ${{ github.workspace }}/wheelhouse
steps:
- name: Checkout branch
if: ${{ github.event_name != 'release' }}
uses: actions/checkout@v4
- name: Checkout release tag
if: ${{ github.event_name == 'release' }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
- name: Pull Submodules
run: |
git submodule init
git submodule update
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel
- name: Build and test wheels
run: |
python -m cibuildwheel --output-dir wheelhouse
- name: Upload wheels to release
if: ${{ github.event_name == 'release' }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.release.tag_name }}
files: wheelhouse/*.whl
fail_on_unmatched_files: true