Skip to content

Commit 3e9524a

Browse files
authored
1 parent b4a3076 commit 3e9524a

File tree

1 file changed

+140
-0
lines changed

1 file changed

+140
-0
lines changed

.github/workflows/main.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: Devsh - Build & Deploy DXCompiler
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
COMMIT_SHA:
7+
description: 'Commit SHA to build'
8+
required: true
9+
10+
jobs:
11+
windows:
12+
name: Windows Build
13+
runs-on: windows-2022
14+
env:
15+
HLSL_SRC_DIR: ${{ github.workspace }}
16+
HLSL_BLD_DIR: "${{ github.workspace }}\\build"
17+
platform: x64
18+
os: windows-latest
19+
COMMIT_SHA: ${{ github.event.inputs.COMMIT_SHA }}
20+
strategy:
21+
matrix:
22+
configuration: [Release, Debug]
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v3
26+
with:
27+
ref: ${{ github.event.inputs.COMMIT_SHA }}
28+
clean: true
29+
submodules: true
30+
31+
- name: Build
32+
run: |
33+
call utils\hct\hctstart.cmd %HLSL_SRC_DIR% %HLSL_BLD_DIR%
34+
call utils\hct\hctbuild.cmd -${{ env.platform }} -${{ matrix.configuration }} -show-cmake-log -spirvtest
35+
shell: cmd
36+
37+
- name: CMake Install DXCompiler
38+
run: |
39+
cmake --install build/include/dxc --prefix build/install --config ${{ matrix.configuration }}
40+
cmake --install build/tools/clang/tools/dxcompiler --prefix build/install --config ${{ matrix.configuration }}
41+
cmake -E copy include/dxc/WinAdapter.h build/install/include/dxc/
42+
shell: cmd
43+
44+
- name: Archive Installed Directory
45+
run: cmake -E tar czf ${{ github.event.inputs.COMMIT_SHA }}.tar.gz build/install
46+
shell: cmd
47+
48+
- name: Upload Installed Artifact
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: ${{ env.os }}-${{ matrix.configuration }}-${{ github.event.inputs.COMMIT_SHA }}
52+
path: ${{ github.event.inputs.COMMIT_SHA }}.tar.gz
53+
54+
nix:
55+
name: Unix and macOS Build
56+
strategy:
57+
matrix:
58+
include:
59+
- os: ubuntu-latest
60+
name: Linux_Clang_Release
61+
configuration: Release
62+
CC: clang-18
63+
CXX: clang++-18
64+
CMAKE_OPTS: "-DLLVM_ENABLE_WERROR=On -DLLVM_USE_SANITIZER='Address;Undefined' -DLLVM_ENABLE_LIBCXX=On -DLLVM_USE_LINKER=lld"
65+
CHECK_ALL_ENV: "ASAN_OPTIONS=alloc_dealloc_mismatch=0"
66+
- os: ubuntu-latest
67+
name: Linux_Clang_Debug
68+
configuration: Debug
69+
CC: clang
70+
CXX: clang++
71+
CMAKE_OPTS: "-DLLVM_ENABLE_WERROR=On -DLLVM_USE_LINKER=lld"
72+
- os: macos-latest
73+
name: MacOS_Clang_Release
74+
configuration: Release
75+
CC: clang
76+
CXX: clang++
77+
CMAKE_OPTS: "-DLLVM_ENABLE_WERROR=On"
78+
- os: macos-latest
79+
name: MacOS_Clang_Debug
80+
configuration: Debug
81+
CC: clang
82+
CXX: clang++
83+
CMAKE_OPTS: "-DLLVM_ENABLE_WERROR=On"
84+
runs-on: ${{ matrix.os }}
85+
env:
86+
COMMIT_SHA: ${{ github.event.inputs.COMMIT_SHA }}
87+
steps:
88+
- name: Checkout repository
89+
uses: actions/checkout@v3
90+
with:
91+
ref: ${{ github.event.inputs.COMMIT_SHA }}
92+
clean: true
93+
submodules: true
94+
95+
- name: Set up Python
96+
uses: actions/setup-python@v4
97+
with:
98+
python-version: '3.x'
99+
100+
- name: Install dependencies on Linux
101+
if: ${{ matrix.os == 'ubuntu-latest' }}
102+
run: |
103+
sudo apt-get update
104+
sudo apt-get install -y ninja-build
105+
wget https://apt.llvm.org/llvm.sh
106+
chmod u+x llvm.sh
107+
sudo ./llvm.sh 18
108+
sudo apt-get install -y libc++-18-dev
109+
- name: Install dependencies on macOS
110+
if: ${{ matrix.os == 'macos-latest' }}
111+
run: |
112+
brew update
113+
brew install ninja
114+
ulimit -Sn 1024
115+
- name: Configure with CMake
116+
run: |
117+
cmake -B build -G Ninja $GITHUB_WORKSPACE \
118+
-DLLVM_LIT_ARGS="-v --xunit-xml-output=testresults.xunit.xml" \
119+
-C $GITHUB_WORKSPACE/cmake/caches/PredefinedParams.cmake \
120+
-DSPIRV_BUILD_TESTS=ON \
121+
-DCMAKE_BUILD_TYPE=${{ matrix.configuration }} \
122+
-DCMAKE_C_COMPILER=${{ matrix.CC }} \
123+
-DCMAKE_CXX_COMPILER=${{ matrix.CXX }} \
124+
${{ matrix.CMAKE_OPTS || '' }}
125+
- name: Build
126+
run: ninja -C build test-depends
127+
128+
- name: CMake Install DXCompiler
129+
run: |
130+
cmake --install build/include/dxc --prefix build/install --config ${{ matrix.configuration }}
131+
cmake --install build/tools/clang/tools/dxcompiler --prefix build/install --config ${{ matrix.configuration }}
132+
cmake -E copy include/dxc/WinAdapter.h build/install/include/dxc/
133+
- name: Archive Installed Directory
134+
run: cmake -E tar czf ${{ github.event.inputs.COMMIT_SHA }}.tar.gz build/install
135+
136+
- name: Upload Installed Artifact
137+
uses: actions/upload-artifact@v4
138+
with:
139+
name: ${{ matrix.os }}-${{ matrix.configuration }}-${{ github.event.inputs.COMMIT_SHA }}
140+
path: ${{ github.event.inputs.COMMIT_SHA }}.tar.gz

0 commit comments

Comments
 (0)