Skip to content

[Patch] [Hack] CMake --trace-expand #59

[Patch] [Hack] CMake --trace-expand

[Patch] [Hack] CMake --trace-expand #59

Workflow file for this run

name: wheels
on: [push, pull_request]
jobs:
build_wheels:
name: Build ${{ matrix.arch }} wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
arch: "x86_64"
- os: ubuntu-20.04
arch: "i686"
# builds faster on Travis-CI:
#- os: ubuntu-20.04
# arch: "aarch64"
# builds faster on Travis-CI:
#- os: ubuntu-20.04
# arch: "ppc64le"
# builds faster on Travis-CI:
# blocked by https://github.com/GTkorvo/dill/issues/15
#- os: ubuntu-20.04
# arch: "s390x"
# x86-64 (64bit)
- os: windows-2019
arch: "AMD64"
# x86 (32bit)
- os: windows-2019
arch: "x86"
env:
CMAKE_GENERATOR: "Visual Studio 16 2019"
CMAKE_GENERATOR_PLATFORM: "Win32"
- os: macos-10.15
arch: "x86_64"
env:
MACOSX_DEPLOYMENT_TARGET: 10.15
# Apple Silicon M1/arm64/aarch64 builds:
# https://cibuildwheel.readthedocs.io/en/stable/faq/#apple-silicon
# https://github.com/pypa/cibuildwheel/pull/704
- os: macos-11
arch: "arm64"
env:
CMAKE_OSX_ARCHITECTURES: "arm64"
MACOSX_DEPLOYMENT_TARGET: 11.0
# Apple universal builds that contain x86-64 and arm64 binary code
# Needs extra treatment of all librarys that are not CMake
# controlled the dependencies:
# https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary
# ADIOS1 tricky to build and HDF5 even with CMake as well (as of 1.12)
# We could build them twice and use `lipo` to combine the lib artifacts.
#- os: macos-11
# arch: "universal2"
# env:
# CMAKE_OSX_ARCHITECTURES: "arm64;x86_64"
# MACOSX_DEPLOYMENT_TARGET: 11.0
steps:
- uses: actions/checkout@v2
with:
path: 'src'
ref: '0.15.1'
- uses: actions/checkout@v2
with:
path: 'src/.github/'
- uses: actions/setup-python@v1
name: Install Python
with:
python-version: '3.7'
- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install cibuildwheel==2.12.1
# Hack: cmake --trace-expand
- name: Download Patch 2/2
uses: suisei-cn/actions-download-file@v1
id: setupversion
with:
url: "https://gist.githubusercontent.com/ax3l/9b15c5bc73d7f3c1c66784187a016474/raw/e31dd54498c9c8fc465a7cbb6f900f768b9d0c0b/0001-Hack-setup.py-CMake-trace-expand.patch"
target: src/.patch/
- name: Apply Patches
run: |
python -m pip install "patch==1.*"
cd src
python -m patch .patch/0001-Hack-setup.py-CMake-trace-expand.patch
- name: Build wheel
env:
# (1) Disable PyPy (manylinux image: yum repo issues)
# https://github.com/pypa/manylinux/issues/899
CIBW_SKIP: "pp*-manylinux*"
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.7"
# Install dependencies
CIBW_BEFORE_BUILD_LINUX: bash -x .github/library_builders.sh
CIBW_BEFORE_BUILD_MACOS: bash -x .github/library_builders.sh
CIBW_BEFORE_BUILD_WINDOWS: 'cmd /E:ON /V:ON /C .github\library_builders.bat'
# for the openPMD-api build, CMake shall search for
# static dependencies of HDF5 and ADIOS1 (see setup.py)
CIBW_ENVIRONMENT: HDF5_USE_STATIC_LIBRARIES='ON' ZLIB_USE_STATIC_LIBS='ON' ADIOS_USE_STATIC_LIBS='ON' openPMD_CMAKE_openPMD_USE_HDF5='ON' openPMD_CMAKE_openPMD_USE_ADIOS2='ON'
CIBW_ENVIRONMENT_WINDOWS: HDF5_USE_STATIC_LIBRARIES='ON' ZLIB_USE_STATIC_LIBS='ON' openPMD_CMAKE_openPMD_USE_HDF5='ON' openPMD_CMAKE_openPMD_USE_ADIOS2='ON' CMAKE_PREFIX_PATH='C:/Program Files (x86)/ADIOS2;C:/Program Files (x86)/blosc;C:/Program Files (x86)/blosc2;C:/Program Files (x86)/HDF5;C:/Program Files (x86)/ZFP;C:/Program Files (x86)/zlib'
# C++17 support in macOS 10.13+ (partial) and 10.14+ (std::visit) and 10.15+ (std::filesystem::path)
# https://cibuildwheel.readthedocs.io/en/stable/cpp_standards/#macos-and-deployment-target-versions
# arm64 Python interpreters are built with 11.0
MACOSX_DEPLOYMENT_TARGET: "${{ matrix.env.MACOSX_DEPLOYMENT_TARGET }}"
CMAKE_OSX_ARCHITECTURES: "${{ matrix.env.CMAKE_OSX_ARCHITECTURES }}"
# Windows cross-compilation
CMAKE_GENERATOR: "${{ matrix.env.CMAKE_GENERATOR }}"
CMAKE_GENERATOR_PLATFORM: "${{ matrix.env.CMAKE_GENERATOR_PLATFORM }}"
# Show a bit more output (pip -v)
CIBW_BUILD_VERBOSITY: 1
run: |
cd src
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade cmake
python setup.py sdist --dist-dir ../wheelhouse
python -m cibuildwheel --output-dir ../wheelhouse
- uses: actions/upload-artifact@v1
name: Publish as GitHub artifact
with:
name: wheels
path: ./wheelhouse
- name: Publish on pypi.org
if: github.event_name == 'push' && github.repository == 'openPMD/openPMD-api' && github.ref == 'refs/heads/wheels'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypa_gh_action_upload }}
run: |
python -m pip install -U twine
python -m twine upload --skip-existing wheelhouse/*