|
| 1 | +name: Build Wheels |
| 2 | + |
| 3 | +# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_dispatchinputs |
| 4 | +on : |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + nightlyRelease: |
| 8 | + description: 'Generates wheels for the nightly release' |
| 9 | + type: boolean |
| 10 | + required: true |
| 11 | + default: false |
| 12 | + |
| 13 | +jobs: |
| 14 | + |
| 15 | + build_wheels: |
| 16 | + name: Build wheels on ${{ matrix.os }} |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 22 | + include: |
| 23 | + - os: ubuntu-latest |
| 24 | + boost_install_dir: /home/runner/work |
| 25 | + - os: macos-latest |
| 26 | + boost_install_dir: /Users/runner/work |
| 27 | + - os: windows-latest |
| 28 | + boost_install_dir: D:\ |
| 29 | + env: |
| 30 | + BOOST_VERSION: 1.76.0 |
| 31 | + |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v2 |
| 34 | + |
| 35 | + - name: Change name to giotto-tda-nightly |
| 36 | + if: ${{ github.event.inputs.nightlyRelease == true }} |
| 37 | + run: | |
| 38 | + set -e |
| 39 | + sed -i "s/'giotto-tda'/'giotto-tda-nightly'/1" setup.py |
| 40 | + sed -i 's/"giotto-tda"/"giotto-tda-nightly"/1' setup.py |
| 41 | + sed -i "s/__version__.*/__version__ = '$(Build.BuildNumber)'/1" gtda/_version.py |
| 42 | + shell: bash |
| 43 | + |
| 44 | + - name: Create directories boost |
| 45 | + run: | |
| 46 | + cd ${{ matrix.boost_install_dir }} |
| 47 | + mkdir -p boost/boost |
| 48 | + cd - |
| 49 | +
|
| 50 | + - name: Cache boost ${{env.BOOST_VERSION}} in ${{ matrix.boost_install_dir }} |
| 51 | + # FIXME For an unknown reason on windows runner, when the cache is hit |
| 52 | + # The compilation fails because it doesn't find some headers |
| 53 | + # I don't know if the cache is corrupted, for the moment hard to debug |
| 54 | + if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} |
| 55 | + uses: actions/cache@v2 |
| 56 | + id: cache-boost |
| 57 | + with: |
| 58 | + # Set the default path as the path to cache |
| 59 | + path: ${{ matrix.boost_install_dir }}/boost/boost |
| 60 | + # Use the version as the key to only cache the correct version |
| 61 | + key: 1-boost-${{env.BOOST_VERSION}} |
| 62 | + |
| 63 | + - name: Install boost ${{env.BOOST_VERSION}} |
| 64 | + |
| 65 | + id: install-boost |
| 66 | + if: steps.cache-boost.outputs.cache-hit != 'true' |
| 67 | + with: |
| 68 | + boost_version: ${{env.BOOST_VERSION}} |
| 69 | + boost_install_dir: ${{ matrix.boost_install_dir }} |
| 70 | + |
| 71 | + - name: Build wheels |
| 72 | + |
| 73 | + env: |
| 74 | + # Specify which Python versions to build wheels |
| 75 | + # https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip |
| 76 | + CIBW_BUILD: "cp37-* cp38-* cp39-* cp310-*" |
| 77 | + # Skip 32 bit architectures, musllinux, and i686, and macOS x86_64 wheels for CP3.8 -- CP3.10 |
| 78 | + CIBW_SKIP: "*-win32 *-musllinux_x86_64 *_i686 cp38-macosx_x86_64 cp39-macosx_x86_64 cp310-macosx_x86_64" |
| 79 | + CIBW_BEFORE_BUILD_WINDOWS: python -m pip install cmake && python -m pip install --upgrade pip setuptools && sed -i $'s/\r$//' README.rst && python -m pip install delvewheel |
| 80 | + CIBW_BEFORE_BUILD_LINUX: python -m pip install cmake && python -m pip install --upgrade pip setuptools |
| 81 | + CIBW_BEFORE_BUILD_MACOS: python -m pip install cmake && python -m pip install --upgrade pip setuptools |
| 82 | + CIBW_TEST_COMMAND: python -m pytest --pyargs gtda |
| 83 | + # nbformat is needed by plotly: https://github.com/plotly/plotly.py/issues/2159 |
| 84 | + CIBW_TEST_REQUIRES: pytest hypothesis pandas nbformat |
| 85 | + CIBW_ENVIRONMENT_WINDOWS: BOOST_ROOT='${{ matrix.boost_install_dir }}boost\boost' |
| 86 | + CIBW_ENVIRONMENT_MACOS: BOOST_ROOT='${{ matrix.boost_install_dir }}/boost' |
| 87 | + CIBW_ENVIRONMENT_LINUX: BOOST_ROOT=/host${{ matrix.boost_install_dir }}/boost |
| 88 | + CIBW_ENVIRONMENT_PASS_LINUX: BOOST_ROOT |
| 89 | + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -vv -w {dest_dir} {wheel}" |
| 90 | + CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 |
| 91 | + # Should generate universal2 wheels for CP3.8 -- CP3.10 |
| 92 | + CIBW_ARCHS_MACOS: x86_64 universal2 |
| 93 | + |
| 94 | + - uses: actions/upload-artifact@v2 |
| 95 | + name: Upload wheels |
| 96 | + with: |
| 97 | + path: ./wheelhouse/*.whl |
0 commit comments