You've already forked dawn-build
mirror of
https://github.com/encounter/dawn-build.git
synced 2026-07-10 03:18:41 -07:00
210 lines
7.2 KiB
YAML
210 lines
7.2 KiB
YAML
name: Build Dawn
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
dawn_ref:
|
|
description: "Dawn ref to build (tag or commit SHA)"
|
|
required: true
|
|
type: string
|
|
output_tag:
|
|
description: "Release tag to create in this repo; leave empty to generate a UTC timestamp tag"
|
|
required: false
|
|
default: ""
|
|
type: string
|
|
|
|
env:
|
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
ANDROID_NDK_VERSION: "29.0.14206865"
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: windows-latest
|
|
tarball: dawn-windows-amd64.tar.gz
|
|
msvc_arch: x64
|
|
sdk_arch: x64
|
|
- os: windows-latest
|
|
tarball: dawn-windows-arm64.tar.gz
|
|
msvc_arch: amd64_arm64
|
|
sdk_arch: arm64
|
|
host_tool_arch: x64
|
|
- os: ubuntu-24.04
|
|
tarball: dawn-linux-x86_64.tar.gz
|
|
- os: ubuntu-24.04-arm
|
|
tarball: dawn-linux-aarch64.tar.gz
|
|
- os: macos-15
|
|
tarball: dawn-darwin-arm64.tar.gz
|
|
extra_cmake_args: >-
|
|
-DCMAKE_OSX_ARCHITECTURES=arm64
|
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0
|
|
- os: macos-15
|
|
tarball: dawn-darwin-x86_64.tar.gz
|
|
extra_cmake_args: >-
|
|
-DCMAKE_OSX_ARCHITECTURES=x86_64
|
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0
|
|
-DCMAKE_SYSTEM_PROCESSOR=x86_64
|
|
- os: ubuntu-24.04
|
|
platform: Android
|
|
tarball: dawn-android-aarch64.tar.gz
|
|
extra_cmake_args: >-
|
|
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk/$ANDROID_NDK_VERSION/build/cmake/android.toolchain.cmake
|
|
-DANDROID_ABI=arm64-v8a
|
|
-DANDROID_PLATFORM=android-28
|
|
-DCMAKE_SYSTEM_PROCESSOR=aarch64
|
|
-DWITH_PROTOC=$GITHUB_WORKSPACE/host-protoc/protoc
|
|
- os: macos-15
|
|
platform: iOS
|
|
tarball: dawn-ios-arm64.tar.gz
|
|
extra_cmake_args: >-
|
|
-DCMAKE_OSX_SYSROOT=iphoneos
|
|
-DCMAKE_OSX_ARCHITECTURES=arm64
|
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0
|
|
-DCMAKE_SYSTEM_PROCESSOR=arm64
|
|
-DWITH_PROTOC=$GITHUB_WORKSPACE/host-protoc/protoc
|
|
name: Build ${{ matrix.tarball }}
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout this repo
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Checkout Dawn
|
|
uses: actions/checkout@v6
|
|
with:
|
|
repository: google/dawn
|
|
ref: ${{ inputs.dawn_ref }}
|
|
path: dawn
|
|
|
|
- name: Setup CMake & Ninja
|
|
uses: lukka/get-cmake@v4.2.3
|
|
|
|
- name: Setup sccache
|
|
uses: mozilla-actions/sccache-action@v0.0.9
|
|
|
|
- name: Install dependencies
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libwayland-dev libxkbcommon-dev libxrandr-dev \
|
|
libxinerama-dev libxcursor-dev mesa-common-dev libx11-xcb-dev
|
|
|
|
- name: Setup MSVC for host tools
|
|
if: matrix.host_tool_arch
|
|
uses: ilammy/msvc-dev-cmd@v1.13.0
|
|
with:
|
|
arch: ${{ matrix.host_tool_arch }}
|
|
|
|
- name: Build host DXC tablegen
|
|
if: matrix.host_tool_arch
|
|
shell: pwsh
|
|
run: |
|
|
cmake -S dawn -B host-dxc-tablegen -G Ninja `
|
|
-C dawn/.github/workflows/dawn-ci.cmake `
|
|
-C .github/workflows/dawn-ci.cmake `
|
|
-DCMAKE_BUILD_TYPE=Release `
|
|
-DCMAKE_C_COMPILER_LAUNCHER=sccache `
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
|
|
cmake --build host-dxc-tablegen --target llvm-tblgen clang-tblgen --config Release
|
|
|
|
- name: Build host protoc
|
|
if: matrix.platform || matrix.host_tool_arch
|
|
run: |
|
|
cmake -S dawn -B host-protoc -G Ninja -C dawn/.github/workflows/dawn-ci.cmake -C .github/workflows/dawn-ci.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
|
|
cmake --build host-protoc --target protoc --config Release
|
|
|
|
- name: Setup MSVC
|
|
if: runner.os == 'Windows'
|
|
uses: ilammy/msvc-dev-cmd@v1.13.0
|
|
with:
|
|
arch: ${{ matrix.msvc_arch }}
|
|
|
|
- name: Setup Android SDK
|
|
if: matrix.platform == 'Android'
|
|
uses: android-actions/setup-android@v4
|
|
|
|
- name: Install Android NDK
|
|
if: matrix.platform == 'Android'
|
|
run: sdkmanager "ndk;$ANDROID_NDK_VERSION"
|
|
|
|
- name: Configure
|
|
run: >-
|
|
cmake -S dawn -B build -G Ninja
|
|
${{ matrix.platform && format('-DCMAKE_SYSTEM_NAME={0}', matrix.platform) || '' }}
|
|
${{ matrix.extra_cmake_args }}
|
|
${{ matrix.host_tool_arch && format('-DLLVM_TABLEGEN={0}/host-dxc-tablegen/third_party/directx-shader-compiler/src/bin/llvm-tblgen.exe', github.workspace) || '' }}
|
|
${{ matrix.host_tool_arch && format('-DCLANG_TABLEGEN={0}/host-dxc-tablegen/third_party/directx-shader-compiler/src/bin/clang-tblgen.exe', github.workspace) || '' }}
|
|
${{ matrix.host_tool_arch && format('-DWITH_PROTOC={0}/host-protoc/protoc.exe', github.workspace) || '' }}
|
|
-C dawn/.github/workflows/dawn-ci.cmake
|
|
-C .github/workflows/dawn-ci.cmake
|
|
-DCMAKE_BUILD_TYPE=Release
|
|
-DCMAKE_C_COMPILER_LAUNCHER=sccache
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
|
|
|
|
- name: Build
|
|
run: cmake --build build --config Release
|
|
|
|
- name: Install
|
|
run: cmake --install build --config Release --prefix install
|
|
|
|
- name: Strip debug info
|
|
if: matrix.platform == 'Android'
|
|
run: >-
|
|
$ANDROID_HOME/ndk/$ANDROID_NDK_VERSION/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
|
|
--strip-debug
|
|
install/lib/libwebgpu_dawn.a
|
|
|
|
- name: Copy DXC DLLs
|
|
if: runner.os == 'Windows'
|
|
shell: bash
|
|
run: |
|
|
cp build/dxcompiler.dll install/bin/
|
|
# Dawn's CopyWindowsSDKDLL.cmake hardcodes the x64 SDK path, so on
|
|
# ARM64 build/dxil.dll is still x64. Source it from the SDK directly.
|
|
cp "${WindowsSdkDir}bin/${WindowsSDKVersion}${{ matrix.sdk_arch }}/dxil.dll" install/bin/
|
|
|
|
- name: Package
|
|
run: tar -czf ${{ matrix.tarball }} -C install .
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: ${{ matrix.tarball }}
|
|
path: ${{ matrix.tarball }}
|
|
|
|
release:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Resolve output tag
|
|
id: release_tag
|
|
shell: bash
|
|
env:
|
|
INPUT_OUTPUT_TAG: ${{ inputs.output_tag }}
|
|
run: |
|
|
if [[ -n "$INPUT_OUTPUT_TAG" ]]; then
|
|
tag="$INPUT_OUTPUT_TAG"
|
|
else
|
|
tag="$(date -u +v%Y%m%d.%H%M%S)"
|
|
fi
|
|
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
merge-multiple: true
|
|
|
|
- name: Create release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ steps.release_tag.outputs.tag }}
|
|
name: Dawn ${{ steps.release_tag.outputs.tag }}
|
|
body: |
|
|
Built from `google/dawn` ref `${{ inputs.dawn_ref }}`.
|
|
files: "*.tar.gz"
|