1313 required : false
1414
1515env :
16- # Important to pin the clang version, cause we also use it for linting
17- CLANG_VERSION : 17
18- CLANG_TIDY_JOBS : 4
1916 # LLVM MinGW download
20- LLVM_MINGW_VERSION : llvm-mingw-20231128-msvcrt-ubuntu-20.04-x86_64
21- LLVM_MINGW_DOWNLOAD : https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/llvm-mingw-20231128-msvcrt-ubuntu-20.04-x86_64.tar.xz
22- # xwin settings
23- XWIN_VERSION : xwin-0.5.0-x86_64-unknown-linux-musl
24- XWIN_DOWNLOAD : https://github.com/Jake-Shadle/xwin/releases/download/0.5.0/xwin-0.5.0-x86_64-unknown-linux-musl.tar.gz
25- # Python settings
26- PYTHON_VERSION : " 3.12.3"
17+ LLVM_MINGW_VERSION : llvm-mingw-20240619-msvcrt-ubuntu-20.04-x86_64
18+ LLVM_MINGW_DOWNLOAD : https://github.com/mstorsjo/llvm-mingw/releases/download/20240619/llvm-mingw-20240619-msvcrt-ubuntu-20.04-x86_64.tar.xz
2719
2820jobs :
29- cache-clang :
30- runs-on : windows-latest
31-
32- steps :
33- - name : Cache Clang
34- uses : actions/cache@v4
35- id : cache-clang
36- with :
37- path : C:\Program Files\LLVM
38- key : ${{ runner.os }}-clang-${{ env.CLANG_VERSION }}
39- lookup-only : true
40-
41- - name : Setup Clang
42- if : steps.cache-clang.outputs.cache-hit != 'true'
43- uses : egor-tensin/setup-clang@v1
44- with :
45- version : ${{ env.CLANG_VERSION }}
46-
47- # ==============================================================================
48-
4921 build-windows :
5022 runs-on : windows-latest
51- needs : cache-clang
5223
5324 strategy :
5425 fail-fast : false
5829 - msvc-release
5930
6031 steps :
61- - name : Restore Clang Cache
32+ - name : Setup Clang
6233 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
34+ uses : egor-tensin/setup-clang@v1
6835
6936 - name : Add MSVC to PATH
7037 if : startswith(matrix.preset, 'msvc')
9259 run : |
9360 pip install requests
9461
95- python libs/pyunrealsdk/common_cmake/explicit_python/download.py `
96- ${{ env.PYTHON_VERSION }} `
97- amd64 `
98- --no-debug
99-
100- cmake . --preset ${{ matrix.preset }}
62+ cmake . --preset ${{ matrix.preset }} -G Ninja
10163
10264 - name : Build
10365 working-directory : ${{ env.GITHUB_WORKSPACE }}
@@ -122,114 +84,73 @@ jobs:
12284 path : " *.zip"
12385
12486 build-ubuntu :
125- runs-on : ubuntu-latest
87+ # Require at least 24 for the mingw build
88+ runs-on : ubuntu-24.04
12689
12790 strategy :
12891 fail-fast : false
12992 matrix :
13093 preset :
13194 - clang-cross-release
13295 - llvm-mingw-release
133- # Currently, ubuntu-latest is 22.04, whose mingw version is too old, so disabling this build
134- # for now
135- # Not sure of the exact threshold, 13.1.0 works
136- # - mingw-release
96+ - mingw-release
13797
13898 steps :
13999 - name : Setup CMake and Ninja
140100 uses : lukka/get-cmake@latest
141101
142- - name : Setup Python
143- uses : actions/setup-python@v5
144- with :
145- python-version : " >=3.11"
146-
147- - name : Setup msitools
102+ - name : Setup apt packages
148103 uses : awalsh128/cache-apt-pkgs-action@latest
149104 with :
150- packages : msitools
105+ packages : msitools python3-requests
151106 version : ${{ runner.os }}-apt
152107
153- # Both Clang and MinGW install quick enough that it's not worth caching
154- # Caching would also lose the +x - so we'd have to tar before caching/untar after, making it
155- # even slower
156- - name : Setup Clang
157- if : startswith(matrix.preset, 'clang')
158- run : |
159- wget https://apt.llvm.org/llvm.sh
160- chmod +x llvm.sh
161- sudo ./llvm.sh ${{ env.CLANG_VERSION }}
162-
163- sudo update-alternatives --install \
164- /usr/bin/clang \
165- clang \
166- /usr/bin/clang-${{ env.CLANG_VERSION }} \
167- 200
168- sudo update-alternatives --install \
169- /usr/bin/clang++ \
170- clang++ \
171- /usr/bin/clang++-${{ env.CLANG_VERSION }} \
172- 200
173- sudo update-alternatives --install \
174- /usr/bin/llvm-rc \
175- llvm-rc \
176- /usr/bin/llvm-rc-${{ env.CLANG_VERSION }} \
177- 200
178-
179108 - name : Setup LLVM MinGW
180109 if : startswith(matrix.preset, 'llvm-mingw')
181110 run : |
182111 wget -nv ${{ env.LLVM_MINGW_DOWNLOAD }}
183112 tar -xf ${{ env.LLVM_MINGW_VERSION }}.tar.xz -C ~/
184113 echo $(readlink -f ~/${{ env.LLVM_MINGW_VERSION }}/bin) >> $GITHUB_PATH
185114
186- - name : Set up MinGW
115+ - name : Setup MinGW
187116 if : startswith(matrix.preset, 'mingw')
188117 uses : egor-tensin/setup-mingw@v2
189118 with :
190- platform : ${{ fromJSON('["x86", "x64"]')[contains(matrix.preset, 'x64')] }}
119+ platform : x64
120+
121+ - name : Setup Clang
122+ if : startswith(matrix.preset, 'clang-cross')
123+ uses : egor-tensin/setup-clang@v1
191124
192- # xwin does take long enough that caching's worth it
193- - name : Restore xwin cache
194- if : contains(matrix.preset, 'cross')
125+ - name : Restore win sdk cache
126+ if : startswith(matrix.preset, 'clang-cross')
195127 uses : actions/cache@v4
196- id : cache-xwin
128+ id : cache-win-sdk
197129 with :
198- path : ~/xwin
199- key : ${{ runner.os }}-xwin
130+ path : ~/win-sdk
131+ key : ${{ runner.os }}-win-sdk
200132
201- - name : Setup xwin
202- if : contains (matrix.preset, 'cross') && steps.cache-xwin .outputs.cache-hit != 'true'
133+ - name : Setup win sdk
134+ if : startswith (matrix.preset, 'clang- cross') && steps.cache-win-sdk .outputs.cache-hit != 'true'
203135 run : |
204- wget -nv ${{ env.XWIN_DOWNLOAD }}
205- tar -xf ${{ env.XWIN_VERSION }}.tar.gz
206- ${{ env.XWIN_VERSION }}/xwin \
207- --accept-license \
208- --arch x86_64 \
209- splat \
210- --include-debug-libs \
211- --output ~/xwin
136+ git clone https://github.com/mstorsjo/msvc-wine.git
137+ msvc-wine/vsdownload.py --accept-license --dest ~/win-sdk Microsoft.VisualStudio.Workload.VCTools
138+ msvc-wine/install.sh ~/win-sdk
139+ rm -r msvc-wine
212140
213141 - name : Checkout repository and submodules
214142 uses : actions/checkout@v4
215143 with :
216144 submodules : recursive
217145
218- - name : Configure build
146+ - name : Configure CMake
219147 working-directory : ${{ env.GITHUB_WORKSPACE }}
220- run : |
221- pip install requests
222-
223- python libs/pyunrealsdk/common_cmake/explicit_python/download.py \
224- ${{ env.PYTHON_VERSION }} \
225- amd64 \
226- --no-debug
227-
228- cmake . \
229- --preset ${{ matrix.preset }} \
230- -G Ninja \
231- -DXWIN_DIR=$(readlink -f ~)/xwin
232- # The extra xwin dir arg won't do anything if we're not cross compiling
148+ # The extra msvc wine arg won't do anything if we're not cross compiling
149+ run : >
150+ cmake .
151+ --preset ${{ matrix.preset }}
152+ -G Ninja
153+ -DMSVC_WINE_ENV_SCRIPT=$(readlink -f ~)/win-sdk/bin/x64/msvcenv.sh
233154
234155 - name : Build
235156 working-directory : ${{ env.GITHUB_WORKSPACE }}
@@ -250,7 +171,6 @@ jobs:
250171
251172 clang-tidy :
252173 runs-on : windows-latest
253- needs : cache-clang
254174
255175 strategy :
256176 fail-fast : false
@@ -259,12 +179,9 @@ jobs:
259179 - clang-release
260180
261181 steps :
262- - name : Restore Clang Cache
263- uses : actions/cache/restore@v4
264- with :
265- path : C:\Program Files\LLVM
266- key : ${{ runner.os }}-clang-${{ env.CLANG_VERSION }}
267- fail-on-cache-miss : true
182+ - name : Setup Clang
183+ if : startswith(matrix.preset, 'clang')
184+ uses : egor-tensin/setup-clang@v1
268185
269186 - name : Setup CMake and Ninja
270187 uses : lukka/get-cmake@latest
@@ -274,24 +191,21 @@ jobs:
274191 with :
275192 python-version : " >=3.11"
276193
194+ # Needed pyyaml for clang tidy to enable `-export-fixes` and requests for the python lib downloader
195+ - name : Install pip packages
196+ run : pip install pyyaml requests
197+
277198 - name : Checkout repository and submodules
278199 uses : actions/checkout@v4
279200 with :
280201 submodules : recursive
281202
282- - name : Configure build
203+ - name : Configure CMake
283204 working-directory : ${{ env.GITHUB_WORKSPACE }}
284- # Also need pyyaml for clang tidy to enable `-export-fixes`
285- run : |
286- pip install pyyaml requests
287-
288- python libs/pyunrealsdk/common_cmake/explicit_python/download.py `
289- ${{ env.PYTHON_VERSION }} `
290- amd64 `
291- --no-debug
292-
293- cmake . --preset ${{ matrix.preset }} -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On
205+ run : cmake . --preset ${{ matrix.preset }} -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On
294206
207+ - name : Remove `.modmap`s from compile commands
208+ run : |
295209 (Get-Content "out\build\${{ matrix.preset }}\compile_commands.json") `
296210 -replace "@CMakeFiles.+?\.modmap", "" `
297211 | Set-Content `
@@ -301,15 +215,9 @@ jobs:
301215 working-directory : ${{ env.GITHUB_WORKSPACE }}
302216 run : |
303217 python (Get-Command run-clang-tidy).Source `
304- -j ${{ env.CLANG_TIDY_JOBS }} `
305218 -p "out\build\${{ matrix.preset }}" `
306219 -export-fixes clang-tidy-fixes.yml `
307- $([Regex]::Escape("$pwd\src") + ".+\.(c|cpp|h|hpp)$") `
308- -extra-arg="-Wno-unknown-pragmas"
309- # For some reason, the above started giving unknown pragma errors in library headers (both
310- # unrealsdk and python) in clang-tidy 17
311- # It compiles fine, doesn't show up in clangd, and doesn't happen in the unrealsdk build, so
312- # just suppressing it for now
220+ $([Regex]::Escape("$pwd\src") + ".+\.(c|cpp|h|hpp)$")
313221
314222 - name : Process clang-tidy warnings
315223 uses : asarium/clang-tidy-action@v1
@@ -318,15 +226,11 @@ jobs:
318226
319227 clang-format :
320228 runs-on : windows-latest
321- needs : cache-clang
322229
323230 steps :
324- - name : Restore Clang Cache
325- uses : actions/cache/restore@v4
326- with :
327- path : C:\Program Files\LLVM
328- key : ${{ runner.os }}-clang-${{ env.CLANG_VERSION }}
329- fail-on-cache-miss : true
231+ - name : Setup Clang
232+ if : startswith(matrix.preset, 'clang')
233+ uses : egor-tensin/setup-clang@v1
330234
331235 - name : Checkout repository
332236 uses : actions/checkout@v4
0 commit comments