Devsh - Build & Deploy DXCompiler #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Devsh - Build & Deploy DXCompiler | |
on: | |
workflow_dispatch: | |
inputs: | |
COMMIT_SHA: | |
description: 'Commit SHA to build' | |
required: true | |
jobs: | |
windows: | |
name: Windows Build | |
runs-on: windows-2022 | |
env: | |
HLSL_SRC_DIR: ${{ github.workspace }} | |
HLSL_BLD_DIR: "${{ github.workspace }}\\build" | |
platform: x64 | |
os: windows-latest | |
COMMIT_SHA: ${{ github.event.inputs.COMMIT_SHA }} | |
strategy: | |
matrix: | |
configuration: [Release, Debug] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.COMMIT_SHA }} | |
clean: true | |
submodules: true | |
- name: Build | |
run: | | |
call utils\hct\hctstart.cmd %HLSL_SRC_DIR% %HLSL_BLD_DIR% | |
call utils\hct\hctbuild.cmd -${{ env.platform }} -${{ matrix.configuration }} -show-cmake-log -spirvtest | |
shell: cmd | |
- name: CMake Install DXCompiler | |
run: | | |
cmake --install build/include/dxc --prefix build/install --config ${{ matrix.configuration }} | |
cmake --install build/tools/clang/tools/dxcompiler --prefix build/install --config ${{ matrix.configuration }} | |
cmake -E copy build/${{ matrix.configuration }}/bin/dxcompiler.pdb build/install/lib/ | |
cmake -E copy include/dxc/WinAdapter.h build/install/include/dxc/ | |
shell: cmd | |
- name: Archive Installed Directory | |
run: cmake -E tar czf ${{ github.event.inputs.COMMIT_SHA }}.tar.gz build/install | |
shell: cmd | |
- name: Upload Installed Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.os }}-${{ matrix.configuration }}-${{ github.event.inputs.COMMIT_SHA }} | |
path: ${{ github.event.inputs.COMMIT_SHA }}.tar.gz | |
nix: | |
name: Unix and macOS Build | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
name: Linux_Clang_Release | |
configuration: Release | |
CC: clang-18 | |
CXX: clang++-18 | |
CMAKE_OPTS: "-DLLVM_ENABLE_WERROR=On -DLLVM_USE_LINKER=lld" | |
- os: ubuntu-latest | |
name: Linux_Clang_Debug | |
configuration: Debug | |
CC: clang | |
CXX: clang++ | |
CMAKE_OPTS: "-DLLVM_ENABLE_WERROR=On -DLLVM_USE_LINKER=lld" | |
- os: macos-latest | |
name: MacOS_Clang_Release | |
configuration: Release | |
CC: clang | |
CXX: clang++ | |
CMAKE_OPTS: "-DLLVM_ENABLE_WERROR=On" | |
- os: macos-latest | |
name: MacOS_Clang_Debug | |
configuration: Debug | |
CC: clang | |
CXX: clang++ | |
CMAKE_OPTS: "-DLLVM_ENABLE_WERROR=On" | |
runs-on: ${{ matrix.os }} | |
env: | |
COMMIT_SHA: ${{ github.event.inputs.COMMIT_SHA }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.COMMIT_SHA }} | |
clean: true | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies on Linux | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ninja-build | |
wget https://apt.llvm.org/llvm.sh | |
chmod u+x llvm.sh | |
sudo ./llvm.sh 18 | |
sudo apt-get install -y libc++-18-dev | |
- name: Install dependencies on macOS | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: | | |
brew update | |
brew install ninja | |
ulimit -Sn 1024 | |
- name: Configure with CMake | |
run: | | |
cmake -B build -G Ninja $GITHUB_WORKSPACE \ | |
-DLLVM_LIT_ARGS="-v --xunit-xml-output=testresults.xunit.xml" \ | |
-C $GITHUB_WORKSPACE/cmake/caches/PredefinedParams.cmake \ | |
-DSPIRV_BUILD_TESTS=OFF \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.configuration }} \ | |
-DCMAKE_C_COMPILER=${{ matrix.CC }} \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.CXX }} \ | |
${{ matrix.CMAKE_OPTS || '' }} | |
- name: Build | |
run: ninja -C build test-depends | |
- name: CMake Install DXCompiler | |
run: | | |
cmake --install build/include/dxc --prefix build/install --config ${{ matrix.configuration }} | |
cmake --install build/tools/clang/tools/dxcompiler --prefix build/install --config ${{ matrix.configuration }} | |
cmake -E copy include/dxc/WinAdapter.h build/install/include/dxc/ | |
- name: Archive Installed Directory | |
run: cmake -E tar czf ${{ github.event.inputs.COMMIT_SHA }}.tar.gz build/install | |
- name: Upload Installed Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-${{ matrix.configuration }}-${{ github.event.inputs.COMMIT_SHA }} | |
path: ${{ github.event.inputs.COMMIT_SHA }}.tar.gz |