Skip to content

Commit 442c2f1

Browse files
committed
upgrade ci
see unrealsdk 6c73287e for more details
1 parent 6d592d1 commit 442c2f1

File tree

1 file changed

+33
-95
lines changed

1 file changed

+33
-95
lines changed

.github/workflows/build.yml

Lines changed: 33 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,12 @@ on:
1212
required: false
1313

1414
env:
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

2518
jobs:
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
@@ -58,13 +30,9 @@ jobs:
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,11 @@ 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
84+
- name: Setup apt packages
85+
uses: awalsh128/cache-apt-pkgs-action@latest
86+
with:
87+
packages: msitools
88+
version: ${{ runner.os }}-apt
14189

14290
- name: Setup LLVM MinGW
14391
if: startswith(matrix.preset, 'llvm-mingw')
@@ -146,32 +94,31 @@ jobs:
14694
tar -xf ${{ env.LLVM_MINGW_VERSION }}.tar.xz -C ~/
14795
echo $(readlink -f ~/${{ env.LLVM_MINGW_VERSION }}/bin) >> $GITHUB_PATH
14896
149-
- name: Set up MinGW
97+
- name: Setup MinGW
15098
if: startswith(matrix.preset, 'mingw')
15199
uses: egor-tensin/setup-mingw@v2
152100
with:
153101
platform: ${{ fromJSON('["x86", "x64"]')[contains(matrix.preset, 'x64')] }}
154102

155-
# xwin does take long enough that caching's worth it
156-
- name: Restore xwin cache
157-
if: contains(matrix.preset, 'cross')
103+
- name: Setup Clang
104+
if: startswith(matrix.preset, 'clang-cross')
105+
uses: egor-tensin/setup-clang@v1
106+
107+
- name: Restore win sdk cache
108+
if: startswith(matrix.preset, 'clang-cross')
158109
uses: actions/cache@v4
159-
id: cache-xwin
110+
id: cache-win-sdk
160111
with:
161-
path: ~/xwin
162-
key: ${{ runner.os }}-xwin
112+
path: ~/win-sdk
113+
key: ${{ runner.os }}-win-sdk
163114

164-
- name: Setup xwin
165-
if: contains(matrix.preset, 'cross') && steps.cache-xwin.outputs.cache-hit != 'true'
115+
- name: Setup win sdk
116+
if: startswith(matrix.preset, 'clang-cross') && steps.cache-win-sdk.outputs.cache-hit != 'true'
166117
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
118+
git clone https://github.com/mstorsjo/msvc-wine.git
119+
msvc-wine/vsdownload.py --accept-license --dest ~/win-sdk Microsoft.VisualStudio.Workload.VCTools
120+
msvc-wine/install.sh ~/win-sdk
121+
rm -r msvc-wine
175122
176123
- name: Checkout repository and submodules
177124
uses: actions/checkout@v4
@@ -180,12 +127,12 @@ jobs:
180127

181128
- name: Configure CMake
182129
working-directory: ${{ env.GITHUB_WORKSPACE }}
183-
# The extra xwin dir arg won't do anything if we're not cross compiling
130+
# The extra msvc wine arg won't do anything if we're not cross compiling
184131
run: >
185132
cmake .
186133
--preset ${{ matrix.preset }}
187134
-G Ninja
188-
-DXWIN_DIR=$(readlink -f ~)/xwin
135+
-DMSVC_WINE_ENV_SCRIPT=$(readlink -f ~)/win-sdk/bin/${{ fromJSON('["x86", "x64"]')[contains(matrix.preset, 'x64')] }}/msvcenv.sh
189136
190137
- name: Build
191138
working-directory: ${{ env.GITHUB_WORKSPACE }}
@@ -201,7 +148,6 @@ jobs:
201148

202149
clang-tidy:
203150
runs-on: windows-latest
204-
needs: cache-clang
205151

206152
strategy:
207153
fail-fast: false
@@ -212,12 +158,9 @@ jobs:
212158
]
213159

214160
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
161+
- name: Setup Clang
162+
if: startswith(matrix.preset, 'clang')
163+
uses: egor-tensin/setup-clang@v1
221164

222165
- name: Setup CMake and Ninja
223166
uses: lukka/get-cmake@latest
@@ -246,7 +189,6 @@ jobs:
246189
working-directory: ${{ env.GITHUB_WORKSPACE }}
247190
run: |
248191
python (Get-Command run-clang-tidy).Source `
249-
-j ${{ env.CLANG_TIDY_JOBS }} `
250192
-p "out\build\${{ matrix.preset }}" `
251193
-export-fixes clang-tidy-fixes.yml `
252194
$([Regex]::Escape("$pwd\src") + ".+\.(c|cpp|h|hpp)$")
@@ -258,15 +200,11 @@ jobs:
258200

259201
clang-format:
260202
runs-on: windows-latest
261-
needs: cache-clang
262203

263204
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
205+
- name: Setup Clang
206+
if: startswith(matrix.preset, 'clang')
207+
uses: egor-tensin/setup-clang@v1
270208

271209
- name: Checkout repository
272210
uses: actions/checkout@v4

0 commit comments

Comments
 (0)