1212 required : false
1313
1414env :
15- # Important to pin the clang version, cause we also use it for linting
16- CLANG_VERSION : 17
17- CLANG_TIDY_JOBS : 4
18- # LLVM MinGW download
19- LLVM_MINGW_VERSION : llvm-mingw-20231128-msvcrt-ubuntu-20.04-x86_64
20- LLVM_MINGW_DOWNLOAD : https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/llvm-mingw-20231128-msvcrt-ubuntu-20.04-x86_64.tar.xz
21- # xwin settings
22- XWIN_VERSION : xwin-0.5.0-x86_64-unknown-linux-musl
23- XWIN_DOWNLOAD : https://github.com/Jake-Shadle/xwin/releases/download/0.5.0/xwin-0.5.0-x86_64-unknown-linux-musl.tar.gz
15+ LLVM_MINGW_VERSION : llvm-mingw-20240619-msvcrt-ubuntu-20.04-x86_64
16+ LLVM_MINGW_DOWNLOAD : https://github.com/mstorsjo/llvm-mingw/releases/download/20240619/llvm-mingw-20240619-msvcrt-ubuntu-20.04-x86_64.tar.xz
2417
2518jobs :
26- cache-clang :
27- runs-on : windows-latest
28-
29- steps :
30- - name : Cache Clang
31- uses : actions/cache@v4
32- id : cache-clang
33- with :
34- path : C:\Program Files\LLVM
35- key : ${{ runner.os }}-clang-${{ env.CLANG_VERSION }}
36- lookup-only : true
37-
38- - name : Setup Clang
39- if : steps.cache-clang.outputs.cache-hit != 'true'
40- uses : egor-tensin/setup-clang@v1
41- with :
42- version : ${{ env.CLANG_VERSION }}
43-
44- # ==============================================================================
45-
4619 build-windows :
4720 runs-on : windows-latest
48- needs : cache-clang
4921
5022 strategy :
5123 fail-fast : false
5830 ]
5931
6032 steps :
61- - name : Restore Clang Cache
33+ - name : Setup Clang
6234 if : startswith(matrix.preset, 'clang')
63- uses : actions/cache/restore@v4
64- with :
65- path : C:\Program Files\LLVM
66- key : ${{ runner.os }}-clang-${{ env.CLANG_VERSION }}
67- fail-on-cache-miss : true
35+ uses : egor-tensin/setup-clang@v1
6836
6937 - name : Add MSVC to PATH
7038 if : startswith(matrix.preset, 'msvc')
@@ -113,31 +81,6 @@ jobs:
11381 - name : Setup CMake and Ninja
11482 uses : lukka/get-cmake@latest
11583
116- # Both Clang and MinGW install quick enough that it's not worth caching
117- # Caching would also lose the +x - so we'd have to tar before caching/untar after, making it
118- # even slower
119- - name : Setup Clang
120- if : startswith(matrix.preset, 'clang')
121- run : |
122- wget https://apt.llvm.org/llvm.sh
123- chmod +x llvm.sh
124- sudo ./llvm.sh ${{ env.CLANG_VERSION }}
125-
126- sudo update-alternatives --install \
127- /usr/bin/clang \
128- clang \
129- /usr/bin/clang-${{ env.CLANG_VERSION }} \
130- 200
131- sudo update-alternatives --install \
132- /usr/bin/clang++ \
133- clang++ \
134- /usr/bin/clang++-${{ env.CLANG_VERSION }} \
135- 200
136- sudo update-alternatives --install \
137- /usr/bin/llvm-rc \
138- llvm-rc \
139- /usr/bin/llvm-rc-${{ env.CLANG_VERSION }} \
140- 200
14184
14285 - name : Setup LLVM MinGW
14386 if : startswith(matrix.preset, 'llvm-mingw')
@@ -146,32 +89,31 @@ jobs:
14689 tar -xf ${{ env.LLVM_MINGW_VERSION }}.tar.xz -C ~/
14790 echo $(readlink -f ~/${{ env.LLVM_MINGW_VERSION }}/bin) >> $GITHUB_PATH
14891
149- - name : Set up MinGW
92+ - name : Setup MinGW
15093 if : startswith(matrix.preset, 'mingw')
15194 uses : egor-tensin/setup-mingw@v2
15295 with :
15396 platform : ${{ fromJSON('["x86", "x64"]')[contains(matrix.preset, 'x64')] }}
15497
155- # xwin does take long enough that caching's worth it
156- - name : Restore xwin cache
157- if : contains(matrix.preset, 'cross')
98+ - name : Setup Clang
99+ if : startswith(matrix.preset, 'clang-cross')
100+ uses : egor-tensin/setup-clang@v1
101+
102+ - name : Restore win sdk cache
103+ if : startswith(matrix.preset, 'clang-cross')
158104 uses : actions/cache@v4
159- id : cache-xwin
105+ id : cache-win-sdk
160106 with :
161- path : ~/xwin
162- key : ${{ runner.os }}-xwin
107+ path : ~/win-sdk
108+ key : ${{ runner.os }}-win-sdk
163109
164- - name : Setup xwin
165- if : contains (matrix.preset, 'cross') && steps.cache-xwin .outputs.cache-hit != 'true'
110+ - name : Setup win sdk
111+ if : startswith (matrix.preset, 'clang- cross') && steps.cache-win-sdk .outputs.cache-hit != 'true'
166112 run : |
167- wget -nv ${{ env.XWIN_DOWNLOAD }}
168- tar -xf ${{ env.XWIN_VERSION }}.tar.gz
169- ${{ env.XWIN_VERSION }}/xwin \
170- --accept-license \
171- --arch x86,x86_64 \
172- splat \
173- --include-debug-libs \
174- --output ~/xwin
113+ git clone https://github.com/mstorsjo/msvc-wine.git
114+ msvc-wine/vsdownload.py --accept-license --dest ~/win-sdk Microsoft.VisualStudio.Workload.VCTools
115+ msvc-wine/install.sh ~/win-sdk
116+ rm -r msvc-wine
175117
176118 - name : Checkout repository and submodules
177119 uses : actions/checkout@v4
@@ -180,12 +122,12 @@ jobs:
180122
181123 - name : Configure CMake
182124 working-directory : ${{ env.GITHUB_WORKSPACE }}
183- # The extra xwin dir arg won't do anything if we're not cross compiling
125+ # The extra msvc wine arg won't do anything if we're not cross compiling
184126 run : >
185127 cmake .
186128 --preset ${{ matrix.preset }}
187129 -G Ninja
188- -DXWIN_DIR =$(readlink -f ~)/xwin
130+ -DMSVC_WINE_ENV_SCRIPT =$(readlink -f ~)/win-sdk/bin/${{ fromJSON('["x86", "x64"]')[contains(matrix.preset, 'x64')] }}/msvcenv.sh
189131
190132 - name : Build
191133 working-directory : ${{ env.GITHUB_WORKSPACE }}
@@ -201,7 +143,6 @@ jobs:
201143
202144 clang-tidy :
203145 runs-on : windows-latest
204- needs : cache-clang
205146
206147 strategy :
207148 fail-fast : false
@@ -212,12 +153,9 @@ jobs:
212153 ]
213154
214155 steps :
215- - name : Restore Clang Cache
216- uses : actions/cache/restore@v4
217- with :
218- path : C:\Program Files\LLVM
219- key : ${{ runner.os }}-clang-${{ env.CLANG_VERSION }}
220- fail-on-cache-miss : true
156+ - name : Setup Clang
157+ if : startswith(matrix.preset, 'clang')
158+ uses : egor-tensin/setup-clang@v1
221159
222160 - name : Setup CMake and Ninja
223161 uses : lukka/get-cmake@latest
@@ -246,7 +184,6 @@ jobs:
246184 working-directory : ${{ env.GITHUB_WORKSPACE }}
247185 run : |
248186 python (Get-Command run-clang-tidy).Source `
249- -j ${{ env.CLANG_TIDY_JOBS }} `
250187 -p "out\build\${{ matrix.preset }}" `
251188 -export-fixes clang-tidy-fixes.yml `
252189 $([Regex]::Escape("$pwd\src") + ".+\.(c|cpp|h|hpp)$")
@@ -258,15 +195,11 @@ jobs:
258195
259196 clang-format :
260197 runs-on : windows-latest
261- needs : cache-clang
262198
263199 steps :
264- - name : Restore Clang Cache
265- uses : actions/cache/restore@v4
266- with :
267- path : C:\Program Files\LLVM
268- key : ${{ runner.os }}-clang-${{ env.CLANG_VERSION }}
269- fail-on-cache-miss : true
200+ - name : Setup Clang
201+ if : startswith(matrix.preset, 'clang')
202+ uses : egor-tensin/setup-clang@v1
270203
271204 - name : Checkout repository
272205 uses : actions/checkout@v4
0 commit comments