[llvm] Add pre-merge workflow for HLSL testing (PR #122184)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 8 14:47:05 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-github-workflow
Author: Chris B (llvm-beanz)
<details>
<summary>Changes</summary>
This adds a workflow for running HLSL tests on PRs that modify HLSL and DirectX code.
---
Full diff: https://github.com/llvm/llvm-project/pull/122184.diff
2 Files Affected:
- (added) .github/workflows/hlsl-macos.yaml (+26)
- (added) .github/workflows/hlsl/hlsl-all.yaml (+177)
``````````diff
diff --git a/.github/workflows/hlsl-macos.yaml b/.github/workflows/hlsl-macos.yaml
new file mode 100644
index 00000000000000..f63888a8b9beff
--- /dev/null
+++ b/.github/workflows/hlsl-macos.yaml
@@ -0,0 +1,26 @@
+name: HLSL Tests - macOS
+
+permissions:
+ contents: read
+ checks: write
+
+on:
+ workflow_dispatch:
+ pull_request:
+ branches:
+ - main
+ paths:
+ - 'llvm/**/DirectX/**'
+ - '.github/workflows/hlsl*'
+ - clang/*HLSL*/**/*
+ - clang/**/*HLSL*
+ - llvm/**/Frontend/HLSL/**/*
+
+jobs:
+ macOS-Metal-Clang:
+ uses: ./.github/workflows/hlsl/hlsl-all.yaml
+ with:
+ OS: macOS
+ SKU: hlsl-metal
+ TestTarget: check-hlsl-clang-mtl
+ LLVM-branch: ${{ github.ref }}
diff --git a/.github/workflows/hlsl/hlsl-all.yaml b/.github/workflows/hlsl/hlsl-all.yaml
new file mode 100644
index 00000000000000..6195891a4ec0e7
--- /dev/null
+++ b/.github/workflows/hlsl/hlsl-all.yaml
@@ -0,0 +1,177 @@
+name: HLSL Test
+
+permissions:
+ contents: read
+ checks: write
+
+on:
+ workflow_dispatch:
+ inputs:
+ LLVM-Ref:
+ description: 'Test Suite Branch'
+ required: false
+ default: 'main'
+ type: string
+ LLVM-branch:
+ description: 'LLVM Branch'
+ required: false
+ default: 'main'
+ type: string
+ LLVM-fork:
+ description: 'LLVM fork'
+ required: false
+ default: 'llvm'
+ type: string
+ DXC-branch:
+ description: 'DXC Branch'
+ required: false
+ default: 'main'
+ type: string
+ BuildType:
+ description: 'Build Type'
+ required: false
+ default: 'Release'
+ type: choice
+ options:
+ - Release
+ - RelWithDebInfo
+ - Debug
+ TestTarget:
+ required: false
+ default: 'check-hlsl'
+ type: string
+ Test-Clang:
+ required: true
+ type: choice
+ options:
+ - On
+ - Off
+ OS:
+ required: true
+ type: choice
+ options:
+ - macOS
+ - windows
+ SKU:
+ required: true
+ type: choice
+ options:
+ - hlsl-metal
+ LLVM-ExtraCMakeArgs:
+ description: 'Extra CMake Args for LLVM'
+ required: false
+ default: ''
+ type: string
+ workflow_call:
+ inputs:
+ OffloadTest-branch:
+ description: 'Test Suite Branch'
+ required: false
+ default: 'main'
+ type: string
+ LLVM-branch:
+ description: 'LLVM Branch'
+ required: false
+ default: 'main'
+ type: string
+ LLVM-fork:
+ description: 'LLVM For'
+ required: false
+ default: 'llvm'
+ type: string
+ DXC-branch:
+ description: 'DXC Branch'
+ required: false
+ default: 'main'
+ type: string
+ OS:
+ required: true
+ type: string
+ SKU:
+ required: true
+ type: string
+ BuildType:
+ description: 'DXC Branch'
+ required: false
+ default: 'Release'
+ type: string
+ Test-Clang:
+ required: false
+ default: 'On'
+ type: string
+ TestTarget:
+ required: false
+ default: 'check-hlsl'
+ type: string
+ LLVM-ExtraCMakeArgs:
+ description: 'Extra CMake Args for LLVM'
+ required: false
+ default: ''
+ type: string
+
+jobs:
+ build:
+ runs-on: [self-hosted, "${{ inputs.SKU }}"]
+ steps:
+ - name: Checkout DXC
+ uses: actions/checkout at v4
+ with:
+ repository: Microsoft/DirectXShaderCompiler
+ ref: ${{ inputs.DXC-branch }}
+ path: DXC
+ fetch-depth: 1
+ submodules: true
+ - name: Checkout LLVM
+ uses: actions/checkout at v4
+ with:
+ repository: ${{ inputs.LLVM-fork }}/llvm-project
+ ref: ${{ inputs.LLVM-branch }}
+ path: llvm-project
+ fetch-depth: 1
+ - name: Checkout OffloadTest
+ uses: actions/checkout at v4
+ with:
+ repository: llvm-beanz/offload-test-suite
+ ref: ${{ inputs.OffloadTest-branch }}
+ path: OffloadTest
+ fetch-depth: 1
+ - name: Checkout Golden Images
+ uses: actions/checkout at v4
+ with:
+ repository: llvm-beanz/offload-golden-images
+ ref: main
+ path: golden-images
+ fetch-depth: 1
+ - name: Setup Windows
+ if: inputs.OS == 'windows'
+ uses: llvm/actions/setup-windows at main
+ with:
+ arch: amd64
+ - name: Build DXC
+ run: |
+ cd DXC
+ mkdir build
+ cd build
+ cmake -G Ninja -DCMAKE_BUILD_TYPE=${{ inputs.BuildType }} -C ${{ github.workspace }}/DXC/cmake/caches/PredefinedParams.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DHLSL_DISABLE_SOURCE_GENERATION=On ${{ github.workspace }}/DXC/
+ ninja
+ - name: Build LLVM
+ run: |
+ cd llvm-project
+ mkdir build
+ cd build
+ cmake -G Ninja ${{ inputs.LLVM-ExtraCMakeArgs }} -DDXIL_DIS=${{ github.workspace }}/DXC/build/bin/llvm-dis -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/
+ ninja hlsl-test-depends llvm-test-depends clang-test-depends
+ - name: Run HLSL Tests
+ run: |
+ cd llvm-project
+ cd build
+ ninja check-llvm
+ ninja check-clang
+ ninja check-hlsl-unit
+ ninja ${{ inputs.TestTarget }}
+ - name: Publish Test Results
+ uses: EnricoMi/publish-unit-test-result-action/macos at v2
+ if: always() && inputs.OS == 'macOS'
+ with:
+ comment_mode: off
+ files: llvm-project/build/**/testresults.xunit.xml
``````````
</details>
https://github.com/llvm/llvm-project/pull/122184
More information about the llvm-commits
mailing list