Files
CoolProp/.github/workflows/python_cibuildwheel.yml
Julien Marrec 149a40d88b Add github action to build python wheels (including python 3.9 and 3.10) (#2097)
* Fix build error: `src/Backends/IF97/IF97Backend.h:54:34: error: call of overloaded ‘abs(double)’ is ambiguous`

Found with the manylinux_2_24_x86_64

gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516

* Register MSVC 2019 and 2022 in setup.py

* setup.py: when calling cmake, build in parallel

* Enable using Env variables instead of passing them as args to setup.py

* Github actions for linux: try 1

* use actions/checkout@v3 for submodules

* mod setup.py:; typo

* Random shot for cibuildwheel for all platforms

* I thought package_dir was a flag, but it's positional

* typo in cmake_compiler

* add cython to setup_requires

* try a pryproject.toml to install cython

* try more requirements?

* pywin32 only found on win32 I guess

* Try with CIBW_BEFORE_BUILD instead

* try to enable msvc via vcvarsall on windows, and pass MACOSX_DEPLOYMENT_TARGET

* more tweaks for windoze

* disable tests for now (fails on windows)

* tweak mac again: it seems mac doesn't understand a C++ lambda, so like it's using pre C++11

* tweak

* try 10.15 for mac...

* try to  force C++11 since mac picks up the path where lambdas are used...

* Move back down to 10.9 now that C++11 is enabled and it works on mac, it should be enough

* Try to debug win32

* Enable part of the upload step (minus the upload) to list the wheels

* try to allow win32 to fail for now (instead of plain disabling)

* Disable the python_linux.yml workflow, so cibuildwheels works fine.

* Adjust the upload step to point to the right folder

* make LGTM python happy
2022-03-31 09:26:31 -04:00

234 lines
7.2 KiB
YAML

name: Python cibuildwheel
on:
push:
branches: [ master, develop, actions_pypi ]
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches: [ master ]
jobs:
python_bindings:
name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.allow_failure }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
include:
# Window 64 bit
# Note: windows-2019 is needed for older Python versions:
# https://github.com/scikit-learn/scikit-learn/issues/22530
- os: windows-2019
python: 38
bitness: 64
platform_id: win_amd64
cmake_compiler: vc16
arch: x64
allow_failure: false
- os: windows-latest
python: 39
bitness: 64
cmake_compiler: vc17
platform_id: win_amd64
arch: x64
allow_failure: false
- os: windows-latest
python: 310
bitness: 64
platform_id: win_amd64
cmake_compiler: vc17
arch: x64
allow_failure: false
# Window 32 bit
- os: windows-latest
python: 38
bitness: 32
platform_id: win32
cmake_compiler: vc17
arch: x86
allow_failure: true
- os: windows-latest
python: 39
bitness: 32
platform_id: win32
cmake_compiler: vc17
arch: x86
allow_failure: true
# Linux 64 bit manylinux2014
- os: ubuntu-latest
python: 37
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
cmake_compiler: default
allow_failure: false
- os: ubuntu-latest
python: 38
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
cmake_compiler: default
allow_failure: false
- os: ubuntu-latest
python: 39
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
cmake_compiler: default
allow_failure: false
- os: ubuntu-latest
python: 310
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
cmake_compiler: default
allow_failure: false
# MacOS x86_64
- os: macos-latest
bitness: 64
python: 37
platform_id: macosx_x86_64
cmake_compiler: default
allow_failure: false
- os: macos-latest
bitness: 64
python: 38
platform_id: macosx_x86_64
cmake_compiler: default
allow_failure: false
- os: macos-latest
bitness: 64
python: 39
platform_id: macosx_x86_64
cmake_compiler: default
allow_failure: false
- os: macos-latest
bitness: 64
python: 310
platform_id: macosx_x86_64
cmake_compiler: default
allow_failure: false
# MacOS arm64
- os: macos-latest
bitness: 64
python: 38
platform_id: macosx_arm64
cmake_compiler: default
allow_failure: false
- os: macos-latest
bitness: 64
python: 39
platform_id: macosx_arm64
cmake_compiler: default
allow_failure: false
- os: macos-latest
bitness: 64
python: 310
platform_id: macosx_arm64
cmake_compiler: default
allow_failure: false
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.9.x
- name: Setup Deps
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
# C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
MSVC_DIR=$(cmd.exe /c "vswhere -products * -requires Microsoft.Component.MSBuild -property installationPath -latest")
echo "Latest is: $MSVC_DIR"
echo "MSVC_DIR=$MSVC_DIR" >> $GITHUB_ENV
# add folder containing vcvarsall.bat
echo "$MSVC_DIR\VC\Auxiliary\Build" >> $GITHUB_PATH
fi
- name: Build and test wheels
env:
COOLPROP_CMAKE: ${{ matrix.cmake_compiler}},${{ matrix.bitness }}
CIBW_ENVIRONMENT: COOLPROP_CMAKE=${{ matrix.cmake_compiler }},${{ matrix.bitness }}
MACOSX_DEPLOYMENT_TARGET: 10.9
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.9 SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
CIBW_BEFORE_BUILD: pip install setuptools wheel Cython requests jinja2 pyyaml
CIBW_BEFORE_ALL_WINDOWS: call vcvarsall.bat ${{ matrix.arch }}
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
CIBW_ARCHS: all
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
CIBW_TEST_SKIP: "*-macosx_arm64"
# CIBW_TEST_COMMAND: python -c 'from CoolProp.CoolProp import get_global_param_string; print("CoolProp gitrevision:", get_global_param_string("gitrevision"))'
CIBW_BUILD_VERBOSITY: 1
run: |
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse ./wrappers/Python
- name: Store artifacts
uses: actions/upload-artifact@v2
with:
path: wheelhouse/*.whl
upload_python_bindings_to_pypi:
needs: python_bindings
name: Upload to PyPi
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9.x
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine requests packaging
mkdir wheels
- name: Download ALL wheels
uses: actions/download-artifact@v2
with:
path: ./wheels
- name: Display structure of downloaded files
working-directory: ./wheels
run: |
ls -R
- name: Publish wheels to (Test)PyPI
# TODO: for now I'm effectively disabling uploading to testpypi on each build
if: contains(github.ref, 'refs/tags')
working-directory: ./wheels/artifact
env:
TWINE_USERNAME: __token__
run: |
if [[ "$GITHUB_REF" == *"refs/tags"* ]]; then
TWINE_REPOSITORY=pypi
TWINE_PASSWORD=${{ secrets.PYPI_TOKEN }}
else
TWINE_REPOSITORY=testpypi
TWINE_PASSWORD=${{ secrets.TESTPYPI_TOKEN }}
fi;
echo "TWINE_REPOSITORY=$TWINE_REPOSITORY" >> $GITHUB_ENV
echo "TWINE_PASSWORD=$TWINE_PASSWORD" >> $GITHUB_ENV
twine upload *.whl