Skip to content

Commit 212f6d8

Browse files
committed
Refactor CI so that each platform downloads the source separately
1 parent 98bd267 commit 212f6d8

File tree

4 files changed

+46
-36
lines changed

4 files changed

+46
-36
lines changed

.github/workflows/dawn.yaml

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ env:
2626
DAWN_CONFIG: ${{ github.event.inputs.config || 'release' }}
2727

2828
jobs:
29-
get-dawn-source:
29+
get-dawn-version:
3030
runs-on: ubuntu-latest
3131
outputs:
3232
chromium_channel: ${{ steps.read-version.outputs.chromium_channel }}
@@ -48,21 +48,10 @@ jobs:
4848
cd Dawn
4949
pip install -r requirements.txt
5050
51-
- name: Get Dawn source
51+
- name: Get Dawn version
5252
run: |
5353
cd Dawn
54-
python ci_build_dawn.py get-dawn --channel ${{ env.DAWN_CHANNEL }}
55-
56-
- name: Upload Dawn source
57-
uses: actions/upload-artifact@v4
58-
with:
59-
name: dawn-source
60-
path: |
61-
Dawn/dawn_source/
62-
!Dawn/dawn_source/.git
63-
!Dawn/dawn_source/**/*.git
64-
!Dawn/dawn_source/third_party/khronos/OpenGL-Registry/specs
65-
retention-days: 1
54+
python ci_build_dawn.py get-dawn-version --channel ${{ env.DAWN_CHANNEL }}
6655
6756
- name: Upload Dawn Version
6857
uses: actions/upload-artifact@v4
@@ -85,7 +74,7 @@ jobs:
8574
echo "chromium_dawn_suffix=$value" >> $GITHUB_OUTPUT
8675
8776
build-dawn:
88-
needs: get-dawn-source
77+
needs: get-dawn-version
8978
strategy:
9079
matrix:
9180
include:
@@ -129,10 +118,9 @@ jobs:
129118
pip install -r requirements.txt
130119
131120
- name: Download Dawn source
132-
uses: actions/download-artifact@v5
133-
with:
134-
name: dawn-source
135-
path: Dawn/dawn_source/
121+
run: |
122+
cd Dawn
123+
python ci_build_dawn.py get-source --hash ${{ needs.get-dawn-version.outputs.chromium_dawn_hash }}
136124
137125
- name: Build Dawn for ${{ matrix.target }}
138126
run: |
@@ -148,8 +136,16 @@ jobs:
148136
!Dawn/builds/*/out
149137
retention-days: 1
150138

139+
- name: Upload dawn.json
140+
if: matrix.platform == 'ubuntu-latest'
141+
uses: actions/upload-artifact@v4
142+
with:
143+
name: dawn-json
144+
path: Dawn/dawn_source/src/dawn/dawn.json
145+
retention-days: 1
146+
151147
create-bundle:
152-
needs: [build-dawn, get-dawn-source]
148+
needs: [build-dawn, get-dawn-version]
153149
runs-on: ubuntu-latest
154150
outputs:
155151
bundle_name: ${{ steps.set-bundle-name.outputs.bundle_name }}
@@ -168,11 +164,11 @@ jobs:
168164
cd Dawn
169165
pip install -r requirements.txt
170166
171-
- name: Download Dawn source
167+
- name: Download dawn.json
172168
uses: actions/download-artifact@v5
173169
with:
174-
name: dawn-source
175-
path: Dawn/dawn_source/
170+
name: dawn-json
171+
path: Dawn/dawn_source/src/dawn
176172

177173
- name: Download all build artifacts
178174
uses: actions/download-artifact@v5
@@ -196,7 +192,7 @@ jobs:
196192
- name: Set bundle name
197193
id: set-bundle-name
198194
run: |
199-
BUNDLE_NAME="dawn_webgpu_${{needs.get-dawn-source.outputs.chromium_dawn_suffix}}.zip"
195+
BUNDLE_NAME="dawn_webgpu_${{needs.get-dawn-version.outputs.chromium_dawn_suffix}}.zip"
200196
echo "bundle_name=$BUNDLE_NAME" >> $GITHUB_OUTPUT
201197
202198
- name: Upload bundle artifact
@@ -207,7 +203,7 @@ jobs:
207203
retention-days: 30
208204

209205
create-release:
210-
needs: [create-bundle, get-dawn-source]
206+
needs: [create-bundle, get-dawn-version]
211207
runs-on: ubuntu-latest
212208
steps:
213209
- name: Checkout code
@@ -230,19 +226,19 @@ jobs:
230226
- name: Tag name
231227
id: tag
232228
run: |
233-
TAG="dawn-chromium-${{env.DAWN_CHANNEL}}-${{needs.get-dawn-source.outputs.chromium_dawn_version}}"
229+
TAG="dawn-chromium-${{env.DAWN_CHANNEL}}-${{needs.get-dawn-version.outputs.chromium_dawn_version}}"
234230
echo "tag=$TAG" >> $GITHUB_OUTPUT
235231
236232
- name: Create Release
237233
uses: actions/create-release@v1
238234
env:
239235
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
240236
with:
241-
release_name: Dawn WebGPU from Chromium ${{ needs.get-dawn-source.outputs.chromium_dawn_version }}
237+
release_name: Dawn WebGPU from Chromium ${{ needs.get-dawn-version.outputs.chromium_dawn_version }}
242238
tag_name: ${{ steps.tag.outputs.tag }}
243239
body: |
244-
Dawn WebGPU build matching Chromium ${{ needs.get-dawn-source.outputs.chromium_dawn_version }}.
245-
Built from Dawn hash: ${{ needs.get-dawn-source.outputs.chromium_dawn_hash }}
240+
Dawn WebGPU build matching Chromium ${{ needs.get-dawn-version.outputs.chromium_dawn_version }}.
241+
Built from Dawn hash: ${{ needs.get-dawn-version.outputs.chromium_dawn_hash }}
246242
SHA256: ${{ steps.compute-sha256.outputs.sha256sum }}
247243
248244
This release contains pre-built Dawn WebGPU libraries for multiple platforms:

Dawn/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ If you wish to build a version of Dawn yourself, you can use these CI scripts as
2121
python3 -m venv .venv
2222
pip3 install -r requirements.txt
2323

24-
# Download the Dawn source matching the latest release of Chromium Canary
25-
./ci_build_dawn.py get-dawn
24+
# Determine the latest release of Chromium Canary and get the Dawn hash
25+
# Write the data to dawn_version.json
26+
./ci_build_dawn.py get-dawn-version
27+
28+
# Download the Dawn source matching the given hash
29+
./ci_build_dawn.py get-source --hash ABC1234ABC
2630

2731
# Build Dawn, running these commands on the appropriate platform
2832
# Note that macosx builds both Intel and Arm

Dawn/ci_build_dawn.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,23 @@ def parse_args() -> argparse.Namespace:
7777
parser = argparse.ArgumentParser(description="CI build tools for Dawn")
7878
subparsers = parser.add_subparsers(dest="command")
7979

80-
get_parser = subparsers.add_parser("get-dawn", help="Get the latest Dawn source")
80+
get_parser = subparsers.add_parser(
81+
"get-dawn-version", help="Get the latest Dawn version"
82+
)
8183
get_parser.add_argument(
8284
"--channel",
8385
choices=["stable", "beta", "canary"],
8486
default="canary",
8587
help="Chromium channel to use for Dawn",
8688
)
8789

90+
get_parser = subparsers.add_parser("get-source", help="Get the Dawn source")
91+
get_parser.add_argument(
92+
"--hash",
93+
required=True,
94+
help="Dawn hash to get the source for",
95+
)
96+
8897
build_parser = subparsers.add_parser("build-target", help="Build a target")
8998
build_parser.add_argument(
9099
"--target",
@@ -114,8 +123,11 @@ def main() -> int:
114123
Exit code (0 for success, 1 for failure)
115124
"""
116125
args = parse_args()
117-
if args.command == "get-dawn":
126+
if args.command == "get-dawn-version":
118127
dawn_source.get_matching_dawn_for_chromium(args.channel)
128+
print(dawn_source.get_version())
129+
elif args.command == "get-source":
130+
dawn_source.fetch_dawn_source(args.hash)
119131
elif args.command == "build-target":
120132
if args.target not in [
121133
"windows",

Dawn/dawn_source.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@ class DawnSourceToolsDirectoryNotFoundError(DawnSourceDirectoryConfigurationErro
3434
def get_matching_dawn_for_chromium(channel: str = "canary") -> None:
3535
"""
3636
Get the Dawn version that matches the latest Chromium release for the given channel
37+
and write the version data to the dawn_version.json file.
3738
3839
Args:
3940
channel: The Chromium channel to use for fetching the latest version
40-
41-
Returns:
42-
A tuple containing the Dawn hash, version, and suffix
4341
"""
4442

4543
chromium_dawn_hash, chromium_dawn_version, chromium_dawn_suffix = (

0 commit comments

Comments
 (0)