[CI] Refactor DXC and WARP installation steps to composite actions

This avoids having to duplicate the steps and version numbers across
mutiple workflows.
This commit is contained in:
Jamie Nicol 2025-06-16 20:55:05 +01:00 committed by Connor Fitzgerald
parent ad4286102a
commit 3ba583cd61
6 changed files with 50 additions and 49 deletions

17
.github/actions/install-dxc/action.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: "Install DXC"
description: "Install DXC"
runs:
using: "composite"
steps:
- shell: bash
run: |
set -e
export DXC_RELEASE="v1.8.2502"
export DXC_FILENAME="dxc_2025_02_20.zip"
curl.exe -L --retry 5 https://github.com/microsoft/DirectXShaderCompiler/releases/download/$DXC_RELEASE/$DXC_FILENAME -o dxc.zip
7z.exe e dxc.zip -odxc bin/x64/{dxc.exe,dxcompiler.dll}
# We need to use cygpath to convert PWD to a windows path as we're using bash.
cygpath --windows "$PWD/dxc" >> "$GITHUB_PATH"

25
.github/actions/install-warp/action.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: "Install WARP"
description: "Install WARP"
inputs:
target-dirs:
description: "Space-separated list of directories into which to install the WARP DLL."
required: true
runs:
using: "composite"
steps:
- shell: bash
run: |
set -e
export WARP_VERSION="1.0.13"
# Make sure dxc is in path.
dxc --version
curl.exe -L --retry 5 https://www.nuget.org/api/v2/package/Microsoft.Direct3D.WARP/$WARP_VERSION -o warp.zip
7z.exe e warp.zip -owarp build/native/bin/x64/d3d10warp.dll
for dir in ${{ inputs.target-dirs }}; do
mkdir -p ${{ inputs.target-dirs }}
cp -v warp/d3d10warp.dll "$dir"
done

View File

@ -20,16 +20,8 @@ env:
# Sourced from https://vulkan.lunarg.com/sdk/home#linux
VULKAN_SDK_VERSION: "1.4.313"
VULKAN_FULL_SDK_VERSION: "1.4.313.0"
# Sourced from https://www.nuget.org/packages/Microsoft.Direct3D.WARP
WARP_VERSION: "1.0.13"
# Sourced from https://github.com/microsoft/DirectXShaderCompiler/releases
#
# Must also be changed in shaders.yaml
DXC_RELEASE: "v1.8.2502"
DXC_FILENAME: "dxc_2025_02_20.zip"
# These Mesa version definition is duplicated in the install-mesa-action.
# These Mesa version definition is duplicated in the install-mesa action.
MESA_VERSION: "24.3.4"
# This is the MSRV used by `wgpu` itself and all surrounding infrastructure.
@ -541,32 +533,13 @@ jobs:
- name: (Windows) Install DXC
if: matrix.os == 'windows-2022'
shell: bash
run: |
set -e
curl.exe -L --retry 5 https://github.com/microsoft/DirectXShaderCompiler/releases/download/$DXC_RELEASE/$DXC_FILENAME -o dxc.zip
7z.exe e dxc.zip -odxc bin/x64/{dxc.exe,dxcompiler.dll}
# We need to use cygpath to convert PWD to a windows path as we're using bash.
cygpath --windows "$PWD/dxc" >> "$GITHUB_PATH"
uses: ./.github/actions/install-dxc
- name: (Windows) Install WARP
if: matrix.os == 'windows-2022'
shell: bash
run: |
set -e
# Make sure dxc is in path.
dxc --version
curl.exe -L --retry 5 https://www.nuget.org/api/v2/package/Microsoft.Direct3D.WARP/$WARP_VERSION -o warp.zip
7z.exe e warp.zip -owarp build/native/bin/x64/d3d10warp.dll
mkdir -p target/llvm-cov-target/debug/deps
cp -v warp/d3d10warp.dll target/llvm-cov-target/debug/
cp -v warp/d3d10warp.dll target/llvm-cov-target/debug/deps
uses: ./.github/actions/install-warp
with:
target-dirs: "target/llvm-cov-target/debug target/llvm-cov-target/debug/deps"
- name: (Windows) Install Mesa
if: matrix.os == 'windows-2022'
@ -627,7 +600,7 @@ jobs:
- name: (Linux) Install Mesa
if: matrix.os == 'ubuntu-24.04'
uses: ./.github/install-mesa-action
uses: ./.github/actions/install-mesa
- name: Delete Naga snapshots
shell: bash

View File

@ -65,7 +65,7 @@ jobs:
- name: (Linux) Install Mesa
if: matrix.os == 'ubuntu-24.04'
uses: ./.github/install-mesa-action
uses: ./.github/actions/install-mesa
- name: run CTS
shell: bash

View File

@ -18,12 +18,6 @@ env:
# We don't include the 4th version number, as it's not used in any URL.
VULKAN_SDK_VERSION: "1.4.313"
# Sourced from https://github.com/microsoft/DirectXShaderCompiler/releases
#
# Must also be changed in ci.yaml
DXC_RELEASE: "v1.8.2502"
DXC_FILENAME: "dxc_2025_02_20.zip"
jobs:
naga-validate-windows:
name: "Validate: HLSL"
@ -56,15 +50,7 @@ jobs:
shell: powershell
- name: Setup DXC
shell: bash
run: |
set -e
curl.exe -L --retry 5 https://github.com/microsoft/DirectXShaderCompiler/releases/download/$DXC_RELEASE/$DXC_FILENAME -o dxc.zip
7z.exe e dxc.zip -odxc bin/x64/{dxc.exe,dxcompiler.dll}
# We need to use cygpath to convert PWD to a windows path as we're using bash.
cygpath --windows "$PWD/dxc" >> "$GITHUB_PATH"
uses: ./.github/actions/install-dxc
- name: Validate
shell: bash