Skip to content

jurgen-lentz is building "cibw" #312

jurgen-lentz is building "cibw"

jurgen-lentz is building "cibw" #312

name: build-and-test
run-name: ${{ github.actor }} is building "${{ github.ref_name }}"
on: [push]
env:
CIBW_ARCHS_LINUX: auto
CIBW_ARCHS_MACOS: x86_64 universal2
CIBW_BEFORE_BUILD: pip install cython setuptools
CIBW_SKIP: pp* *_i686 *-win32 *musllinux*
CIBW_TEST_COMMAND: python -m amplpy.tests
# TODO:
# remove when a released cython can build free-threaded extensions
CIBW_BUILD_FRONTEND: 'pip; args: --no-build-isolation'
CIBW_TEST_REQUIRES: --index-url https://pypi.ampl.com --extra-index-url https://pypi.org/simple ampl_module_base ampl_module_highs pandas numpy
jobs:
build_native:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2022, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Download libampl
run: python3 dev/updatelib.py
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_ARCHS_LINUX: ${{ env.CIBW_ARCHS_LINUX }}
CIBW_ARCHS_MACOS: ${{ env.CIBW_ARCHS_MACOS }}
CIBW_BEFORE_BUILD: ${{ env.CIBW_BEFORE_BUILD }}
CIBW_SKIP: ${{ env.CIBW_SKIP }}
CIBW_BUILD_FRONTEND: ${{ env.CIBW_BUILD_FRONTEND }}
CIBW_TEST_COMMAND: ${{ env.CIBW_TEST_COMMAND }}
CIBW_TEST_REQUIRES: ${{ env.CIBW_TEST_REQUIRES }}
- uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.os }}
path: ./wheelhouse/*.whl
build_nogil:
name: Build wheels on ${{ matrix.os }}-nogil
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2022, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Download libampl
run: python3 dev/updatelib.py
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_ARCHS_LINUX: ${{ env.CIBW_ARCHS_LINUX }}
CIBW_ARCHS_MACOS: ${{ env.CIBW_ARCHS_MACOS }}
CIBW_BEFORE_BUILD: pip install cython==3.1.0a1 setuptools
CIBW_SKIP: ${{ env.CIBW_SKIP }}
CIBW_PRERELEASE_PYTHONS: true
CIBW_FREE_THREADED_SUPPORT: true
CIBW_BUILD: cp313t-*
CIBW_BUILD_FRONTEND: ${{ env.CIBW_BUILD_FRONTEND }}
CIBW_TEST_COMMAND: ${{ env.CIBW_TEST_COMMAND }}
CIBW_TEST_REQUIRES: ${{ env.CIBW_TEST_REQUIRES }}
- uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.os }}-nogil
path: ./wheelhouse/*.whl
build_with_qemu:
#if: github.ref == 'refs/heads/release'
name: Build ${{ matrix.build }} wheels for ${{ matrix.arch }}
#needs: build_native
strategy:
matrix:
arch: [aarch64]
build: [cp36-*, cp37-*, cp38-*, cp39-*, cp310-*, cp311-*, cp312-*, cp313-*]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
# This should be temporary
# xref https://github.com/docker/setup-qemu-action/issues/188
# xref https://github.com/tonistiigi/binfmt/issues/215
image: tonistiigi/binfmt:qemu-v8.1.5
- name: Download libampl
run: python3 dev/updatelib.py
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_ARCHS_MACOS: ${{ env.CIBW_ARCHS_MACOS }}
CIBW_BUILD: ${{ matrix.build }}
CIBW_SKIP: ${{ env.CIBW_SKIP }}
CIBW_BUILD_FRONTEND: ${{ env.CIBW_BUILD_FRONTEND }}
CIBW_TEST_COMMAND: ${{ env.CIBW_TEST_COMMAND }}
CIBW_TEST_REQUIRES: --index-url https://pypi.ampl.com --extra-index-url https://pypi.org/simple ampl_module_base
- name: Remove '-*' from build variable
run: |
# Remove '-*' from the build variable
ESCAPED_BUILD=$(echo "${{ matrix.build }}" | sed 's/-\*//g')
echo "ESCAPED_BUILD=$ESCAPED_BUILD" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.arch }}-${{ env.ESCAPED_BUILD }}
path: ./wheelhouse/*.whl