-
Notifications
You must be signed in to change notification settings - Fork 205
291 lines (248 loc) · 8.94 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
name: Build
on:
push:
branches: master
paths:
- .github/workflows/build.yml
- _build/**
- far/**
- misc/build-checks/ChangelogChecker/**
- misc/build-checks/HlfChecker/**
- misc/lng/lng.generator.py
- plugins/**
pull_request:
branches: master
paths:
- .github/workflows/build.yml
- _build/**
- far/**
- misc/build-checks/ChangelogChecker/**
- misc/build-checks/HlfChecker/**
- misc/lng/lng.generator.py
- plugins/**
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
#------------------------------------------------------------------------------
code-style-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Run checks
working-directory: far
run: python tools/source_validator.py
#------------------------------------------------------------------------------
changelog-hlf-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0'
# For "--property UseSharedCompilation=false", see
# https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/troubleshooting-the-codeql-workflow#no-code-found-during-the-build
- name: Build and run ChangelogChecker
working-directory: misc/build-checks/ChangelogChecker
run: dotnet run --project ./ChangelogChecker.csproj --configuration Release --property UseSharedCompilation=false
- name: Build and run HlfChecker
working-directory: misc/build-checks/HlfChecker
run: dotnet run --project ./HlfChecker.csproj --configuration Release --property UseSharedCompilation=false -- Verbose
#------------------------------------------------------------------------------
build-msvc:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
builder: [msbuild, nmake]
compiler: [cl, clang]
platform: [x86, x64, ARM64]
build_type: [Release, Debug]
include:
- platform: x86
platform_sln: Win32
arch: amd64_x86
- platform: x64
platform_sln: x64
arch: amd64
- platform: ARM64
platform_sln: ARM64
arch: amd64_arm64
exclude:
- builder: msbuild
compiler: clang
- builder: nmake
platform: ARM64
- compiler: clang
platform: x86
- platform: ARM64
build_type: Debug
name: build-${{ matrix.builder }}_${{ matrix.compiler }}_${{ matrix.platform }}_${{ matrix.build_type }}
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Initialize CodeQL
if: matrix.platform == 'x64' && matrix.build_type == 'Debug' && matrix.compiler == 'cl'
uses: github/codeql-action/init@v3
with:
languages: cpp
- name: Set MSVC envrioment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Set environment for nmake
if: matrix.builder == 'nmake'
run: |
if ("${{ matrix.compiler }}" -eq "clang") { Add-Content -Path $env:GITHUB_ENV -Value "CLANG=1`nSHOW_VER_ARG=--version" }
if ("${{ matrix.build_type }}" -eq "Debug") { Add-Content -Path $env:GITHUB_ENV -Value "DEBUG=1" }
- name: Build all
if: matrix.builder == 'msbuild'
working-directory: _build/vc
run: |
cl
msbuild -m /property:Configuration=${{ matrix.build_type }} /property:Platform=${{ matrix.platform_sln }} all.sln
- name: Build Far
if: matrix.builder == 'nmake'
working-directory: far
run: |
${{ matrix.compiler }} ${{ env.SHOW_VER_ARG }}
nmake /f makefile_vc
- name: Build plugins
if: matrix.builder == 'nmake'
working-directory: plugins
run: |
${{ matrix.compiler }} ${{ env.SHOW_VER_ARG }}
nmake /f makefile_all_vc
- name: Perform CodeQL Analysis
if: matrix.platform == 'x64' && matrix.build_type == 'Debug' && matrix.compiler == 'cl'
uses: github/codeql-action/analyze@v3
- name: Publish
if: matrix.builder == 'msbuild'
uses: actions/upload-artifact@v4
with:
name: Far.${{ matrix.build_type }}.${{ matrix.platform }}.${{ github.sha }}
path: _build/vc/_output/product/${{ matrix.build_type }}.${{ matrix.platform_sln }}
compression-level: 9
#------------------------------------------------------------------------------
build-msys2:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
sys: [mingw32, mingw64, ucrt64, clang64]
compiler: [gcc, clang]
build_type: [Release, Debug]
exclude:
- sys: clang64
compiler: gcc
name: build-msys2_${{ matrix.sys }}_${{ matrix.compiler }}_${{ matrix.build_type }}
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Initialize CodeQL
if: matrix.sys == 'ucrt64' && matrix.compiler == 'gcc' && matrix.build_type == 'Debug'
uses: github/codeql-action/init@v3
with:
languages: cpp
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
update: true
msystem: ${{ matrix.sys }}
install: unzip
pacboy: toolchain:p
- name: Setup clang build
if: matrix.compiler == 'clang'
run: |
echo "CLANG=1" >> "$GITHUB_ENV"
pacboy --noconfirm -S --needed clang:p lld:p
- name: Setup debug build
if: matrix.build_type == 'Debug'
run: |
echo "DEBUG=1" >> "$GITHUB_ENV"
echo "USE_LLD=1" >> "$GITHUB_ENV"
pacboy --noconfirm -S --needed lld:p
- name: Build Far
working-directory: far
run: |
${{ matrix.compiler }} --version
mingw32-make -j $(($(nproc)+1)) -f makefile_gcc
- name: Build plugins
working-directory: plugins
run: |
${{ matrix.compiler }} --version
mingw32-make -j $(($(nproc)+1)) -f makefile_all_gcc
- name: Perform CodeQL Analysis
if: matrix.sys == 'ucrt64' && matrix.compiler == 'gcc' && matrix.build_type == 'Debug'
uses: github/codeql-action/analyze@v3
#------------------------------------------------------------------------------
build-llvm-mingw:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
machine_target: [i686, x86_64, armv7, aarch64]
c_lib: [msvcrt, ucrt]
build_type: [Release, Debug]
exclude:
- machine_target: armv7
c_lib: msvcrt
- machine_target: aarch64
c_lib: msvcrt
name: build-llvm_${{ matrix.machine_target }}_${{ matrix.c_lib }}_${{ matrix.build_type }}
env:
GCC_PREFIX: ${{ matrix.machine_target }}-w64-mingw32-
CLANG: 1
PYTHON: 1
SYS_LUA: 1
LUA_VER: '5.1'
ENABLE_TESTS: 0
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Initialize CodeQL
if: matrix.machine_target == 'x86_64' && matrix.c_lib == 'ucrt' && matrix.build_type == 'Debug'
uses: github/codeql-action/init@v3
with:
languages: cpp
- name: Install lua ${{ env.LUA_VER }}
run: |
sudo apt-get update
sudo apt-get install lua${{ env.LUA_VER }}
- name: Download llvm-mingw
id: download_llvm_mingw
uses: robinraju/[email protected]
with:
repository: mstorsjo/llvm-mingw
latest: true
fileName: llvm-mingw-*-${{ matrix.c_lib }}-ubuntu-*-x86_64.tar.xz
- name: Install ${{ steps.download_llvm_mingw.outputs.release_name }}
run: |
LLVM_MINGW=${{ fromJson(steps.download_llvm_mingw.outputs.downloaded_files)[0] }}
tar -xf "$LLVM_MINGW"
rm -f "$LLVM_MINGW"
echo "${{ github.workspace }}/$(basename -s .tar.xz $LLVM_MINGW)/bin" >> $GITHUB_PATH
- name: Set environment for debug build
if: matrix.build_type == 'Debug'
run: |
echo "DEBUG=1" >> "$GITHUB_ENV"
echo "USE_LLD=1" >> "$GITHUB_ENV"
- name: Build far
working-directory: far
run: |
${GCC_PREFIX}clang --version
make -j $(($(nproc)+1)) -f makefile_gcc
- name: Build plugins
working-directory: plugins
run: |
${GCC_PREFIX}clang --version
make -j $(($(nproc)+1)) -f makefile_all_gcc
- name: Perform CodeQL Analysis
if: matrix.machine_target == 'x86_64' && matrix.c_lib == 'ucrt' && matrix.build_type == 'Debug'
uses: github/codeql-action/analyze@v3