Skip to content

Build Wheels

Build Wheels #44

Workflow file for this run

name: Build Wheels
on:
workflow_dispatch:
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
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
platform_id: win_amd64
- os: windows-latest
python: 39
platform_id: win_amd64
- os: windows-latest
python: 310
platform_id: win_amd64
- os: windows-latest
python: 311
platform_id: win_amd64
# Linux 64 bit manylinux2014
- os: ubuntu-latest
python: 38
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
- os: ubuntu-latest
python: 39
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
# NumPy on Python 3.10 only supports 64bit and is only available with manylinux2014
- os: ubuntu-latest
python: 310
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
- os: ubuntu-latest
python: 311
platform_id: manylinux_x86_64
manylinux_image: manylinux2014
# MacOS x86_64
- os: macos-latest
python: 38
platform_id: macosx_x86_64
- os: macos-latest
python: 39
platform_id: macosx_x86_64
- os: macos-latest
python: 310
platform_id: macosx_x86_64
- os: macos-latest
python: 311
platform_id: macosx_x86_64
# MacOS arm64
- os: macos-latest
python: 38
platform_id: macosx_arm64
- os: macos-latest
python: 39
platform_id: macosx_arm64
- os: macos-latest
python: 310
platform_id: macosx_arm64
- os: macos-latest
python: 311
platform_id: macosx_arm64
steps:
- name: Check out pdc-dp-means
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
shell: bash
- name: Build wheels with cibuildwheel
uses: pypa/[email protected]
with:
output-dir: wheelhouse
env:
CIBW_BEFORE_BUILD_LINUX: |
pip install -U cython
git clone https://github.com/scikit-learn/scikit-learn.git
cd scikit-learn
git checkout 1.2.X
python -m pip install -e .
cd ..
if [ ! -L sklearn ]; then
ln -s scikit-learn/sklearn .
fi
CIBW_BEFORE_BUILD_WINDOWS: >-
echo "Installing Cython" && pip install -U cython &&
echo "Cloning scikit-learn" && git clone https://github.com/scikit-learn/scikit-learn.git &&
echo "Entering scikit-learn directory" && cd scikit-learn &&
echo "Checking out 1.2.X" && git checkout 1.2.X &&
echo "Installing scikit-learn" && python -m pip install -e . &&
echo "Returning to root directory" && cd .. &&
echo "Copying sklearn" && xcopy /E /I scikit-learn\sklearn sklearn &&
echo "Listing directory contents" && dir &&
dir sklearn
CIBW_BEFORE_BUILD_MACOS: |
pip install -U cython
git clone https://github.com/scikit-learn/scikit-learn.git
cd scikit-learn
git checkout 1.2.X
python -m pip install -e .
cd ..
if [ ! -e sklearn ]; then
ln -s scikit-learn/sklearn .
fi
CIBW_TEST_REQUIRES: pytest numpy scikit-learn
CIBW_TEST_COMMAND: pytest {package}/tests
CIBW_ARCHS: all
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
CIBW_TEST_SKIP: "*-macosx_arm64"
- name: Publish artifacts
uses: actions/upload-artifact@v2
with:
path: |
./wheelhouse/*.whl
upload-to-pypi:
needs: build_wheels
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- name: Publish to PyPI
uses: pypa/[email protected]
with:
packages-dir: dist
skip-existing: true