forked from LMMS/lmms
-
Notifications
You must be signed in to change notification settings - Fork 0
329 lines (329 loc) · 10.3 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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
---
name: build
'on': [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
linux:
name: linux
runs-on: ubuntu-latest
container: ghcr.io/lmms/linux.gcc:20.04
env:
CMAKE_OPTS: >-
-DUSE_WERROR=ON
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DUSE_COMPILE_CACHE=ON
CCACHE_MAXSIZE: 0
CCACHE_NOCOMPRESS: 1
MAKEFLAGS: -j2
steps:
- name: Configure git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Cache ccache data
uses: actions/cache@v3
with:
key: ccache-${{ github.job }}-${{ github.ref }}-${{ github.run_id }}
restore-keys: |
ccache-${{ github.job }}-${{ github.ref }}-
ccache-${{ github.job }}-
path: ~/.ccache
- name: Configure
run: |
ccache --zero-stats
source /opt/qt5*/bin/qt5*-env.sh || true
cmake -S . \
-B build \
-DCMAKE_INSTALL_PREFIX=./install \
$CMAKE_OPTS
- name: Build
run: cmake --build build
- name: Run tests
run: |
cd build/tests
ctest --output-on-failure -j2
- name: Package
run: |
cmake --build build --target install
cmake --build build --target appimage
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linux
path: build/lmms-*.AppImage
- name: Trim ccache and print statistics
run: |
ccache --cleanup
echo "[ccache config]"
ccache --show-config
echo "[ccache stats]"
ccache --show-stats
env:
CCACHE_MAXSIZE: 500M
macos:
strategy:
fail-fast: false
matrix:
arch: [ x86_64, arm64 ]
include:
- arch: x86_64
os: macos-12
xcode: "13.1"
- arch: arm64
os: macos-14
xcode: "14.3.1"
name: macos-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
env:
CMAKE_OPTS: >-
-Werror=dev
-DUSE_WERROR=ON
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DUSE_COMPILE_CACHE=ON
CCACHE_MAXSIZE: 0
CCACHE_NOCOMPRESS: 1
MAKEFLAGS: -j3
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Clean up Homebrew download cache
run: rm -rf ~/Library/Caches/Homebrew/downloads
- name: Restore Homebrew download cache
id: cache-homebrew
uses: actions/cache/restore@v3
with:
key: n/a - only restore from restore-keys
restore-keys: |
homebrew-${{ matrix.arch }}-
path: ~/Library/Caches/Homebrew/downloads
- name: Cache ccache data
uses: actions/cache@v3
with:
key: "ccache-${{ github.job }}-${{ matrix.arch }}-${{ github.ref }}\
-${{ github.run_id }}"
restore-keys: |
ccache-${{ github.job }}-${{ matrix.arch }}-${{ github.ref }}-
ccache-${{ github.job }}-${{ matrix.arch }}-
path: ~/Library/Caches/ccache
- name: Install dependencies
run: |
brew bundle install --verbose
npm update -g npm
npm install --location=global appdmg
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_UPGRADE: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
- name: Configure
run: |
ccache --zero-stats
mkdir build
cmake -S . \
-B build \
-DCMAKE_INSTALL_PREFIX="../target" \
-DCMAKE_PREFIX_PATH="$(brew --prefix qt@5)" \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
$CMAKE_OPTS \
-DUSE_WERROR=OFF
- name: Build
run: cmake --build build
- name: Run tests
run: |
cd build/tests
ctest --output-on-failure -j3
- name: Package
run: |
cmake --build build --target install
cmake --build build --target dmg
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: macos-${{ matrix.arch }}
path: build/lmms-*.dmg
- name: Trim ccache and print statistics
run: |
ccache --cleanup
echo "[ccache config]"
ccache --show-config
echo "[ccache stats]"
ccache --show-stats --verbose
env:
CCACHE_MAXSIZE: 500MB
- name: Save Homebrew download cache
if: ${{ steps.cache-homebrew.outputs.cache-matched-key != env.key }}
uses: actions/cache/save@v3
with:
key: ${{ env.key }}
path: ~/Library/Caches/Homebrew/downloads
env:
key: "homebrew-${{ matrix.arch }}\
-${{ hashFiles('Brewfile.lock.json') }}"
mingw:
strategy:
fail-fast: false
matrix:
arch: ['32', '64']
name: mingw${{ matrix.arch }}
runs-on: ubuntu-latest
container: ghcr.io/lmms/linux.mingw:20.04
env:
CMAKE_OPTS: >-
-Werror=dev
-DUSE_WERROR=ON
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DUSE_COMPILE_CACHE=ON
CCACHE_MAXSIZE: 0
CCACHE_NOCOMPRESS: 1
MAKEFLAGS: -j2
steps:
- name: Enable POSIX MinGW
run: |
update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix
update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
- name: Configure git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Cache ccache data
uses: actions/cache@v3
with:
key: "ccache-${{ github.job }}-${{ matrix.arch }}-${{ github.ref }}\
-${{ github.run_id }}"
restore-keys: |
ccache-${{ github.job }}-${{ matrix.arch }}-${{ github.ref }}-
ccache-${{ github.job }}-${{ matrix.arch }}-
path: ~/.ccache
- name: Configure
run: |
ccache --zero-stats
cmake -S . \
-B build \
-DCMAKE_INSTALL_PREFIX=./install \
-DCMAKE_TOOLCHAIN_FILE="./cmake/toolchains/MinGW-W64-${{ matrix.arch }}.cmake" \
$CMAKE_OPTS
- name: Build
run: cmake --build build
- name: Package
run: cmake --build build --target package
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: mingw${{ matrix.arch }}
path: build/lmms-*.exe
- name: Trim ccache and print statistics
run: |
ccache --cleanup
echo "[ccache config]"
ccache --show-config
echo "[ccache stats]"
ccache --show-stats
env:
CCACHE_MAXSIZE: 500M
msvc:
strategy:
fail-fast: false
matrix:
arch: ['x86', 'x64']
name: msvc-${{ matrix.arch }}
runs-on: windows-2019
env:
CCACHE_MAXSIZE: 0
CCACHE_NOCOMPRESS: 1
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Cache vcpkg dependencies
id: cache-deps
uses: actions/cache@v3
with:
key: vcpkg-${{ matrix.arch }}-${{ hashFiles('vcpkg.json') }}
restore-keys: |
vcpkg-${{ matrix.arch }}-
path: build\vcpkg_installed
- name: Cache ccache data
uses: actions/cache@v3
with:
key: "ccache-${{ github.job }}-${{ matrix.arch }}-${{ github.ref }}\
-${{ github.run_id }}"
restore-keys: |
ccache-${{ github.job }}-${{ matrix.arch }}-${{ github.ref }}-
ccache-${{ github.job }}-${{ matrix.arch }}-
path: ~\AppData\Local\ccache
- name: Install tools
run: choco install ccache
- name: Install Qt
uses: jurplel/install-qt-action@b3ea5275e37b734d027040e2c7fe7a10ea2ef946
with:
version: '5.15.2'
arch: |-
${{
fromJSON('
{
"x86": "win32_msvc2019",
"x64": "win64_msvc2019_64"
}
')[matrix.arch]
}}
archives: qtbase qtsvg qttools
cache: true
- name: Set up build environment
uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89
with:
arch: ${{ matrix.arch }}
- name: Configure
run: |
ccache --zero-stats
mkdir build -Force
cmake -S . `
-B build `
-G Ninja `
--toolchain C:/vcpkg/scripts/buildsystems/vcpkg.cmake `
-Werror=dev `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DUSE_COMPILE_CACHE=ON `
-DUSE_WERROR=ON `
-DVCPKG_TARGET_TRIPLET="${{ matrix.arch }}-windows" `
-DVCPKG_HOST_TRIPLET="${{ matrix.arch }}-windows" `
-DVCPKG_MANIFEST_INSTALL="${{ env.should_install_manifest }}"
env:
should_install_manifest:
${{ steps.cache-deps.outputs.cache-hit == 'true' && 'NO' || 'YES' }}
- name: Build
run: cmake --build build
- name: Run tests
run: |
cd build/tests
ctest --output-on-failure -j2
- name: Package
run: cmake --build build --target package
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: msvc-${{ matrix.arch }}
path: build\lmms-*.exe
- name: Trim ccache and print statistics
run: |
ccache --cleanup
echo "[ccache config]"
ccache --show-config
echo "[ccache stats]"
ccache --show-stats --verbose
env:
CCACHE_MAXSIZE: 500MB