Skip to content

Commit 5309a51

Browse files
lesteveogrisel
authored andcommitted
CI Build and test Python 3.12 wheels (#27027)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
1 parent 2d8e03f commit 5309a51

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

.github/workflows/wheels.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ jobs:
6767
- os: windows-latest
6868
python: 311
6969
platform_id: win_amd64
70+
- os: windows-latest
71+
python: 312
72+
platform_id: win_amd64
73+
# TODO: remove when Python 3.12 is released
74+
prerelease: "True"
7075

7176
# Linux 64 bit manylinux2014
7277
- os: ubuntu-latest
@@ -88,6 +93,12 @@ jobs:
8893
python: 311
8994
platform_id: manylinux_x86_64
9095
manylinux_image: manylinux2014
96+
- os: ubuntu-latest
97+
python: 312
98+
platform_id: manylinux_x86_64
99+
manylinux_image: manylinux2014
100+
# TODO: remove when Python 3.12 is released
101+
prerelease: "True"
91102

92103
# MacOS x86_64
93104
- os: macos-latest
@@ -104,7 +115,10 @@ jobs:
104115
platform_id: macosx_x86_64
105116

106117
# MacOS arm64
107-
# The latest Python version is built and tested on CirrusCI
118+
# The wheel for the latest Python version is built and tested on
119+
# Cirrus CI but due to limited build time for free accounts on Cirrus
120+
# CI, we build the macOS arm64 wheels for the other Python versions on
121+
# Github Actions via cross-compilation (without running the tests).
108122
- os: macos-latest
109123
python: 38
110124
platform_id: macosx_arm64
@@ -114,6 +128,9 @@ jobs:
114128
- os: macos-latest
115129
python: 310
116130
platform_id: macosx_arm64
131+
- os: macos-latest
132+
python: 311
133+
platform_id: macosx_arm64
117134

118135
steps:
119136
- name: Checkout scikit-learn
@@ -128,6 +145,7 @@ jobs:
128145
env:
129146
CONFTEST_PATH: ${{ github.workspace }}/conftest.py
130147
CONFTEST_NAME: conftest.py
148+
CIBW_PRERELEASE_PYTHONS: ${{ matrix.prerelease }}
131149
CIBW_ENVIRONMENT: SKLEARN_SKIP_NETWORK_TESTS=1
132150
SKLEARN_BUILD_PARALLEL=3
133151
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}

build_tools/cirrus/arm_wheel.yml

+15-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@ macos_arm64_wheel_task:
1616
# See `maint_tools/update_tracking_issue.py` for details on the permissions the token requires.
1717
BOT_GITHUB_TOKEN: ENCRYPTED[9b50205e2693f9e4ce9a3f0fcb897a259289062fda2f5a3b8aaa6c56d839e0854a15872f894a70fca337dd4787274e0f]
1818
matrix:
19-
# Only the latest Python version is built and tested on CirrusCI, the other
20-
# macos arm64 builds are on GitHub Actions
19+
# Only the latest Python version is built and tested on Cirrus CI, the other
20+
# macOS arm64 builds are on GitHub Actions. The reason is that macOS time is
21+
# 5x more expensive than Linux times on Cirrus CI and the credits are limited
22+
# (for free accounts).
23+
# Note that the macOS arm64 builds are cross compiled on GitHub Actions (without
24+
# running the tests) and while the macOS arm64 build for the latest Python version
25+
# is actually tested on Cirrus CI.
2126
- env:
22-
CIBW_BUILD: cp311-macosx_arm64
27+
CIBW_BUILD: cp312-macosx_arm64
28+
# TODO: remove when Python 3.12 is released
29+
CIBW_PRERELEASE_PYTHONS: True
2330

2431
conda_script:
2532
- curl -L --retry 10 -o ~/mambaforge.sh https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
@@ -68,6 +75,11 @@ linux_arm64_wheel_task:
6875
CIBW_TEST_SKIP: "*_aarch64"
6976
- env:
7077
CIBW_BUILD: cp311-manylinux_aarch64
78+
CIBW_TEST_SKIP: "*_aarch64"
79+
- env:
80+
CIBW_BUILD: cp312-manylinux_aarch64
81+
# TODO: remove when Python 3.12 is released
82+
CIBW_PRERELEASE_PYTHONS: True
7183

7284
cibuildwheel_script:
7385
- apt install -y python3 python-is-python3

build_tools/github/build_minimal_windows_image.sh

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ cp $WHEEL_PATH $WHEEL_NAME
1414
# Dot the Python version for identyfing the base Docker image
1515
PYTHON_VERSION=$(echo ${PYTHON_VERSION:0:1}.${PYTHON_VERSION:1:2})
1616

17+
if [[ "$CIBW_PRERELEASE_PYTHONS" == "True" ]]; then
18+
PYTHON_VERSION="$PYTHON_VERSION-rc"
19+
fi
1720
# Build a minimal Windows Docker image for testing the wheels
1821
docker build --build-arg PYTHON_VERSION=$PYTHON_VERSION \
1922
--build-arg WHEEL_NAME=$WHEEL_NAME \

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ def setup_package():
587587
"Programming Language :: Python :: 3.9",
588588
"Programming Language :: Python :: 3.10",
589589
"Programming Language :: Python :: 3.11",
590+
"Programming Language :: Python :: 3.12",
590591
"Programming Language :: Python :: Implementation :: CPython",
591592
"Programming Language :: Python :: Implementation :: PyPy",
592593
],

0 commit comments

Comments
 (0)