-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* More binary builds v2 * fix version * fix archs * lets see what happens * fix cd script * typo * wut * ok, need true platform * comment and fix * fix builds * more fix * better test * fix test * fix win * try again * safer * add pushd * cannot install deps with no-index * maybe like this * had an extta popd * sod it * comments * try windows test
- Loading branch information
1 parent
9a9f7a7
commit 64ede94
Showing
3 changed files
with
122 additions
and
82 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
# Github Actions script to produce binary wheels. | ||
# | ||
# Note that a lot of the cibuildwheel config is in pyproject.toml. | ||
# | ||
# We perform one build for each wheel that we generate, i.e. one per architecture. | ||
# In download_wgpu_native.py, we detect CIBW_PLATFORM and CIBW_ARCHS to determine | ||
# the required binary from wgpu-native. | ||
# | ||
# If https://github.com/pypa/cibuildwheel/issues/944 gets implemented, we can build more wheels per build. | ||
# | ||
# Also includes the sdist build that does not include a binary. | ||
|
||
|
||
name: CD | ||
|
||
on: | ||
|
@@ -11,70 +24,75 @@ on: | |
|
||
jobs: | ||
|
||
# The release builds are done for the platforms that we want to build wheels for. | ||
# We build wheels, test them, and then upload the wheel as an artifact. | ||
release-builds: | ||
name: Build wheels on ${{ matrix.os }} | ||
name: Build wheel for ${{ matrix.platform }} ${{ matrix.arch }} | ||
timeout-minutes: 10 | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
include: | ||
- platform: windows | ||
arch: AMD64 | ||
os: windows-latest | ||
testable: true | ||
- platform: windows | ||
arch: ARM64 | ||
os: windows-latest | ||
- platform: windows | ||
arch: x86 | ||
os: windows-latest | ||
- platform: macos | ||
arch: arm64 | ||
os: macos-latest | ||
testable: true | ||
- platform: macos | ||
arch: x86_64 | ||
os: macos-13 # last Intel MacOS | ||
cibw_version: '==2.16' # delocation does not work for later versions | ||
- platform: linux | ||
arch: x86_64 | ||
os: ubuntu-latest | ||
testable: true | ||
- platform: linux | ||
arch: aarch64 | ||
os: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
- name: Set up QEMU | ||
if: matrix.platform == 'linux' && matrix.arch == 'aarch64' | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
python-version: '3.9' | ||
platforms: arm64 | ||
- name: Install dev dependencies | ||
run: | | ||
python -m pip install --upgrade pip wheel setuptools twine | ||
python -m pip install --upgrade pip wheel setuptools twine cibuildwheel${{ matrix.cibw_version}} | ||
- name: Build wheels | ||
# Use v2.16, v2.20 fails the osx builds | ||
uses: pypa/[email protected] | ||
run: python -m cibuildwheel --output-dir dist | ||
env: | ||
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64 | ||
CIBW_ARCHS_LINUX: x86_64 | ||
CIBW_SKIP: cp39-musllinux_x86_64 | ||
with: | ||
output-dir: dist | ||
CIBW_PLATFORM: ${{ matrix.platform }} | ||
CIBW_ARCHS: ${{ matrix.arch }} | ||
- name: Twine check | ||
run: | | ||
twine check dist/* | ||
- name: Test wheel | ||
if: matrix.testable | ||
shell: bash | ||
run: | | ||
rm -rf ./wgpu | ||
filename=$(ls dist/*.whl) | ||
pip install $filename | ||
pushd $HOME | ||
python -c 'import wgpu.backends.wgpu_native; print(wgpu.backends.wgpu_native._ffi.lib_path)' | ||
popd | ||
pip uninstall -y wgpu | ||
git reset --hard HEAD | ||
- name: Upload distributions | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: dist | ||
name: ${{ matrix.os }}-build | ||
name: ${{ matrix.platform }}-${{ matrix.arch }}-build | ||
|
||
# These release builds uses QEMU so that we can build wheels for arm64. | ||
# We build wheels and upload the wheel as an artifact, but we don't test them here. | ||
qemu-release-builds: | ||
name: Build wheels on ubuntu-latest with QEMU | ||
timeout-minutes: 10 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: arm64 | ||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_MANYLINUX_AARCH64_IMAGE: quay.io/pypa/manylinux_2_28_aarch64 | ||
CIBW_ARCHS_LINUX: aarch64 | ||
CIBW_SKIP: cp39-musllinux_aarch64 | ||
with: | ||
output-dir: dist | ||
- name: Upload distributions | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: dist | ||
name: qemu-build | ||
|
||
sdist-build: | ||
name: Build sdist | ||
|
@@ -99,9 +117,8 @@ jobs: | |
shell: bash | ||
run: | | ||
rm -rf ./wgpu | ||
pushd $HOME | ||
pip install $GITHUB_WORKSPACE/dist/*.tar.gz | ||
popd | ||
filename=$(ls dist/*.tar.gz) | ||
pip install $filename | ||
# don't run tests, we just want to know if the sdist can be installed | ||
pip uninstall -y wgpu | ||
git reset --hard HEAD | ||
|
@@ -114,10 +131,11 @@ jobs: | |
path: dist | ||
name: sdist-build | ||
|
||
|
||
publish: | ||
name: Publish to Github and Pypi | ||
runs-on: ubuntu-latest | ||
needs: [release-builds, qemu-release-builds, sdist-build] | ||
needs: [release-builds, sdist-build] | ||
if: success() && startsWith(github.ref, 'refs/tags/v') | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
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 |
---|---|---|
@@ -1,33 +1,31 @@ | ||
[build-system] | ||
requires = [ | ||
"setuptools>=42", | ||
] | ||
requires = ["setuptools>=42"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
|
||
[tool.cibuildwheel] | ||
# we only build on one python version since the wheels are not bound to it | ||
build = "cp39-*" | ||
|
||
# we can't list requests under build-system.requires because | ||
# that step happens _after_ the before-build command | ||
build = "cp312-*" | ||
# Print system info before build | ||
before-all = "uname -a" | ||
# Can't list requests under build-system.requires because that step happens _after_ the before-build command | ||
before-build = "pip install requests && python download-wgpu-native.py" | ||
|
||
# this is sufficient to trigger an install of the built wheel | ||
# This is sufficient to trigger an install of the built wheel | ||
test-command = "echo Wheel installed" | ||
|
||
# this is the minimum supported manylinux version | ||
manylinux-x86_64-image = "manylinux_2_24" | ||
manylinux-i686-image = "manylinux_2_24" | ||
manylinux-aarch64-image = "manylinux_2_24" | ||
manylinux-ppc64le-image = "manylinux_2_24" | ||
manylinux-s390x-image = "manylinux_2_24" | ||
manylinux-pypy_x86_64-image = "manylinux_2_24" | ||
manylinux-pypy_i686-image = "manylinux_2_24" | ||
manylinux-pypy_aarch64-image = "manylinux_2_24" | ||
[tool.cibuildwheel.windows] | ||
# Only for local use, overridden in cd.yml | ||
archs = ["amd64"] | ||
|
||
[tool.cibuildwheel.macos] | ||
# also create apple silicon wheels | ||
archs = ["x86_64", "arm64"] | ||
# Only for local use, overridden in cd.yml | ||
archs = ["arm64"] | ||
|
||
# the upstream binaries are not universal yet | ||
# archs = ["x86_64", "universal2", "arm64"] | ||
[tool.cibuildwheel.linux] | ||
# wgpu-native does not build for musllinux yet | ||
skip = "*musllinux*" | ||
# Use custom images, with minimal version that matches wgpu-native | ||
manylinux-x86_64-image = "quay.io/pypa/manylinux_2_28_x86_64" | ||
manylinux-aarch64-image = "quay.io/pypa/manylinux_2_28_aarch64" | ||
manylinux-i686-image = "quay.io/pypa/manylinux_2_28_i686" | ||
manylinux-ppc64le-image = "quay.io/pypa/manylinux_2_28_ppc64le" |