Skip to content

Commit

Permalink
Build Windows binary wheels and update wheel builder (#849)
Browse files Browse the repository at this point in the history
* Try Windows wheel build.

* Change runner.

* Add vcpkg cache and update cibuildwheel version.

* Re-enable other platforms.

* Fix.

* Set macOS deployment target.

* Fix syntax.
  • Loading branch information
jhale authored Sep 18, 2024
1 parent 891e9a1 commit 3f29895
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-13, macos-14]
os: [ubuntu-latest, macos-13, macos-14, windows-2022]

steps:
- uses: actions/checkout@v4
Expand All @@ -53,8 +53,16 @@ jobs:
with:
platforms: arm64

- name: Export GitHub Actions cache environment variables
if: runner.os == 'Windows'
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Build wheels
uses: pypa/cibuildwheel@v2.17
uses: pypa/cibuildwheel@v2.21.1

- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down
24 changes: 23 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ build = [
"cp{39,310,311,312}-manylinux_aarch64",
"cp{39,310,311,312}-macosx_x86_64",
"cp{39,310,311,312}-macosx_arm64",
"cp{39,310,311,312}-win_amd64",
]
test-command = [
"cmake -G Ninja -DPython3_EXECUTABLE=$(which python) -B build-dir -S {project}/test/test_cmake",
Expand All @@ -51,21 +52,42 @@ test-command = [
test-requires = ["pytest-xdist"]
test-extras = ["test"]
test-skip = "*-macosx_arm64 *-*linux_aarch64"
manylinux-x86_64-image = "quay.io/pypa/manylinux_2_28_x86_64:2024-04-08-4c11606"
manylinux-x86_64-image = "quay.io/pypa/manylinux_2_28_x86_64:2024-09-16-ab73a4b"
manylinux-aarch64-image = "quay.io/pypa/manylinux_2_28_aarch64:2024-09-16-ab73a4b"

[tool.cibuildwheel.windows]
before-build = "pip install scikit-build-core[pyproject] git+https://github.com/jhale/nanobind.git@jhale/msvc2022-workaround setuptools wheel"
build-frontend = {name = "pip", args = ["--no-build-isolation", "--config-settings=cmake.args=-DINSTALL_RUNTIME_DEPENDENCIES=ON", "--config-settings=cmake.args=-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake"] }
test-command = [
"python -m pytest -v -n auto --durations 20 {project}/test/",
]

[tool.cibuildwheel.linux]
archs = [
"x86_64",
"aarch64",
] # Forces arm64 build on x86_64 runner using emulation.
before-build = "yum -y update && yum install -y epel-release && yum install -y openblas-devel ninja-build"
test-command = [
"cmake -G Ninja -DPython3_EXECUTABLE=$(which python) -B build-dir -S {project}/test/test_cmake",
"cmake --build build-dir/",
"build-dir/a.out",
"python -m pytest -v -n auto --durations 20 {project}/test/",
]

[tool.cibuildwheel.macos]
environment = { "MACOSX_DEPLOYMENT_TARGET" = "10.14" }
archs = [
"x86_64",
"arm64",
] # Forces arm64 build on x86_64 runner using cross-compilation.
before-build = "export HOMEBREW_AUTO_UPDATING=0 && brew update && brew install ninja"
test-command = [
"cmake -G Ninja -DPython3_EXECUTABLE=$(which python) -B build-dir -S {project}/test/test_cmake",
"cmake --build build-dir/",
"build-dir/a.out",
"python -m pytest -v -n auto --durations 20 {project}/test/",
]

[tool.mypy]
ignore_missing_imports = true
Expand Down

0 comments on commit 3f29895

Please sign in to comment.