Build Dawn WebGPU #20
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
| 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 | |
| env: | |
| DAWN_CHANNEL: ${{ github.event.inputs.channel || 'canary' }} | |
| DAWN_CONFIG: ${{ github.event.inputs.config || 'release' }} | |
| jobs: | |
| get-dawn-source: | |
| 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 source | |
| run: | | |
| cd Dawn | |
| python ci_build_dawn.py get-dawn --channel ${{ env.DAWN_CHANNEL }} | |
| - name: Upload Dawn source | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dawn-source | |
| path: | | |
| Dawn/dawn_source/ | |
| !Dawn/dawn_source/.git | |
| !Dawn/dawn_source/**/*.git | |
| !Dawn/dawn_source/third_party/khronos/OpenGL-Registry/specs | |
| retention-days: 1 | |
| - 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-source | |
| 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 | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: dawn-source | |
| path: Dawn/dawn_source/ | |
| - name: Build Dawn for ${{ matrix.target }} | |
| run: | | |
| cd Dawn | |
| python ci_build_dawn.py build-target --target ${{ matrix.target }} --config ${{ env.DAWN_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 | |
| create-bundle: | |
| needs: [build-dawn, get-dawn-source] | |
| runs-on: ubuntu-latest | |
| 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 source | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: dawn-source | |
| path: Dawn/dawn_source/ | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| pattern: dawn-build-* | |
| path: Dawn/builds/ | |
| merge-multiple: true | |
| - name: List build artifacts | |
| run: | | |
| ls -R Dawn/builds/ | |
| - name: Download Dawn version | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: dawn-version | |
| path: Dawn/ | |
| merge-multiple: true | |
| - name: List build artifacts 2 | |
| run: | | |
| ls -R Dawn/builds/ | |
| - name: Create artifact bundle | |
| run: | | |
| cd Dawn | |
| python ci_build_dawn.py bundle | |
| - name: Upload bundle artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dawn-webgpu-bundle | |
| path: Dawn/dawn_webgpu_${{needs.get-dawn-source.outputs.chromium_dawn_suffix}}.zip | |
| retention-days: 30 | |
| create-release: | |
| needs: [create-bundle, get-dawn-source] | |
| 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 dawn_webgpu_${{needs.get-dawn-source.outputs.chromium_dawn_suffix}}.zip > sha256sum.txt | |
| echo "sha256sum=$(cat sha256sum.txt)" >> $GITHUB_OUTPUT | |
| - name: Tag name | |
| id: tag | |
| run: | | |
| TAG="dawn-chromium-${{env.DAWN_CHANNEL}}-${{needs.get-dawn-source.outputs.chromium_dawn_version}}" | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| release_name: Dawn WebGPU from Chromium ${{ needs.get-dawn-source.outputs.chromium_dawn_version }} | |
| tag_name: ${{ steps.tag.outputs.tag }} | |
| body: | | |
| Dawn WebGPU build matching Chromium ${{ needs.get-dawn-source.outputs.chromium_dawn_version }}. | |
| Built from Dawn hash: ${{ needs.get-dawn-source.outputs.chromium_dawn_hash }} | |
| SHA256: ${{ steps.compute-sha256.outputs.sha256sum }} | |
| This release contains pre-built Dawn WebGPU libraries for multiple platforms: | |
| - linux (x86_64) | |
| - macosx (x86_64 + ARM64) | |
| - iphoneos (ARM64) | |
| - iphonesimulator (x86_64) | |
| These are just the raw Dawn libraries and do not include the Swift API layer. | |
| Built from Chromium channel: ${{ env.DAWN_CHANNEL }} | |
| draft: false | |
| prerelease: false | |
| - name: Upload Release Assets | |
| run: | | |
| TAG="${{ steps.tag.outputs.tag }}" | |
| if gh release view "$TAG" >/dev/null 2>&1; then | |
| echo "Release '$TAG' already exists. Skipping upload." | |
| else | |
| echo "Uploading to release: $TAG" | |
| cd dawn-bundle | |
| gh release upload $TAG dawn_webgpu_${{needs.get-dawn-source.outputs.chromium_dawn_suffix}}.zip --clobber | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |