1+ # Copyright 2025 Adobe
2+ # All Rights Reserved.
3+ #
4+ # NOTICE: Adobe permits you to use, modify, and distribute this file in
5+ # accordance with the terms of the Adobe license agreement accompanying
6+ # it.
17name : Build Dawn WebGPU
28
39on :
1218 - stable
1319 - beta
1420 - canary
21+ config :
22+ description : " Configuration"
23+ required : false
24+ default : " release"
25+ type : choice
26+ options :
27+ - release
28+ - debug
1529
16- env :
17- DAWN_CHANNEL : ${{ github.event.inputs.channel || 'canary' }}
30+ workflow_call :
31+ inputs :
32+ channel :
33+ description : " Chromium channel for Dawn"
34+ required : false
35+ default : " canary"
36+ type : choice
37+ options :
38+ - stable
39+ - beta
40+ - canary
41+ config :
42+ description : " Configuration"
43+ required : false
44+ default : " release"
45+ type : choice
46+ options :
47+ - release
48+ - debug
49+ secrets :
50+ GITHUB_TOKEN :
51+ required : true
1852
1953jobs :
20- get-dawn-source :
54+ get-dawn-version :
2155 runs-on : ubuntu-latest
22-
56+ outputs :
57+ chromium_channel : ${{ steps.read-version.outputs.chromium_channel }}
58+ chromium_dawn_version : ${{ steps.read-version.outputs.chromium_dawn_version }}
59+ chromium_dawn_hash : ${{ steps.read-version.outputs.chromium_dawn_hash }}
60+ chromium_dawn_suffix : ${{ steps.read-version.outputs.chromium_dawn_suffix }}
2361 steps :
2462 - name : Checkout code
2563 uses : actions/checkout@v4
@@ -35,18 +73,16 @@ jobs:
3573 cd Dawn
3674 pip install -r requirements.txt
3775
38- - name : Get Dawn source
76+ - name : Get Dawn version
3977 run : |
4078 cd Dawn
41- python ci_build_dawn.py get-dawn --channel ${{ env.DAWN_CHANNEL }}
79+ python ci_build_dawn.py get-dawn-version --channel ${{ github.event.inputs.channel }}
4280
43- - name : Upload Dawn source
81+ - name : Upload Dawn Version
4482 uses : actions/upload-artifact@v4
4583 with :
46- name : dawn-source
47- path : |
48- Dawn/dawn_source/
49- !Dawn/dawn_source/.git
84+ name : dawn-version
85+ path : Dawn/dawn_version.json
5086 retention-days : 1
5187
5288 - name : Read Dawn version
6399 echo "chromium_dawn_suffix=$value" >> $GITHUB_OUTPUT
64100
65101 build-dawn :
66- needs : get-dawn-source
102+ needs : get-dawn-version
67103 strategy :
68104 matrix :
69105 include :
@@ -89,6 +125,12 @@ jobs:
89125 - name : Checkout code
90126 uses : actions/checkout@v4
91127
128+ - name : Install prerequisites on Linux
129+ if : matrix.platform == 'ubuntu-latest'
130+ run : |
131+ sudo apt-get update
132+ sudo apt-get install -y build-essential clang cmake curl git gnupg2 libcurl4-openssl-dev libpython3-dev libssl-dev libx11-xcb-dev libxcursor-dev libxi-dev libxinerama-dev libxml2-dev libxrandr-dev libz-dev libz3-dev mesa-common-dev ninja-build pkg-config python3 python3-pip python3-venv tzdata unzip wget
133+
92134 - name : Set up Python
93135 uses : actions/setup-python@v5
94136 with :
@@ -101,27 +143,37 @@ jobs:
101143 pip install -r requirements.txt
102144
103145 - name : Download Dawn source
104- uses : actions/download-artifact@v5
105- with :
106- name : dawn-source
107- path : Dawn/dawn_source/
146+ run : |
147+ cd Dawn
148+ python ci_build_dawn.py get-source --hash ${{ needs.get-dawn-version.outputs.chromium_dawn_hash }}
108149
109150 - name : Build Dawn for ${{ matrix.target }}
110151 run : |
111152 cd Dawn
112- python ci_build_dawn.py build-target --target ${{ matrix.target }}
153+ python ci_build_dawn.py build-target --target ${{ matrix.target }} --config ${{ env.DAWN_CONFIG }}
113154
114155 - name : Upload build artifacts
115156 uses : actions/upload-artifact@v4
116157 with :
117158 name : dawn-build-${{ matrix.target }}
118- path : Dawn/builds/
159+ path : |
160+ Dawn/builds/
161+ !Dawn/builds/*/out
162+ retention-days : 1
163+
164+ - name : Upload dawn.json
165+ if : matrix.platform == 'ubuntu-latest'
166+ uses : actions/upload-artifact@v4
167+ with :
168+ name : dawn-json
169+ path : Dawn/dawn_source/src/dawn/dawn.json
119170 retention-days : 1
120171
121172 create-bundle :
122- needs : [build-dawn, get-dawn-source ]
173+ needs : [build-dawn, get-dawn-version ]
123174 runs-on : ubuntu-latest
124-
175+ outputs :
176+ bundle_name : ${{ steps.set-bundle-name.outputs.bundle_name }}
125177 steps :
126178 - name : Checkout code
127179 uses : actions/checkout@v4
@@ -137,67 +189,100 @@ jobs:
137189 cd Dawn
138190 pip install -r requirements.txt
139191
192+ - name : Download dawn.json
193+ uses : actions/download-artifact@v5
194+ with :
195+ name : dawn-json
196+ path : Dawn/dawn_source/src/dawn
197+
140198 - name : Download all build artifacts
141- uses : actions/download-artifact@v4
199+ uses : actions/download-artifact@v5
142200 with :
201+ pattern : dawn-build-*
143202 path : Dawn/builds/
203+ merge-multiple : true
204+
205+ - name : Download Dawn version
206+ uses : actions/download-artifact@v5
207+ with :
208+ name : dawn-version
209+ path : Dawn/
210+ merge-multiple : true
144211
145212 - name : Create artifact bundle
146213 run : |
147214 cd Dawn
148215 python ci_build_dawn.py bundle
149216
217+ - name : Set bundle name
218+ id : set-bundle-name
219+ run : |
220+ BUNDLE_NAME="dawn_webgpu_${{needs.get-dawn-version.outputs.chromium_dawn_suffix}}.zip"
221+ echo "bundle_name=$BUNDLE_NAME" >> $GITHUB_OUTPUT
222+
150223 - name : Upload bundle artifact
151224 uses : actions/upload-artifact@v4
152225 with :
153226 name : dawn-webgpu-bundle
154- path : Dawn/dawn_webgpu_ ${{needs.get-dawn-source .outputs.chromium_dawn_suffix}}.zip
227+ path : Dawn/dist/ ${{steps.set-bundle-name .outputs.bundle_name}}
155228 retention-days : 30
156229
157230 create-release :
158- needs : [create-bundle, get-dawn-source ]
231+ needs : [create-bundle, get-dawn-version ]
159232 runs-on : ubuntu-latest
160- if : startsWith(github.ref, 'refs/tags/')
161-
162233 steps :
163234 - name : Checkout code
164235 uses : actions/checkout@v4
165236
166237 - name : Download bundle artifact
167- uses : actions/download-artifact@v4
238+ uses : actions/download-artifact@v5
168239 with :
169240 name : dawn-webgpu-bundle
170241 path : dawn-bundle/
242+ merge-multiple : true
243+
244+ - name : Compute SHA256
245+ id : compute-sha256
246+ run : |
247+ cd dawn-bundle
248+ sha256sum ${{needs.create-bundle.outputs.bundle_name}} > sha256sum.txt
249+ echo "sha256sum=$(cat sha256sum.txt)" >> $GITHUB_OUTPUT
250+
251+ - name : Tag name
252+ id : tag
253+ run : |
254+ TAG="dawn-chromium-${{github.event.inputs.channel}}-${{needs.get-dawn-version.outputs.chromium_dawn_version}}"
255+ echo "tag=$TAG" >> $GITHUB_OUTPUT
171256
172257 - name : Create Release
173258 uses : actions/create-release@v1
174259 env :
175260 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
176261 with :
177- release_name : Dawn WebGPU from Chromium ${{ needs.get-dawn-source.outputs.chromium_dawn_version }}
262+ release_name : Dawn WebGPU from Chromium ${{ needs.get-dawn-version.outputs.chromium_dawn_version }}
263+ tag_name : ${{ steps.tag.outputs.tag }}
178264 body : |
179- Dawn WebGPU build matching Chromium ${{ needs.get-dawn-source.outputs.chromium_dawn_version }}.
180- Built from Dawn hash: ${{ needs.get-dawn-source.outputs.chromium_dawn_hash }}
265+ Dawn WebGPU build matching Chromium ${{ needs.get-dawn-version.outputs.chromium_dawn_version }}.
266+ Built from Dawn hash: ${{ needs.get-dawn-version.outputs.chromium_dawn_hash }}
267+ SHA256: ${{ steps.compute-sha256.outputs.sha256sum }}
181268
182269 This release contains pre-built Dawn WebGPU libraries for multiple platforms:
183270 - linux (x86_64)
184271 - macosx (x86_64 + ARM64)
185272 - iphoneos (ARM64)
186273 - iphonesimulator (x86_64)
187274
188- Built from Chromium channel: ${{ env.DAWN_CHANNEL }}
275+ These are just the raw Dawn libraries and do not include the Swift API layer.
276+
277+ Built from Chromium channel: ${{ github.event.inputs.channel }}
189278 draft : false
190279 prerelease : false
191280
192281 - name : Upload Release Assets
193282 run : |
194- TAG="dawn-chromium-${{env.DAWN_CHANNEL}}-${{needs.get-dawn-source.outputs.chromium_dawn_version}}"
195- if gh release view "$TAG" >/dev/null 2>&1; then
196- echo "Release '$TAG' already exists. Skipping upload."
197- else
198- echo "Uploading to release: $TAG"
199- cd dawn-bundle
200- gh release upload $TAG dawn_webgpu_${{needs.get-dawn-source.outputs.chromium_dawn_suffix}}.zip --clobber
201- fi
283+ TAG="${{ steps.tag.outputs.tag }}"
284+ echo "Uploading to release: $TAG"
285+ cd dawn-bundle
286+ gh release upload $TAG ${{needs.create-bundle.outputs.bundle_name}} --clobber
202287 env :
203288 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments