-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup build wheels using cibuildwheel for all systems (#559)
* initial setup of cibuildwheel * skip windows test * revert obsolete change * skip pypy on windows * clean old wheel build configuration * bump cibuildwheel version * fix flake test * limit wheel build run * undo skiping/failing tests * comment win32 steps in build-ocl-windows * use stable ICD on macos * Update scripts/build-ocl-windows.sh Co-authored-by: Andreas Klöckner <[email protected]> * rename file for wheel build * add conda-forge explanation * remove mako from build-system requires * disable mako check for build under cibuildwheel * remove obsolete check of mako * add license information add missed SCRIPT_DIR * try use configure script * musllinux build * Apply suggestions from code review Co-authored-by: Andreas Klöckner <[email protected]> Co-authored-by: Andreas Klöckner <[email protected]>
- Loading branch information
Showing
11 changed files
with
174 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Build and upload to PyPI | ||
|
||
# Build on every branch push, tag push, and pull request change: | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
pull_request: | ||
schedule: | ||
- cron: '17 3 * * 0' | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-20.04, windows-2019, macos-10.15] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
|
||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Build sdist | ||
run: pipx run build --sdist | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
path: dist/*.tar.gz | ||
|
||
upload_pypi: | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
# upload to PyPI on every tag starting with 'v' | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
# alternatively, to publish when a GitHub Release is created, use the following rule: | ||
# if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TWINE_PASSWORD }} | ||
# To test: repository_url: https://test.pypi.org/legacy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,3 +66,5 @@ cffi_build.py | |
.cache | ||
.pytest_cache | ||
.idea | ||
|
||
wheelhouse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[build-system] | ||
# Minimum requirements for the build system to execute. | ||
requires = ["setuptools>=42.0.0", "wheel>=0.34.2", "Cython", "oldest-supported-numpy", "pybind11>=2.5.0"] # PEP 508 specifications. | ||
build-backend = "setuptools.build_meta" | ||
|
||
|
||
[tool.cibuildwheel] | ||
test-command = "pytest {project}/test" | ||
test-extras = ["test"] | ||
|
||
[tool.cibuildwheel.linux] | ||
test-command = "" | ||
before-all = [ | ||
"yum install -y git openssl-devel ruby", | ||
"bash {package}/scripts/build-ocl.sh", | ||
] | ||
|
||
[[tool.cibuildwheel.overrides]] | ||
select = "*-musllinux*" | ||
before-all = [ | ||
"apk add ruby git openssl-dev", | ||
"bash {package}/scripts/build-ocl.sh", | ||
] | ||
|
||
[tool.cibuildwheel.macos] | ||
skip = "pp*" | ||
before-all = "bash {package}/scripts/build-ocl-macos.sh" | ||
test-command = "pytest {project}/test/test_array.py" # same limitation as conda-forge | ||
# https://github.com/conda-forge/pyopencl-feedstock/blob/6f3c5de59b18c9518abba3cb94f6ae92964553f8/recipe/meta.yaml#L62-L63 | ||
|
||
[tool.cibuildwheel.windows] | ||
skip = ["*-win32", "pp*"] | ||
test-command = "" | ||
before-all = "bash {package}/scripts/build-ocl-windows.sh" | ||
before-build = "python configure.py --cxxflags=-ID:/a/pyopencl/pyopencl/OpenCL-Headers/install/include --ldflags=\"/LIBPATH:C:/Program Files/OpenCL-ICD-Loader/lib\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
set -o xtrace | ||
|
||
git clone --branch v2022.01.04 https://github.com/KhronosGroup/OpenCL-ICD-Loader | ||
git clone --branch v2022.01.04 https://github.com/KhronosGroup/OpenCL-Headers | ||
|
||
|
||
|
||
cmake -D CMAKE_INSTALL_PREFIX=./OpenCL-Headers/install -S ./OpenCL-Headers -B ./OpenCL-Headers/build | ||
cmake --build ./OpenCL-Headers/build --target install | ||
|
||
cmake -D CMAKE_PREFIX_PATH=${PWD}/OpenCL-Headers/install -D OPENCL_ICD_LOADER_HEADERS_DIR=${PWD}/OpenCL-Headers/install/include -D CMAKE_INSTALL_PREFIX=./OpenCL-ICD-Loader/install -S ./OpenCL-ICD-Loader -B ./OpenCL-ICD-Loader/build | ||
cmake --build ./OpenCL-ICD-Loader/build --target install --config Release | ||
|
||
echo "PyOpenCL wheel includes Khronos Group OpenCL-ICD-Loader which is licensed as below" >> ${SCRIPT_DIR}/../LICENSE | ||
cat ./OpenCL-ICD-Loader/LICENSE >> ${SCRIPT_DIR}/../LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
set -o xtrace | ||
|
||
git clone --branch v2022.01.04 https://github.com/KhronosGroup/OpenCL-ICD-Loader | ||
|
||
git clone --branch v2022.01.04 https://github.com/KhronosGroup/OpenCL-Headers | ||
|
||
|
||
cmake -D CMAKE_INSTALL_PREFIX=./OpenCL-Headers/install -S ./OpenCL-Headers -B ./OpenCL-Headers/build | ||
cmake --build ./OpenCL-Headers/build --target install | ||
|
||
# if someone would like to try to create win32 wheels bellow lines may be useful | ||
# cmake -D CMAKE_PREFIX_PATH=${PWD}/OpenCL-Headers/install -DOPENCL_ICD_LOADER_HEADERS_DIR=${PWD}/OpenCL-Headers/install/include -S ./OpenCL-ICD-Loader -B ./OpenCL-ICD-Loader/build | ||
# cmake --build ./OpenCL-ICD-Loader/build --target install --config Release | ||
|
||
cmake -D CMAKE_PREFIX_PATH=${PWD}/OpenCL-Headers/install -D OPENCL_ICD_LOADER_HEADERS_DIR=${PWD}/OpenCL-Headers/install/include -S ./OpenCL-ICD-Loader -B ./OpenCL-ICD-Loader/build2 -A x64 | ||
cmake --build ./OpenCL-ICD-Loader/build2 --target install --config Release | ||
|
||
echo "PyOpenCL wheel includes Khronos Group OpenCL-ICD-Loader which is licensed as below" >> ${SCRIPT_DIR}/../LICENSE | ||
cat ./OpenCL-ICD-Loader/LICENSE >> ${SCRIPT_DIR}/../LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
set -e -x | ||
|
||
mkdir -p ~/deps | ||
cd ~/deps | ||
|
||
git clone --branch v2.3.1 https://github.com/OCL-dev/ocl-icd | ||
cd ocl-icd | ||
curl -L -O https://raw.githubusercontent.com/conda-forge/ocl-icd-feedstock/e2c03e3ddb1ff86630ccf80dc7b87a81640025ea/recipe/install-headers.patch | ||
git apply install-headers.patch | ||
curl -L -O https://github.com/isuruf/ocl-icd/commit/3862386b51930f95d9ad1089f7157a98165d5a6b.patch | ||
git apply 3862386b51930f95d9ad1089f7157a98165d5a6b.patch | ||
autoreconf -i | ||
chmod +x configure | ||
./configure --prefix=/usr | ||
make -j4 | ||
make install | ||
|
||
# Bundle license files | ||
echo "PyOpenCL wheel includes ocl-icd which is licensed as below" >> ${SCRIPT_DIR}/../LICENSE | ||
cat ~/deps/ocl-icd/COPYING >> ${SCRIPT_DIR}/../LICENSE |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters