Skip to content

Commit e6f6509

Browse files
authored
Merge pull request #47 from apple1417/master
various minor misc improvements, linting fixes, containerize linux builds
2 parents d90b545 + 927b108 commit e6f6509

File tree

19 files changed

+212
-108
lines changed

19 files changed

+212
-108
lines changed

.clang-tidy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,6 @@ CheckOptions:
5151
readability-identifier-naming.NamespaceCase: lower_case
5252
readability-identifier-naming.ParameterCase: lower_case
5353
readability-identifier-naming.VariableCase: lower_case
54+
55+
readability-identifier-length.IgnoredVariableNames: _
5456
---

.cruft.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "[email protected]:bl-sdk/common_dotfiles.git",
3-
"commit": "d03eee713ad436d20033d0598eb88f1529c56ca8",
3+
"commit": "cee5c9dbf5b95f57bb636e5138171aa6a4964cf1",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
@@ -15,7 +15,8 @@
1515
"__project_slug": "willow_mod_manager",
1616
"include_cpp": true,
1717
"include_py": true,
18-
"_template": "[email protected]:bl-sdk/common_dotfiles.git"
18+
"_template": "[email protected]:bl-sdk/common_dotfiles.git",
19+
"_commit": "cee5c9dbf5b95f57bb636e5138171aa6a4964cf1"
1920
}
2021
},
2122
"directory": null

.devcontainer/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Ignore any custom folders outside of our predefined ones, to let you create your own
2+
# One use might be using your own container mapping the install path onto your actual game folder
3+
*/
4+
!clang-cross
5+
!llvm-mingw
6+
!mingw

.devcontainer/Dockerfile

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
FROM alpine:latest AS clang-cross
2+
CMD ["/bin/bash"]
3+
RUN <<EOF
4+
apk add --no-cache \
5+
bash \
6+
clang \
7+
clang-extra-tools \
8+
cmake \
9+
git \
10+
lld \
11+
llvm \
12+
msitools \
13+
ninja \
14+
openssh \
15+
perl \
16+
python3 \
17+
py3-requests
18+
git clone https://github.com/mstorsjo/msvc-wine.git
19+
msvc-wine/vsdownload.py \
20+
--accept-license \
21+
--dest /win-sdk \
22+
Microsoft.VisualStudio.Workload.VCTools \
23+
--arch x86 x64
24+
msvc-wine/install.sh /win-sdk
25+
rm -r msvc-wine
26+
EOF
27+
28+
# llvm-mingw comes with pre-built ubuntu binaries, so using that
29+
FROM ubuntu:latest AS llvm-mingw
30+
CMD ["/bin/bash"]
31+
RUN <<EOF
32+
apt-get update
33+
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC \
34+
apt-get install -y \
35+
cmake \
36+
git \
37+
msitools \
38+
ninja-build \
39+
python-is-python3 \
40+
python3 \
41+
python3-requests \
42+
wget \
43+
xz-utils
44+
wget -nv https://github.com/mstorsjo/llvm-mingw/releases/download/20250114/llvm-mingw-20250114-msvcrt-ubuntu-20.04-x86_64.tar.xz
45+
tar -xf llvm-mingw-20250114-msvcrt-ubuntu-20.04-x86_64.tar.xz
46+
rm llvm-mingw-20250114-msvcrt-ubuntu-20.04-x86_64.tar.xz
47+
mv llvm-mingw-20250114-msvcrt-ubuntu-20.04-x86_64 /llvm-mingw
48+
EOF
49+
ENV PATH="/llvm-mingw/bin:$PATH"
50+
51+
FROM alpine:latest AS mingw
52+
CMD ["/bin/bash"]
53+
RUN <<EOF
54+
apk add --no-cache \
55+
bash \
56+
cmake \
57+
git \
58+
i686-mingw-w64-gcc \
59+
mingw-w64-gcc \
60+
msitools \
61+
ninja \
62+
openssh \
63+
py3-requests \
64+
python3
65+
EOF
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "clang-cross",
3+
"build": {
4+
"dockerfile": "../Dockerfile",
5+
"target": "clang-cross"
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "llvm-mingw",
3+
"build": {
4+
"dockerfile": "../Dockerfile",
5+
"target": "llvm-mingw"
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "mingw",
3+
"build": {
4+
"dockerfile": "../Dockerfile",
5+
"target": "mingw"
6+
}
7+
}

.github/workflows/build.yml

Lines changed: 27 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,12 @@ jobs:
5454
submodules: recursive
5555

5656
- name: Configure build
57-
working-directory: ${{ env.GITHUB_WORKSPACE }}
5857
run: |
5958
pip install requests
6059
6160
cmake . --preset ${{ matrix.preset }} -G Ninja
6261
6362
- name: Build
64-
working-directory: ${{ env.GITHUB_WORKSPACE }}
6563
run: cmake --build out/build/${{ matrix.preset }} --target install
6664

6765
- name: Prepare Release Zip (dev ci)
@@ -82,87 +80,50 @@ jobs:
8280
path: "*.zip"
8381

8482
build-ubuntu:
85-
# Require at least 24 for the mingw build
86-
runs-on: ubuntu-24.04
83+
runs-on: ubuntu-latest
8784

8885
strategy:
8986
fail-fast: false
9087
matrix:
91-
preset:
92-
- clang-cross-release
93-
- llvm-mingw-release
94-
- mingw-release
88+
toolchain:
89+
- preset: clang-cross-release
90+
container: clang-cross
91+
- preset: llvm-mingw-release
92+
container: llvm-mingw
93+
- preset: mingw-release
94+
container: mingw
9595

9696
steps:
97-
- name: Setup CMake and Ninja
98-
uses: lukka/get-cmake@latest
99-
100-
- name: Setup apt packages
101-
uses: awalsh128/cache-apt-pkgs-action@latest
102-
with:
103-
packages: msitools python3-requests
104-
version: ${{ runner.os }}-apt
105-
106-
- name: Setup LLVM MinGW
107-
if: startswith(matrix.preset, 'llvm-mingw')
108-
run: |
109-
wget -nv ${{ env.LLVM_MINGW_DOWNLOAD }}
110-
tar -xf ${{ env.LLVM_MINGW_VERSION }}.tar.xz -C ~/
111-
echo $(readlink -f ~/${{ env.LLVM_MINGW_VERSION }}/bin) >> $GITHUB_PATH
112-
113-
- name: Setup MinGW
114-
if: startswith(matrix.preset, 'mingw')
115-
uses: egor-tensin/setup-mingw@v2
116-
with:
117-
platform: ${{ fromJSON('["x86", "x64"]')[contains(matrix.preset, 'x64')] }}
118-
119-
- name: Setup Clang
120-
if: startswith(matrix.preset, 'clang-cross')
121-
uses: egor-tensin/setup-clang@v1
122-
123-
- name: Restore win sdk cache
124-
if: startswith(matrix.preset, 'clang-cross')
125-
uses: actions/cache@v4
126-
id: cache-win-sdk
127-
with:
128-
path: ~/win-sdk
129-
key: ${{ runner.os }}-win-sdk
130-
131-
- name: Setup win sdk
132-
if: startswith(matrix.preset, 'clang-cross') && steps.cache-win-sdk.outputs.cache-hit != 'true'
133-
run: |
134-
git clone https://github.com/mstorsjo/msvc-wine.git
135-
msvc-wine/vsdownload.py --accept-license --dest ~/win-sdk Microsoft.VisualStudio.Workload.VCTools
136-
msvc-wine/install.sh ~/win-sdk
137-
rm -r msvc-wine
138-
13997
- name: Checkout repository and submodules
14098
uses: actions/checkout@v4
14199
with:
142100
submodules: recursive
143101

144-
- name: Configure CMake
145-
working-directory: ${{ env.GITHUB_WORKSPACE }}
146-
# The extra msvc wine arg won't do anything if we're not cross compiling
147-
run: >
148-
cmake .
149-
--preset ${{ matrix.preset }}
150-
-G Ninja
151-
-DMSVC_WINE_ENV_SCRIPT=$(readlink -f ~)/win-sdk/bin/${{ fromJSON('["x86", "x64"]')[contains(matrix.preset, 'x64')] }}/msvcenv.sh
152-
153102
- name: Build
154-
working-directory: ${{ env.GITHUB_WORKSPACE }}
155-
run: cmake --build out/build/${{ matrix.preset }} --target install
156-
157-
- name: Prepare Release Zip (dev ci)
158-
if: inputs.new-release-tag == ''
159-
run: python prepare_release.py ${{ matrix.preset }} --skip-install
103+
uses: devcontainers/[email protected]
104+
with:
105+
cacheFrom: ghcr.io/bl-sdk/${{ matrix.toolchain.container }}:latest
106+
configFile: .devcontainer/${{ matrix.toolchain.container }}/devcontainer.json
107+
push: never
108+
# The git watcher cmake thinks something's unsafe? Doesn't happen to me locally.
109+
# Only run the prepare release script if doing a dev ci build
110+
runCmd: |
111+
git config --global --add safe.directory `pwd`
112+
git config --global --add safe.directory `pwd`/libs/pluginloader
113+
git config --global --add safe.directory `pwd`/libs/pyunrealsdk
114+
git config --global --add safe.directory `pwd`/libs/pyunrealsdk/libs/unrealsdk
115+
116+
cmake . --preset ${{ matrix.toolchain.preset }} -G Ninja
117+
cmake --build out/build/${{ matrix.toolchain.preset }} --target install
118+
119+
[ ${{ inputs.new-release-tag == '' && 1 || 0 }} -ne 0 ] && \
120+
python prepare_release.py ${{ matrix.toolchain.preset }} --skip-install
160121
161122
- name: Upload Artifact
162123
if: inputs.new-release-tag == ''
163124
uses: actions/upload-artifact@v4
164125
with:
165-
name: ${{ matrix.preset }}
126+
name: ${{ matrix.toolchain.preset }}
166127
path: "*.zip"
167128

168129
# ==============================================================================
@@ -200,7 +161,6 @@ jobs:
200161
submodules: recursive
201162

202163
- name: Configure CMake
203-
working-directory: ${{ env.GITHUB_WORKSPACE }}
204164
run: cmake . --preset ${{ matrix.preset }} -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On
205165

206166
- name: Remove `.modmap`s from compile commands
@@ -211,7 +171,6 @@ jobs:
211171
-Path "out\build\${{ matrix.preset }}\compile_commands.json"
212172
213173
- name: Run clang-tidy
214-
working-directory: ${{ env.GITHUB_WORKSPACE }}
215174
run: |
216175
python (Get-Command run-clang-tidy).Source `
217176
-p "out\build\${{ matrix.preset }}" `
@@ -228,7 +187,6 @@ jobs:
228187

229188
steps:
230189
- name: Setup Clang
231-
if: startswith(matrix.preset, 'clang')
232190
uses: egor-tensin/setup-clang@v1
233191

234192
- name: Checkout repository

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.vs
22
.vscode
3+
.idea
34

45
# C/C++ excludes
56
.cache/clangd

CMakePresets.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
"lhs": "${hostSystemName}",
3131
"rhs": "Windows"
3232
},
33+
"environment": {
34+
"MSVC_WINE_ENV_SCRIPT": "/win-sdk/bin/x86/msvcenv.sh"
35+
},
3336
"toolchainFile": "libs/pyunrealsdk/common_cmake/clang-cross-x86.cmake"
3437
},
3538
{

0 commit comments

Comments
 (0)