Build wheels in workflow #22
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Wheel | |
on: | |
pull_request: | |
types: [ opened, synchronize, reopened ] | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
generate-wheels-matrix: | |
# https://iscinumpy.dev/post/cibuildwheel-2-10-0/ | |
name: Generate wheels matrix | |
runs-on: ubuntu-latest | |
outputs: | |
include: ${{ steps.set-matrix.outputs.include }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install cibuildwheel | |
run: pipx install cibuildwheel==2.16.2 | |
- id: set-matrix | |
run: | | |
MATRIX=$( | |
{ | |
cibuildwheel --print-build-identifiers --platform linux \ | |
| jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' | |
} | jq -sc | |
) | |
echo "include=$MATRIX" >> $GITHUB_OUTPUT | |
env: | |
CIBW_ARCHS_LINUX: x86_64 | |
# Only "manylinux" and only CPython is supported. | |
# PyPy and musllinux crashes with "pyconfig.h not found" during Boost compilation | |
CIBW_BUILD: "cp*" | |
CIBW_BUILD_VERBOSITY: 1 | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
build-wheels: | |
name: Build ${{ matrix.only }} | |
needs: generate-wheels-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download libraries | |
uses: ./.github/composite-actions/download-libraries | |
with: | |
download-pybind: true | |
download-googletest: false | |
- name: Cache unpacked Boost | |
uses: actions/cache@v3 | |
id: cache-unpacked-boost | |
with: | |
path: ${{github.workspace}}/lib/boost_1_78_0 | |
key: ${{ runner.os }}-boost-for-wheels-78 | |
- name: Download & unpack Boost | |
run: | | |
cd ${{github.workspace}}/lib | |
wget -O boost_1_78_0.tar.gz https://sourceforge.net/projects/boost/files/boost/1.78.0/boost_1_78_0.tar.gz/download | |
tar xzf boost_1_78_0.tar.gz | |
shell: bash | |
if: steps.cache-unpacked-boost.outputs.cache-hit != 'true' | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
only: ${{ matrix.only }} | |
env: | |
CIBW_BEFORE_ALL: > | |
cd lib/boost_1_78_0 && | |
./bootstrap.sh --prefix=/usr/local && | |
./b2 install --prefix=/usr/local | |
CIBW_TEST_COMMAND: > | |
cp {project}/test_input_data/WDC_satellites.csv {project}/src/python_bindings && | |
cd {project}/src/python_bindings && | |
python3 {project}/src/python_bindings/test_bindings.py |