diff --git a/.github/scripts/Windows b/.github/scripts/Windows new file mode 100644 index 000000000..a9971aa52 --- /dev/null +++ b/.github/scripts/Windows @@ -0,0 +1,13 @@ +# Get the Python version of the base image from a build argument +ARG PYTHON_VERSION +FROM winamd64/python:$PYTHON_VERSION-windowsservercore + +ARG WHEEL_NAME +ARG CIBW_TEST_REQUIRES + +# Copy and install the Windows wheel +COPY $WHEEL_NAME $WHEEL_NAME +RUN pip install $env:WHEEL_NAME + +# Install the testing dependencies +RUN pip install $env:CIBW_TEST_REQUIRES.split(" ") diff --git a/.github/scripts/build-minimal-windows-image.sh b/.github/scripts/build-minimal-windows-image.sh new file mode 100644 index 000000000..b38ff0bd5 --- /dev/null +++ b/.github/scripts/build-minimal-windows-image.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e +set -x + +PYTHON_VERSION=$1 + +TEMP_FOLDER="$HOME/AppData/Local/Temp" +WHEEL_PATH=$(ls -d $TEMP_FOLDER/**/*/repaired_wheel/*) +WHEEL_NAME=$(basename $WHEEL_PATH) + +cp $WHEEL_PATH $WHEEL_NAME + +# Dot the Python version for identyfing the base Docker image +PYTHON_VERSION=$(echo ${PYTHON_VERSION:0:1}.${PYTHON_VERSION:1:2}) + +if [[ "$CIBW_PRERELEASE_PYTHONS" == "True" ]]; then + PYTHON_VERSION="$PYTHON_VERSION-rc" +fi +# Build a minimal Windows Docker image for testing the wheels +docker build --build-arg PYTHON_VERSION=$PYTHON_VERSION \ + --build-arg WHEEL_NAME=$WHEEL_NAME \ + --build-arg CIBW_TEST_REQUIRES="$CIBW_TEST_REQUIRES" \ + -f ./.github/Windows \ + -t coincurve/minimal-windows . \ No newline at end of file diff --git a/.github/scripts/test-windows-wheels.sh b/.github/scripts/test-windows-wheels.sh new file mode 100644 index 000000000..f2febbb32 --- /dev/null +++ b/.github/scripts/test-windows-wheels.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e +set -x + +PYTHON_VERSION=$1 + +docker container run --rm scikit-learn/minimal-windows \ + powershell -Command "pytest" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9908ddf7d..b99ae2674 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,6 +92,29 @@ jobs: path: wheelhouse/*.whl if-no-files-found: error + windows-wheels-standard: + name: Build Windows wheels + needs: + - test + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.16.2 + env: + CIBW_BEFORE_TEST_WINDOWS: bash {project}/.github/scripts/build-minimal-windows-image.sh 312 + CIBW_TEST_COMMAND_WINDOWS: bash {project}/.github/scripts/test-windows-wheels.sh 312 + CIBW_TEST_REQUIRES: pytest pytest-benchmark + CIBW_TEST_COMMAND: python -m pytest {project}/tests + + - uses: actions/upload-artifact@v3 + with: + name: artifacts + path: wheelhouse/*.whl + if-no-files-found: error + macos-wheels-x86-64: name: Build macOS wheels needs: