Skip to content

Commit 218f15c

Browse files
authored
Add pre-merge workflow for HLSL testing (#122184)
This adds a workflow for running HLSL tests on PRs that modify HLSL and DirectX code. The tests enabled here are the LLVM & Clang tests and the Offload execution tests: https://github.com/llvm-beanz/offload-test-suite/
1 parent 3055e86 commit 218f15c

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed

.github/workflows/hlsl-matrix.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: HLSL Tests
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_dispatch:
8+
pull_request:
9+
branches:
10+
- main
11+
paths:
12+
- llvm/**/DirectX/**
13+
- .github/workflows/hlsl*
14+
- clang/*HLSL*/**/*
15+
- clang/**/*HLSL*
16+
- llvm/**/Frontend/HLSL/**/*
17+
18+
jobs:
19+
HLSL-Tests:
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
runs-on:
24+
- hlsl-macos
25+
26+
uses: ./.github/workflows/hlsl-test-all.yaml
27+
with:
28+
SKU: hlsl-macos
29+
TestTarget: check-hlsl-clang-mtl # TODO: This target changes based on SKU
30+
LLVM-ref: ${{ github.ref }}

.github/workflows/hlsl-test-all.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: HLSL Test
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
OffloadTest-branch:
10+
description: 'Test Suite Branch'
11+
required: false
12+
default: 'main'
13+
type: string
14+
LLVM-ref:
15+
description: 'LLVM Branch'
16+
required: false
17+
default: 'main'
18+
type: string
19+
SKU:
20+
required: true
21+
type: string
22+
TestTarget:
23+
required: false
24+
default: 'check-hlsl'
25+
type: string
26+
27+
jobs:
28+
build:
29+
runs-on: ${{ inputs.SKU }}
30+
steps:
31+
- name: Checkout DXC
32+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
33+
with:
34+
repository: Microsoft/DirectXShaderCompiler
35+
ref: main
36+
path: DXC
37+
submodules: true
38+
- name: Checkout LLVM
39+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
40+
with:
41+
ref: ${{ inputs.LLVM-branch }}
42+
path: llvm-project
43+
- name: Checkout OffloadTest
44+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
45+
with:
46+
repository: llvm-beanz/offload-test-suite
47+
ref: main
48+
path: OffloadTest
49+
- name: Checkout Golden Images
50+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
51+
with:
52+
repository: llvm-beanz/offload-golden-images
53+
ref: main
54+
path: golden-images
55+
- name: Setup Windows
56+
if: runner.os == 'Windows'
57+
uses: llvm/actions/setup-windows@main
58+
with:
59+
arch: amd64
60+
- name: Build DXC
61+
run: |
62+
cd DXC
63+
mkdir build
64+
cd build
65+
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -C ${{ github.workspace }}/DXC/cmake/caches/PredefinedParams.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DHLSL_DISABLE_SOURCE_GENERATION=On ${{ github.workspace }}/DXC/
66+
ninja dxv llvm-dis
67+
- name: Build LLVM
68+
run: |
69+
cd llvm-project
70+
mkdir build
71+
cd build
72+
cmake -G Ninja -DDXIL_DIS=${{ github.workspace }}/DXC/build/bin/llvm-dis -DLLVM_INCLUDE_DXIL_TESTS=On -DCMAKE_BUILD_TYPE=Release -C ${{ github.workspace }}/llvm-project/clang/cmake/caches/HLSL.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DDXC_DIR=${{ github.workspace }}/DXC/build/bin -DLLVM_EXTERNAL_OFFLOADTEST_SOURCE_DIR=${{ github.workspace }}/OffloadTest -DLLVM_EXTERNAL_PROJECTS="OffloadTest" -DLLVM_LIT_ARGS="--xunit-xml-output=testresults.xunit.xml -v" -DGOLDENIMAGE_DIR=${{ github.workspace }}/golden-images ${{ github.workspace }}/llvm-project/llvm/
73+
ninja hlsl-test-depends llvm-test-depends clang-test-depends
74+
- name: Run HLSL Tests
75+
run: |
76+
cd llvm-project
77+
cd build
78+
ninja check-llvm
79+
ninja check-clang
80+
ninja check-hlsl-unit
81+
ninja ${{ inputs.TestTarget }}
82+
- name: Publish Test Results
83+
uses: EnricoMi/publish-unit-test-result-action/macos@170bf24d20d201b842d7a52403b73ed297e6645b # v2
84+
if: always() && runner.os == 'macOS'
85+
with:
86+
comment_mode: off
87+
files: llvm-project/build/**/testresults.xunit.xml

0 commit comments

Comments
 (0)