Build Dawn WebGPU #37
Workflow file for this run
This file contains hidden or 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
| # Copyright 2025 Adobe | |
| # All Rights Reserved. | |
| # | |
| # NOTICE: Adobe permits you to use, modify, and distribute this file in | |
| # accordance with the terms of the Adobe license agreement accompanying | |
| # it. | |
| name: Build Dawn WebGPU | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| channel: | |
| description: "Chromium channel for Dawn" | |
| required: false | |
| default: "canary" | |
| type: choice | |
| options: | |
| - stable | |
| - beta | |
| - canary | |
| config: | |
| description: "Configuration" | |
| required: false | |
| default: "release" | |
| type: choice | |
| options: | |
| - release | |
| - debug | |
| workflow_call: | |
| inputs: | |
| channel: | |
| required: false | |
| default: "canary" | |
| description: "Chromium channel for Dawn (stable, beta, canary)" | |
| type: string | |
| config: | |
| description: "Configuration (release or debug)" | |
| required: false | |
| default: "release" | |
| type: string | |
| jobs: | |
| get-dawn-version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| chromium_channel: ${{ steps.read-version.outputs.chromium_channel }} | |
| chromium_dawn_version: ${{ steps.read-version.outputs.chromium_dawn_version }} | |
| chromium_dawn_hash: ${{ steps.read-version.outputs.chromium_dawn_hash }} | |
| chromium_dawn_suffix: ${{ steps.read-version.outputs.chromium_dawn_suffix }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| cd Dawn | |
| pip install -r requirements.txt | |
| - name: Get Dawn version | |
| run: | | |
| cd Dawn | |
| python ci_build_dawn.py get-dawn-version --channel ${{ github.event.inputs.channel }} | |
| - name: Upload Dawn Version | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dawn-version | |
| path: Dawn/dawn_version.json | |
| retention-days: 1 | |
| - name: Read Dawn version | |
| id: read-version | |
| run: | | |
| cd Dawn | |
| value=$(jq -r '.chromium_channel' dawn_version.json) | |
| echo "chromium_channel=$value" >> $GITHUB_OUTPUT | |
| value=$(jq -r '.chromium_dawn_version' dawn_version.json) | |
| echo "chromium_dawn_version=$value" >> $GITHUB_OUTPUT | |
| value=$(jq -r '.chromium_dawn_hash' dawn_version.json) | |
| echo "chromium_dawn_hash=$value" >> $GITHUB_OUTPUT | |
| value=$(jq -r '.chromium_dawn_suffix' dawn_version.json) | |
| echo "chromium_dawn_suffix=$value" >> $GITHUB_OUTPUT | |
| build-dawn: | |
| needs: get-dawn-version | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: ubuntu-latest | |
| target: linux | |
| python-version: "3.11" | |
| - platform: macos-latest | |
| target: macosx | |
| python-version: "3.11" | |
| - platform: windows-latest | |
| target: windows | |
| python-version: "3.11" | |
| - platform: macos-latest | |
| target: iphoneos | |
| python-version: "3.11" | |
| - platform: macos-latest | |
| target: iphonesimulator | |
| python-version: "3.11" | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install prerequisites on Linux | |
| if: matrix.platform == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| 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 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| cd Dawn | |
| pip install -r requirements.txt | |
| - name: Download Dawn source | |
| run: | | |
| cd Dawn | |
| python ci_build_dawn.py get-source --hash ${{ needs.get-dawn-version.outputs.chromium_dawn_hash }} | |
| - name: Build Dawn for ${{ matrix.target }} | |
| run: | | |
| cd Dawn | |
| python ci_build_dawn.py build-target --target ${{ matrix.target }} --config ${{ github.event.inputs.config }} | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dawn-build-${{ matrix.target }} | |
| path: | | |
| Dawn/builds/ | |
| !Dawn/builds/*/out | |
| retention-days: 1 | |
| - name: Upload dawn.json | |
| if: matrix.platform == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dawn-json | |
| path: Dawn/dawn_source/src/dawn/dawn.json | |
| retention-days: 1 | |
| create-bundle: | |
| needs: [build-dawn, get-dawn-version] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| bundle_name: ${{ steps.set-bundle-name.outputs.bundle_name }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| cd Dawn | |
| pip install -r requirements.txt | |
| - name: Download dawn.json | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: dawn-json | |
| path: Dawn/dawn_source/src/dawn | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| pattern: dawn-build-* | |
| path: Dawn/builds/ | |
| merge-multiple: true | |
| - name: Download Dawn version | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: dawn-version | |
| path: Dawn/ | |
| merge-multiple: true | |
| - name: Create artifact bundle | |
| run: | | |
| cd Dawn | |
| python ci_build_dawn.py bundle | |
| - name: Set bundle name | |
| id: set-bundle-name | |
| run: | | |
| BUNDLE_NAME="dawn_webgpu_${{needs.get-dawn-version.outputs.chromium_dawn_suffix}}.zip" | |
| echo "bundle_name=$BUNDLE_NAME" >> $GITHUB_OUTPUT | |
| - name: Upload bundle artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dawn-webgpu-bundle | |
| path: Dawn/dist/${{steps.set-bundle-name.outputs.bundle_name}} | |
| retention-days: 30 | |
| create-release: | |
| needs: [create-bundle, get-dawn-version] | |
| permissions: | |
| contents: write | |
| packages: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download bundle artifact | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: dawn-webgpu-bundle | |
| path: dawn-bundle/ | |
| merge-multiple: true | |
| - name: Compute SHA256 | |
| id: compute-sha256 | |
| run: | | |
| cd dawn-bundle | |
| sha256sum ${{needs.create-bundle.outputs.bundle_name}} > sha256sum.txt | |
| echo "sha256sum=$(cat sha256sum.txt)" >> $GITHUB_OUTPUT | |
| - name: Tag name | |
| id: tag | |
| run: | | |
| TAG="dawn-chromium-${{github.event.inputs.channel}}-${{needs.get-dawn-version.outputs.chromium_dawn_version}}-${{github.event.inputs.config}}" | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| name: Dawn WebGPU from Chromium ${{ needs.get-dawn-version.outputs.chromium_dawn_version }} (${{ github.event.inputs.config }}) | |
| tag: ${{ steps.tag.outputs.tag }} | |
| body: | | |
| **Chromium channel:** ${{ github.event.inputs.channel }} | |
| **Chromium version:** ${{ needs.get-dawn-version.outputs.chromium_dawn_version }} | |
| **Configuration:** ${{ github.event.inputs.config }} | |
| **Dawn hash:** ${{ needs.get-dawn-version.outputs.chromium_dawn_hash }} | |
| **SHA256:** ${{ steps.compute-sha256.outputs.sha256sum }} | |
| This release contains pre-built Dawn WebGPU libraries in an archive bundle for multiple platforms: | |
| - linux (x86_64) | |
| - macosx (x86_64 + ARM64) | |
| - iphoneos (ARM64) | |
| - iphonesimulator (x86_64) | |
| - windows (x86_64) | |
| These are just the raw Dawn libraries and do not include the Swift API layer. | |
| artifacts: ${{needs.create-bundle.outputs.bundle_name}} |