|
| 1 | +# Workflow to build and test wheels |
| 2 | +name: Wheel builder |
| 3 | + |
| 4 | +on: |
| 5 | + schedule: |
| 6 | + # Nightly build at 3:42 A.M. |
| 7 | + - cron: "42 3 */1 * *" |
| 8 | + push: |
| 9 | + branches: |
| 10 | + # Release branches |
| 11 | + - "[0-9]+.[0-9]+.X" |
| 12 | + pull_request: |
| 13 | + branches: |
| 14 | + - master |
| 15 | + - "[0-9]+.[0-9]+.X" |
| 16 | + |
| 17 | +env: |
| 18 | + SCIKIT_LEARN_VERSION: 0.24.dev0 |
| 19 | + |
| 20 | +jobs: |
| 21 | + # Check whether to build the wheels and the source tarball |
| 22 | + check_build_trigger: |
| 23 | + name: Check build trigger |
| 24 | + runs-on: ubuntu-latest |
| 25 | + outputs: |
| 26 | + build: ${{ steps.check_build_trigger.outputs.build }} |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout scikit-learn |
| 30 | + uses: actions/checkout@v1 |
| 31 | + |
| 32 | + - id: check_build_trigger |
| 33 | + name: Check build trigger |
| 34 | + run: bash build_tools/github/check_build_trigger.sh |
| 35 | + |
| 36 | + # Build the wheels for Linux, Windows and macOS for Python 3.6 and newer |
| 37 | + build_wheels: |
| 38 | + name: Build wheels on ${{ matrix.os }} for Python ${{ matrix.python }} |
| 39 | + runs-on: ${{ matrix.os }} |
| 40 | + needs: check_build_trigger |
| 41 | + if: needs.check_build_trigger.outputs.build |
| 42 | + |
| 43 | + strategy: |
| 44 | + # Ensure that a wheel builder finishes even if another fails |
| 45 | + fail-fast: false |
| 46 | + matrix: |
| 47 | + os: [windows-latest, ubuntu-latest, macos-latest] |
| 48 | + python: [36, 37, 38, 39] |
| 49 | + |
| 50 | + steps: |
| 51 | + - name: Checkout scikit-learn |
| 52 | + uses: actions/checkout@v1 |
| 53 | + |
| 54 | + - name: Setup Python |
| 55 | + uses: actions/setup-python@v2 |
| 56 | + |
| 57 | + - name: Build and test wheels |
| 58 | + env: |
| 59 | + # Set the directory where the wheel is unpacked |
| 60 | + CIBW_ENVIRONMENT: "WHEEL_DIRNAME=scikit_learn-$SCIKIT_LEARN_VERSION" |
| 61 | + CIBW_BUILD: cp${{ matrix.python }}-* |
| 62 | + CIBW_TEST_REQUIRES: pytest pandas threadpoolctl |
| 63 | + # Test that there are no links to system libraries |
| 64 | + CIBW_TEST_COMMAND: pytest --pyargs sklearn && |
| 65 | + python -m threadpoolctl -i sklearn |
| 66 | + # By default, the Windows wheels are not repaired. |
| 67 | + # In this case, we need to vendor the vcomp140.dll |
| 68 | + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: wheel unpack {wheel} && |
| 69 | + python build_tools/github/vendor_vcomp140.py %WHEEL_DIRNAME% && |
| 70 | + wheel pack %WHEEL_DIRNAME% -d {dest_dir} && |
| 71 | + rmdir /s /q %WHEEL_DIRNAME% |
| 72 | + |
| 73 | + run: bash build_tools/github/build_wheels.sh |
| 74 | + |
| 75 | + - name: Store artifacts |
| 76 | + uses: actions/upload-artifact@v2 |
| 77 | + with: |
| 78 | + path: wheelhouse/*.whl |
| 79 | + |
| 80 | + # Build the source distribution under Linux |
| 81 | + build_sdist: |
| 82 | + name: Source distribution |
| 83 | + runs-on: ubuntu-latest |
| 84 | + needs: check_build_trigger |
| 85 | + if: needs.check_build_trigger.outputs.build |
| 86 | + |
| 87 | + steps: |
| 88 | + - name: Checkout scikit-learn |
| 89 | + uses: actions/checkout@v1 |
| 90 | + |
| 91 | + - name: Setup Python |
| 92 | + uses: actions/setup-python@v2 |
| 93 | + |
| 94 | + - name: Build and test source distribution |
| 95 | + run: bash build_tools/github/build_source.sh |
| 96 | + |
| 97 | + - name: Store artifacts |
| 98 | + uses: actions/upload-artifact@v2 |
| 99 | + with: |
| 100 | + path: dist/*.tar.gz |
| 101 | + |
| 102 | + # Upload the wheels and the source distribution |
| 103 | + upload_anaconda: |
| 104 | + name: Upload to Anaconda |
| 105 | + runs-on: ubuntu-latest |
| 106 | + needs: [build_wheels, build_sdist] |
| 107 | + # The artifacts are not be uploaded on PRs |
| 108 | + if: github.event_name != 'pull_request' |
| 109 | + |
| 110 | + steps: |
| 111 | + - name: Download artifacts |
| 112 | + uses: actions/download-artifact@v2 |
| 113 | + with: |
| 114 | + path: dist |
| 115 | + |
| 116 | + - name: Setup Python |
| 117 | + uses: actions/setup-python@v2 |
| 118 | + |
| 119 | + - name: Upload artifacts |
| 120 | + env: |
| 121 | + # Secret variables need to be mapped to environment variables explicitly |
| 122 | + SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN: ${{ secrets.SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN }} |
| 123 | + SCIKIT_LEARN_STAGING_UPLOAD_TOKEN: ${{ secrets.SCIKIT_LEARN_STAGING_UPLOAD_TOKEN }} |
| 124 | + # Force a replacement if the remote file already exists |
| 125 | + run: bash build_tools/github/upload_anaconda.sh |
0 commit comments