|
| 1 | +# Workflow to build and test wheels. |
| 2 | +# To work on the wheel building infrastructure on a fork, comment out: |
| 3 | +# |
| 4 | +# if: github.repository == 'numpy/numpy' |
| 5 | +# |
| 6 | +# in the get_commit_message job. Be sure to include [cd build] in your commit |
| 7 | +# message to trigger the build. All files related to wheel building are located |
| 8 | +# at tools/wheels/ |
| 9 | +name: Wheel builder |
| 10 | + |
| 11 | +on: |
| 12 | + schedule: |
| 13 | + # Nightly build at 1:42 UTC |
| 14 | + - cron: "42 1 * * *" |
| 15 | + push: |
| 16 | + pull_request: |
| 17 | + workflow_dispatch: |
| 18 | + |
| 19 | +jobs: |
| 20 | + get_commit_message: |
| 21 | + name: Get commit message |
| 22 | + runs-on: ubuntu-latest |
| 23 | + if: github.repository == 'numpy/numpy' |
| 24 | + outputs: |
| 25 | + message: ${{ steps.commit_message.outputs.message }} |
| 26 | + steps: |
| 27 | + - name: Checkout numpy |
| 28 | + uses: actions/checkout@v2 |
| 29 | + # Gets the correct commit message for pull request |
| 30 | + with: |
| 31 | + ref: ${{ github.event.pull_request.head.sha }} |
| 32 | + - name: Get commit message |
| 33 | + id: commit_message |
| 34 | + run: | |
| 35 | + set -xe |
| 36 | + COMMIT_MSG=$(git log --no-merges -1 --oneline) |
| 37 | + echo "::set-output name=message::$COMMIT_MSG" |
| 38 | +
|
| 39 | + build_wheels: |
| 40 | + name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform }} |
| 41 | + needs: get_commit_message |
| 42 | + if: >- |
| 43 | + contains(needs.get_commit_message.outputs.message, '[cd build]') || |
| 44 | + github.event.name == 'schedule' || |
| 45 | + github.event.name == 'workflow_dispatch' |
| 46 | + runs-on: ${{ matrix.os }} |
| 47 | + strategy: |
| 48 | + # Ensure that a wheel builder finishes even if another fails |
| 49 | + fail-fast: false |
| 50 | + matrix: |
| 51 | + include: |
| 52 | + # manylinux builds |
| 53 | + - os: ubuntu-latest |
| 54 | + python: "38" |
| 55 | + platform: manylinux_x86_64 |
| 56 | + - os: ubuntu-latest |
| 57 | + python: "39" |
| 58 | + platform: manylinux_x86_64 |
| 59 | + - os: ubuntu-latest |
| 60 | + python: "310" |
| 61 | + platform: manylinux_x86_64 |
| 62 | + |
| 63 | + # macos builds |
| 64 | + - os: macos-latest |
| 65 | + python: "38" |
| 66 | + platform: macosx_x86_64 |
| 67 | + - os: macos-latest |
| 68 | + python: "39" |
| 69 | + platform: macosx_x86_64 |
| 70 | + - os: macos-latest |
| 71 | + python: "310" |
| 72 | + platform: macosx_x86_64 |
| 73 | + |
| 74 | + steps: |
| 75 | + - name: Checkout numpy |
| 76 | + uses: actions/checkout@v2 |
| 77 | + with: |
| 78 | + submodules: true |
| 79 | + # versioneer.py requires the latest tag to be reachable. Here we |
| 80 | + # fetch the complete history to get access to the tags. |
| 81 | + # A shallow clone can work when the following issue is resolved: |
| 82 | + # https://github.com/actions/checkout/issues/338 |
| 83 | + fetch-depth: 0 |
| 84 | + |
| 85 | + - name: Build wheels |
| 86 | + |
| 87 | + env: |
| 88 | + NPY_USE_BLAS_ILP64: 1 |
| 89 | + CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform }} |
| 90 | + CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 |
| 91 | + CIBW_ENVIRONMENT_LINUX: CFLAGS='-std=c99 -fno-strict-aliasing' |
| 92 | + LDFLAGS='-Wl,--strip-debug' |
| 93 | + OPENBLAS64_=/usr/local |
| 94 | + # MACOS linker doesn't support stripping symbols |
| 95 | + CIBW_ENVIRONMENT_MACOS: CFLAGS='-std=c99 -fno-strict-aliasing' |
| 96 | + OPENBLAS64_=/usr/local |
| 97 | + CIBW_BUILD_VERBOSITY: 3 |
| 98 | + CIBW_BEFORE_BUILD: bash {project}/tools/wheels/cibw_before_build.sh {project} |
| 99 | + CIBW_BEFORE_TEST: pip install -r {project}/test_requirements.txt |
| 100 | + CIBW_TEST_COMMAND: bash {project}/tools/wheels/cibw_test_command.sh {project} |
| 101 | + |
| 102 | + - uses: actions/upload-artifact@v2 |
| 103 | + with: |
| 104 | + path: ./wheelhouse/*.whl |
0 commit comments