adapted cibuildwheel environment variables #568
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: Wheels | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
debug_enabled: | ||
description: 'Run the build with tmate debugging enabled' | ||
required: false | ||
default: false | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- stable | ||
- actions* | ||
- docs | ||
- feature_networks | ||
tags: | ||
- v* | ||
jobs: | ||
build_sdist: | ||
name: Build source distribution (sdist) | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/heads/docs') != true | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
- name: Setup CMake | ||
uses: jwlawson/[email protected] | ||
- name: Install system dependencies macOS | ||
if: runner.os == 'macOS' | ||
run: | | ||
brew install libomp | ||
echo "LIBOMP=$(brew --prefix libomp)" >> $GITHUB_ENV | ||
brew install eigen | ||
echo "EIGEN=$(brew --prefix eigen)" >> $GITHUB_ENV | ||
brew install gfortran | ||
echo "GFORTRAN=$(brew --prefix gfortran)" >> $GITHUB_ENV | ||
- name: Install system dependencies Linux | ||
env: | ||
CACHE_HIT: ${{steps.cache-boost.outputs.cache-hit}} | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libomp-dev | ||
sudo apt-get install libeigen3-dev | ||
echo "Eigen3_DIR='/usr/include/eigen3'" >> $GITHUB_ENV | ||
sudo apt-get install libboost-all-dev | ||
- name: Install requirements | ||
run: | | ||
pip install --user check-manifest twine | ||
- name: Run check-manifest | ||
run: | | ||
python -m check_manifest | ||
- name: Build sdist | ||
run: | | ||
python -m build --sdist --outdir wheelhouse | ||
- name: Install from sdist | ||
run: | | ||
pip install --user wheelhouse/*.tar.gz | ||
- name: Check sdist metadata | ||
run: | | ||
python -m twine check wheelhouse/* | ||
- name: Upload sdist | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: wheels | ||
path: wheelhouse/*.tar.gz | ||
build_wheels: | ||
strategy: | ||
# Ensure that a wheel builder finishes even if another fails | ||
fail-fast: false | ||
matrix: | ||
include: | ||
# Run 32 and 64 bit version in parallel for Linux and Windows | ||
- runs-on: windows-latest | ||
cibw-arch: win_amd64 | ||
- runs-on: windows-latest | ||
cibw-arch: win32 | ||
python-arch: x86 | ||
- runs-on: ubuntu-latest | ||
cibw-arch: manylinux_x86_64 | ||
- runs-on: macos-latest | ||
cibw-arch: macosx_x86_64 | ||
- runs-on: macos-latest | ||
cibw-arch: macosx_arm64 | ||
name: Wheels • ${{ matrix.cibw-arch }} | ||
runs-on: ${{ matrix.runs-on }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
architecture: ${{ matrix.python-arch }} | ||
- name: Setup CMake | ||
uses: jwlawson/[email protected] | ||
- name: Build and test wheels | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_BUILD_FRONTEND: "build" | ||
CIBW_BUILD: "cp*-${{ matrix.cibw-arch }}" | ||
CIBW_SKIP: "cp38-win32 cp39-win32 cp310-win32 cp311-win32" | ||
CIBW_ARCHS_MACOS: "x86_64 arm64" | ||
CIBW_ARCHS_WINDOWS: "AMD64 x86" | ||
CIBW_BEFORE_ALL_MACOS: bash build_tools/github/before_all_mac.sh | ||
CIBW_BEFORE_BUILD_MACOS: bash build_tools/github/before_build_mac.sh | ||
CIBW_BEFORE_ALL_LINUX: bash build_tools/github/download_eigen3.sh | ||
CIBW_BEFORE_ALL_WINDOWS: bash build_tools/github/download_eigen3_windows.sh | ||
CIBW_ENVIRONMENT_WINDOWS: CMAKE_BUILD_PARALLEL_LEVEL=2 CMAKE_ARCH="${{ matrix.platform_id == 'win32' && '-A Win32' || '' }}" | ||
CIBW_ENVIRONMENT_MACOS: CMAKE_BUILD_PARALLEL_LEVEL=2 CMAKE_OSX_ARCHITECTURES=${{ matrix.cibw-arch == 'macosx_x86_64' && 'x86_64' || matrix.cibw-arch == 'macosx_arm64' && 'arm64' || matrix.cibw-arch == 'macosx_universal2' && '"arm64;x86_64"' || '' }} BUILD_ARCH=${{ matrix.cibw-arch }} MACOSX_DEPLOYMENT_TARGET=${{matrix.cibw-arch == 'macosx_arm64' && 12.0 || 10.15}} EGTTOOLS_EXTRA_CMAKE_ARGS=${{matrix.cibw-arch == 'macosx_arm64' && "-DLIBOMP_DIR='$(brew --prefix libomp)' -DMACOSX_DEPLOYMENT_TARGET=12.0" || "-DLIBOMP_DIR='$(brew --prefix libomp)' -DMACOSX_DEPLOYMENT_TARGET=10.5"}} | ||
Check failure on line 137 in .github/workflows/wheels.yml GitHub Actions / WheelsInvalid workflow file
|
||
CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64" | ||
CIBW_TEST_REQUIRES: pytest | ||
CIBW_BEFORE_TEST_MACOS: cd .. && cp -r {package}/tests/ {project}/tests/ | ||
CIBW_BEFORE_TEST_WINDOWS: cd .. && cp -r {package}/tests/ {project}\tests\ | ||
# CIBW_BEFORE_TEST_LINUX: cp -r {package}/tests/ {project}/tests/ | ||
CIBW_TEST_COMMAND: pytest {project}/tests | ||
CIBW_BUILD_VERBOSITY: 1 | ||
# CONDA_HOME: /usr/local/miniconda | ||
- name: Upload wheels | ||
if: startsWith(github.ref, 'refs/heads/docs') != true | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: wheels | ||
path: wheelhouse/egttools-*.whl | ||
if-no-files-found: error | ||
- name: Upload wheel for ReadTheDocs | ||
if: runner.os == 'Linux' && matrix.cibw-arch == 'manylinux_x86_64' && startsWith(github.ref, 'refs/heads/') && !startsWith(github.ref, 'refs/heads/actions') | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: rtd-wheel | ||
path: wheelhouse/egttools-*-cp38-cp38-*manylinux2014_x86_64*.whl | ||
if-no-files-found: error | ||
- name: Setup tmate session | ||
uses: mxschmitt/action-tmate@v3 | ||
if: ${{ failure() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }} | ||
with: | ||
limit-access-to-actor: true | ||
trigger_rtd: | ||
name: Trigger ReadTheDocs build | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/heads/') && !startsWith(github.ref, 'refs/heads/actions') | ||
needs: [ build_wheels ] | ||
steps: | ||
- name: Get branch name | ||
id: get_branch | ||
run: | | ||
echo "::set-output name=branch::${GITHUB_REF##refs/heads/}" | ||
- name: Trigger ReadTheDocs webhook | ||
run: | | ||
curl -X POST -d "branches=${{ steps.get_branch.outputs.branch }}" -d "token=${{ secrets.READTHEDOCS_WEBHOOK_TOKEN }}" https://readthedocs.org/api/v2/webhook/egttools/180432/ | ||
create_release: | ||
name: Create release | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
needs: [ build_sdist, build_wheels ] | ||
steps: | ||
- name: Collect sdist and wheels | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: wheels | ||
path: wheelhouse | ||
- name: Get release name | ||
id: get_version | ||
run: | | ||
echo "::set-output name=version::${GITHUB_REF##refs/tags/v}" | ||
- name: Upload sdist and wheels to release | ||
uses: ncipollo/[email protected] | ||
with: | ||
name: ${{ steps.get_version.outputs.version }} | ||
draft: true | ||
artifacts: wheelhouse/* | ||
token: ${{ secrets.GITHUB_TOKEN }} |