1
+ # Github Actions script to produce binary wheels.
2
+ #
3
+ # Note that a lot of the cibuildwheel config is in pyproject.toml.
4
+ #
5
+ # We perform one build for each wheel that we generate, i.e. one per architecture.
6
+ # In download_wgpu_native.py, we detect CIBW_PLATFORM and CIBW_ARCHS to determine
7
+ # the required binary from wgpu-native.
8
+ #
9
+ # If https://github.com/pypa/cibuildwheel/issues/944 gets implemented, we can build more wheels per build.
10
+ #
11
+ # Also includes the sdist build that does not include a binary.
12
+
13
+
1
14
name : CD
2
15
3
16
on :
11
24
12
25
jobs :
13
26
14
- # The release builds are done for the platforms that we want to build wheels for.
15
- # We build wheels, test them, and then upload the wheel as an artifact.
16
27
release-builds :
17
- name : Build wheels on ${{ matrix.os }}
28
+ name : Build wheel for ${{ matrix.platform }} ${{ matrix.arch }}
18
29
timeout-minutes : 10
19
30
runs-on : ${{ matrix.os }}
20
31
strategy :
21
32
fail-fast : false
22
33
matrix :
23
- os : [ubuntu-latest, windows-latest, macos-latest]
34
+ include :
35
+ - platform : windows
36
+ arch : AMD64
37
+ os : windows-latest
38
+ testable : true
39
+ - platform : windows
40
+ arch : ARM64
41
+ os : windows-latest
42
+ - platform : windows
43
+ arch : x86
44
+ os : windows-latest
45
+ - platform : macos
46
+ arch : arm64
47
+ os : macos-latest
48
+ testable : true
49
+ - platform : macos
50
+ arch : x86_64
51
+ os : macos-13 # last Intel MacOS
52
+ cibw_version : ' ==2.16' # delocation does not work for later versions
53
+ - platform : linux
54
+ arch : x86_64
55
+ os : ubuntu-latest
56
+ testable : true
57
+ - platform : linux
58
+ arch : aarch64
59
+ os : ubuntu-latest
24
60
steps :
25
61
- uses : actions/checkout@v4
26
- - name : Set up Python
27
- uses : actions/setup-python@v5
62
+ - name : Set up QEMU
63
+ if : matrix.platform == 'linux' && matrix.arch == 'aarch64'
64
+ uses : docker/setup-qemu-action@v3
28
65
with :
29
- python-version : ' 3.9 '
66
+ platforms : arm64
30
67
- name : Install dev dependencies
31
68
run : |
32
- python -m pip install --upgrade pip wheel setuptools twine
69
+ python -m pip install --upgrade pip wheel setuptools twine cibuildwheel${{ matrix.cibw_version}}
33
70
- name : Build wheels
34
- # Use v2.16, v2.20 fails the osx builds
35
-
71
+ run : python -m cibuildwheel --output-dir dist
36
72
env :
37
- CIBW_MANYLINUX_X86_64_IMAGE : quay.io/pypa/manylinux_2_28_x86_64
38
- CIBW_ARCHS_LINUX : x86_64
39
- CIBW_SKIP : cp39-musllinux_x86_64
40
- with :
41
- output-dir : dist
73
+ CIBW_PLATFORM : ${{ matrix.platform }}
74
+ CIBW_ARCHS : ${{ matrix.arch }}
42
75
- name : Twine check
43
76
run : |
44
77
twine check dist/*
78
+ - name : Test wheel
79
+ if : matrix.testable
80
+ shell : bash
81
+ run : |
82
+ rm -rf ./wgpu
83
+ filename=$(ls dist/*.whl)
84
+ pip install $filename
85
+ pushd $HOME
86
+ python -c 'import wgpu.backends.wgpu_native; print(wgpu.backends.wgpu_native._ffi.lib_path)'
87
+ popd
88
+ pip uninstall -y wgpu
89
+ git reset --hard HEAD
45
90
- name : Upload distributions
46
91
uses : actions/upload-artifact@v4
47
92
with :
48
93
path : dist
49
- name : ${{ matrix.os }}-build
94
+ name : ${{ matrix.platform }}-${{ matrix.arch }}-build
50
95
51
- # These release builds uses QEMU so that we can build wheels for arm64.
52
- # We build wheels and upload the wheel as an artifact, but we don't test them here.
53
- qemu-release-builds :
54
- name : Build wheels on ubuntu-latest with QEMU
55
- timeout-minutes : 10
56
- runs-on : ubuntu-latest
57
- strategy :
58
- fail-fast : false
59
- steps :
60
- - uses : actions/checkout@v4
61
- - name : Set up QEMU
62
- uses : docker/setup-qemu-action@v3
63
- with :
64
- platforms : arm64
65
- - name : Build wheels
66
-
67
- env :
68
- CIBW_MANYLINUX_AARCH64_IMAGE : quay.io/pypa/manylinux_2_28_aarch64
69
- CIBW_ARCHS_LINUX : aarch64
70
- CIBW_SKIP : cp39-musllinux_aarch64
71
- with :
72
- output-dir : dist
73
- - name : Upload distributions
74
- uses : actions/upload-artifact@v4
75
- with :
76
- path : dist
77
- name : qemu-build
78
96
79
97
sdist-build :
80
98
name : Build sdist
99
117
shell : bash
100
118
run : |
101
119
rm -rf ./wgpu
102
- pushd $HOME
103
- pip install $GITHUB_WORKSPACE/dist/*.tar.gz
104
- popd
120
+ filename=$(ls dist/*.tar.gz)
121
+ pip install $filename
105
122
# don't run tests, we just want to know if the sdist can be installed
106
123
pip uninstall -y wgpu
107
124
git reset --hard HEAD
@@ -114,10 +131,11 @@ jobs:
114
131
path : dist
115
132
name : sdist-build
116
133
134
+
117
135
publish :
118
136
name : Publish to Github and Pypi
119
137
runs-on : ubuntu-latest
120
- needs : [release-builds, qemu-release-builds, sdist-build]
138
+ needs : [release-builds, sdist-build]
121
139
if : success() && startsWith(github.ref, 'refs/tags/v')
122
140
steps :
123
141
- uses : actions/checkout@v4
0 commit comments