diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 000000000..b657b25dd --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,89 @@ +name: wheels + +on: + pull_request: + push: + tags: + - "v*" + workflow_dispatch: + inputs: + ref: + description: "Git ref (branch, tag, or SHA) to build" + required: true + default: "publish_on_pypi_test" + +env: + CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" + CIBW_SKIP: "*-musllinux_*" + CIBW_BUILD_VERBOSITY: "1" + + CIBW_BEFORE_ALL_LINUX: "bash python/dependencies/build_deps_linux.sh" + + CIBW_ENVIRONMENT_LINUX: > + CMAKE_PREFIX_PATH=/opt/cadet_deps + PKG_CONFIG_PATH=/opt/cadet_deps/lib/pkgconfig:/opt/cadet_deps/lib64/pkgconfig + LD_LIBRARY_PATH=/opt/cadet_deps/lib:/opt/cadet_deps/lib64 + + CIBW_CONFIG_SETTINGS: > + cmake.args=-DCMAKE_PREFIX_PATH=/opt/cadet_deps + -DBLA_VENDOR=OpenBLAS + -DENABLE_CADET_CLI=ON + -DENABLE_CADET_TOOLS=ON + -DENABLE_2D_MODELS=ON + -DENABLE_DG=ON + -DENABLE_THREADING=ON + + CIBW_BEFORE_ALL_MACOS: > + bash -lc "brew update && + brew install cmake ninja eigen openblas hdf5 suite-sparse superlu tbb" + + CIBW_ENVIRONMENT_MACOS: > + CMAKE_PREFIX_PATH=/opt/homebrew + BLA_VENDOR=OpenBLAS + + CIBW_BEFORE_ALL_WINDOWS: > + powershell -NoProfile -ExecutionPolicy Bypass -Command " + git clone https://github.com/microsoft/vcpkg C:\vcpkg ; + C:\vcpkg\bootstrap-vcpkg.bat ; + C:\vcpkg\vcpkg.exe install eigen3 openblas hdf5 suitesparse superlu tbb --triplet x64-windows ;" + + CIBW_ENVIRONMENT_WINDOWS: > + CMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake + + + + +jobs: + build-wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || 'publish_on_pypi_test' }} + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Build wheels + uses: pypa/cibuildwheel@v2.21.3 + env: + CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" + CIBW_SKIP: "*-musllinux_*" + CIBW_BUILD_VERBOSITY: "1" + CIBW_TEST_COMMAND: > + python -c "import cadet_core; print(cadet_core.__version__); print(cadet_core.get_cadet_binary())" + && cadet-core --version + CIBW_TEST_REQUIRES: "" + + - uses: actions/upload-artifact@v4 + with: + name: wheels-${{ matrix.os }} + path: wheelhouse/*.whl