From c806063b7750c024c1e2a81d0e9abb88a773715a Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Fri, 1 Mar 2024 16:08:35 +0100 Subject: [PATCH] Build and test all wheels on GHA --- .github/workflows/nmodl-wheel.yml | 75 +++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nmodl-wheel.yml b/.github/workflows/nmodl-wheel.yml index 0d3716ddee..8bc616f267 100644 --- a/.github/workflows/nmodl-wheel.yml +++ b/.github/workflows/nmodl-wheel.yml @@ -5,14 +5,23 @@ on: branches: - master pull_request: + branches: + - master + - releases/* + schedule: + - cron: "5 0 * * *" + branches: + - master + workflow_dispatch: jobs: - build_wheels: + build_wheels_nonlinux: name: Build wheels on ${{ matrix.os }} + timeout-minutes: 45 runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macOS-13, macOS-14] + os: [macOS-13, macOS-14] steps: - name: Setup Flex and Bison @@ -30,13 +39,71 @@ jobs: # Used to host cibuildwheel - uses: actions/setup-python@v3 + - name: Install cibuildwheel + run: python -m pip install cibuildwheel==2.16.5 + + - name: Build all wheels + run: | + export SETUPTOOLS_SCM_PRETEND_VERSION="$(git describe --tags | cut -d '-' -f 1,2 | tr - .)" + python -m cibuildwheel --output-dir wheelhouse + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }} + path: ./wheelhouse/*.whl + + build_wheels_manylinux: + name: Build manylinux wheels + timeout-minutes: 45 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + # Used to host cibuildwheel + - uses: actions/setup-python@v3 + - name: Install cibuildwheel run: python -m pip install cibuildwheel==2.16.5 - name: Build wheels - run: python -m cibuildwheel --output-dir wheelhouse + run: | + export SETUPTOOLS_SCM_PRETEND_VERSION="$(git describe --tags | cut -d '-' -f 1,2 | tr - .)" + CIBW_ENVIRONMENT_PASS_LINUX='SETUPTOOLS_SCM_PRETEND_VERSION' python -m cibuildwheel --output-dir wheelhouse - uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + name: cibw-wheels-manylinux path: ./wheelhouse/*.whl + + # testing of wheels cannot be done in a manylinux image due to the lack of + # the Python library; as a workaround, we test each wheel in a separate + # version + test_wheels_manylinux: + name: Test manylinux wheel on Python ${{ matrix.python_version }} + runs-on: ubuntu-latest + needs: build_wheels_manylinux + timeout-minutes: 45 + strategy: + matrix: + python_version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + depends-on: manylinux_wheels + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Make manylinux wheels available + uses: actions/download-artifact@v2 + with: + name: cibw-wheels-manylinux + + - name: Set up Python ${{ matrix.python_version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python_version }} + + - name: Test manylinux Wheel with Python ${{ matrix.python_version }} + run: | + set -eux + dotless_version="$(echo "${matrix.python_version}" | tr -d '.')" + find ${{ github.workspace }} -name "*cp${dotless_version}-manylinux*.whl" -exec bash packaging/test_wheel.bash python${{ matrix.python_version }} {} \;