Skip to content

Commit e4e6f0f

Browse files
authored
Rework PR jobs to use a matrix (#231)
This moves the PR workflows into a single matrix configuration which allows for completely separate workflows from the scheduled jobs. This fixes two problems with the PR workflows. First it fixes the README files badges to only be based on scheduled jobs. This will allow the red/green status badges to reflect the actual state of main instead of the state of the last PR build. Second, it uses concurrency groups to cancel in-progress runs for a pull request if the PR is updated. This should reduce the load on the builders when they are processing PRs with lots of updates.
1 parent 642cb58 commit e4e6f0f

10 files changed

+66
-67
lines changed

.github/workflows/test-all.yaml renamed to .github/workflows/build-and-test-callable.yaml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ on:
4040
required: false
4141
default: 'check-hlsl'
4242
type: string
43-
Test-Clang:
44-
required: true
45-
type: choice
46-
options:
47-
- On
48-
- Off
4943
OS:
5044
required: true
5145
type: choice
@@ -97,10 +91,6 @@ on:
9791
required: false
9892
default: 'Release'
9993
type: string
100-
Test-Clang:
101-
required: false
102-
default: 'On'
103-
type: string
10494
TestTarget:
10595
required: false
10696
default: 'check-hlsl'
@@ -149,6 +139,11 @@ jobs:
149139
uses: llvm/actions/setup-windows@main
150140
with:
151141
arch: amd64
142+
- name: Detect Clang
143+
id: Test-Clang
144+
shell: bash
145+
if: contains(inputs.TestTarget, 'clang')
146+
run: echo TEST_CLANG=On >> $GITHUB_OUTPUT
152147
- name: Build DXC
153148
run: |
154149
cd DXC
@@ -161,7 +156,7 @@ jobs:
161156
cd llvm-project
162157
mkdir build
163158
cd build
164-
cmake -G Ninja ${{ inputs.LLVM-ExtraCMakeArgs }} -DCMAKE_BUILD_TYPE=${{ inputs.BuildType }} -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" -DOFFLOADTEST_TEST_CLANG=${{ inputs.Test-Clang }} -DGOLDENIMAGE_DIR=${{ github.workspace }}/golden-images ${{ github.workspace }}/llvm-project/llvm/
159+
cmake -G Ninja ${{ inputs.LLVM-ExtraCMakeArgs }} -DCMAKE_BUILD_TYPE=${{ inputs.BuildType }} -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" -DOFFLOADTEST_TEST_CLANG=${{steps.Test-Clang.outputs.TEST_CLANG || 'Off' }} -DGOLDENIMAGE_DIR=${{ github.workspace }}/golden-images ${{ github.workspace }}/llvm-project/llvm/
165160
ninja hlsl-test-depends
166161
- name: Run HLSL Tests
167162
run: |

.github/workflows/macos-clang-mtl.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,11 @@ on:
99
schedule:
1010
- cron: '*/30 * * * *' # run every 30 minutes
1111

12-
pull_request:
13-
branches:
14-
- main
15-
1612
jobs:
1713
macOS-Metal-Clang:
18-
uses: ./.github/workflows/test-all.yaml
14+
uses: ./.github/workflows/build-and-test-callable.yaml
1915
with:
2016
OS: macOS
2117
SKU: macos
22-
Test-Clang: On
2318
TestTarget: check-hlsl-clang-mtl
24-
OffloadTest-branch: ${{ github.event.pull_request.head.sha || github.ref }}
19+
OffloadTest-branch: ${{ github.ref }}

.github/workflows/macos-dxc-mtl.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,11 @@ on:
99
schedule:
1010
- cron: '*/30 * * * *' # run every 30 minutes
1111

12-
pull_request:
13-
branches:
14-
- main
15-
1612
jobs:
1713
macOS-Metal-DXC:
18-
uses: ./.github/workflows/test-all.yaml
14+
uses: ./.github/workflows/build-and-test-callable.yaml
1915
with:
2016
OS: macOS
2117
SKU: macos
22-
Test-Clang: Off
2318
TestTarget: check-hlsl-mtl
24-
OffloadTest-branch: ${{ github.event.pull_request.head.sha || github.ref }}
19+
OffloadTest-branch: ${{ github.ref }}

.github/workflows/pr-matrix.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Execution Testing
2+
3+
permissions:
4+
contents: read
5+
checks: write
6+
7+
on:
8+
pull_request:
9+
branches:
10+
- main
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
Exec-Tests-Windows:
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
SKU: [windows-intel]
22+
TestTarget: [check-hlsl-d3d12, check-hlsl-warp-d3d12, check-hlsl-vk, check-hlsl-clang-d3d12, check-hlsl-clang-warp-d3d12, check-hlsl-clang-vk]
23+
24+
uses: ./.github/workflows/build-and-test-callable.yaml
25+
with:
26+
OS: windows
27+
SKU: ${{ matrix.SKU }}
28+
TestTarget: ${{ matrix.TestTarget }}
29+
OffloadTest-branch: ${{ github.event.pull_request.head.sha }}
30+
LLVM-ExtraCMakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DOFFLOADTEST_USE_CLANG_TIDY=On
31+
32+
Exec-Tests-MacOS:
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
SKU: [macos]
37+
TestTarget: [check-hlsl-mtl, check-hlsl-clang-mtl]
38+
39+
uses: ./.github/workflows/build-and-test-callable.yaml
40+
with:
41+
OS: macOS
42+
SKU: ${{ matrix.SKU }}
43+
TestTarget: ${{ matrix.TestTarget }}
44+
OffloadTest-branch: ${{ github.event.pull_request.head.sha }}

.github/workflows/windows-intel-clang-d3d12.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@ on:
99
schedule:
1010
- cron: '0 */2 * * *' # run every 2 hours
1111

12-
pull_request:
13-
branches:
14-
- main
15-
1612
jobs:
1713
Windows-D3D12-Intel-Clang:
18-
uses: ./.github/workflows/test-all.yaml
14+
uses: ./.github/workflows/build-and-test-callable.yaml
1915
with:
2016
OS: windows
2117
SKU: windows-intel
22-
Test-Clang: On
2318
TestTarget: check-hlsl-clang-d3d12
24-
OffloadTest-branch: ${{ github.event.pull_request.head.sha || github.ref }}
19+
OffloadTest-branch: ${{ github.ref }}
2520
LLVM-ExtraCMakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DOFFLOADTEST_USE_CLANG_TIDY=On

.github/workflows/windows-intel-clang-vk.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@ on:
99
schedule:
1010
- cron: '0 */2 * * *' # run every 2 hours
1111

12-
pull_request:
13-
branches:
14-
- main
15-
1612
jobs:
1713
Windows-VK-Intel-Clang:
18-
uses: ./.github/workflows/test-all.yaml
14+
uses: ./.github/workflows/build-and-test-callable.yaml
1915
with:
2016
OS: windows
2117
SKU: windows-intel
22-
Test-Clang: On
2318
TestTarget: check-hlsl-clang-vk
24-
OffloadTest-branch: ${{ github.event.pull_request.head.sha || github.ref }}
19+
OffloadTest-branch: ${{ github.ref }}
2520
LLVM-ExtraCMakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DOFFLOADTEST_USE_CLANG_TIDY=On

.github/workflows/windows-intel-clang-warp-d3d12.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@ on:
99
schedule:
1010
- cron: '0 */2 * * *' # run every 2 hours
1111

12-
pull_request:
13-
branches:
14-
- main
15-
1612
jobs:
1713
Windows-D3D12-Warp-Clang:
18-
uses: ./.github/workflows/test-all.yaml
14+
uses: ./.github/workflows/build-and-test-callable.yaml
1915
with:
2016
OS: windows
2117
SKU: windows-intel
22-
Test-Clang: On
2318
TestTarget: check-hlsl-clang-warp-d3d12
24-
OffloadTest-branch: ${{ github.event.pull_request.head.sha || github.ref }}
19+
OffloadTest-branch: ${{ github.ref }}
2520
LLVM-ExtraCMakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DOFFLOADTEST_USE_CLANG_TIDY=On

.github/workflows/windows-intel-dxc-d3d12.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,13 @@ on:
99
schedule:
1010
- cron: '0 * * * *' # run every 30 minutes
1111

12-
pull_request:
13-
branches:
14-
- main
15-
1612
jobs:
1713
Windows-D3D12-Intel-DXC:
18-
uses: ./.github/workflows/test-all.yaml
14+
uses: ./.github/workflows/build-and-test-callable.yaml
1915
with:
2016
OS: windows
2117
SKU: windows-intel
22-
Test-Clang: Off
2318
BuildType: Debug
2419
TestTarget: check-hlsl-d3d12
25-
OffloadTest-branch: ${{ github.event.pull_request.head.sha }}
20+
OffloadTest-branch: ${{ github.ref }}
2621
LLVM-ExtraCMakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl

.github/workflows/windows-intel-dxc-vk.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,13 @@ on:
99
schedule:
1010
- cron: '0 */2 * * *' # run every 2 hours
1111

12-
pull_request:
13-
branches:
14-
- main
15-
1612
jobs:
1713
Windows-VK-Intel-DXC:
18-
uses: ./.github/workflows/test-all.yaml
14+
uses: ./.github/workflows/build-and-test-callable.yaml
1915
with:
2016
OS: windows
2117
SKU: windows-intel
22-
Test-Clang: Off
2318
BuildType: Debug
2419
TestTarget: check-hlsl-vk
25-
OffloadTest-branch: ${{ github.event.pull_request.head.sha || github.ref }}
20+
OffloadTest-branch: ${{ github.ref }}
2621
LLVM-ExtraCMakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl

.github/workflows/windows-intel-dxc-warp-d3d12.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,13 @@ on:
99
schedule:
1010
- cron: '0 */2 * * *' # run every 2 hours
1111

12-
pull_request:
13-
branches:
14-
- main
15-
1612
jobs:
1713
Windows-D3D12-Warp-DXC:
18-
uses: ./.github/workflows/test-all.yaml
14+
uses: ./.github/workflows/build-and-test-callable.yaml
1915
with:
2016
OS: windows
2117
SKU: windows-intel
22-
Test-Clang: Off
2318
BuildType: Debug
2419
TestTarget: check-hlsl-warp-d3d12
25-
OffloadTest-branch: ${{ github.event.pull_request.head.sha || github.ref }}
20+
OffloadTest-branch: ${{ github.ref }}
2621
LLVM-ExtraCMakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl

0 commit comments

Comments
 (0)