forked from Chatterino/chatterino2
-
Notifications
You must be signed in to change notification settings - Fork 11
473 lines (422 loc) · 15.6 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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
---
name: Build
on:
push:
branches:
- dankerino
- "bugfix-release/*"
- "release/*"
pull_request:
workflow_dispatch:
merge_group:
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
env:
C2_ENABLE_LTO: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/bugfix-release/') || startsWith(github.ref, 'refs/heads/release/') }}
CHATTERINO_REQUIRE_CLEAN_GIT: On
C2_BUILD_WITH_QT6: Off
# Last known good conan version
# 2.0.3 has a bug on Windows (conan-io/conan#13606)
CONAN_VERSION: 2.0.2
jobs:
build-ubuntu-docker:
name: "Build Ubuntu in Docker"
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
matrix:
include:
- os: ubuntu-20.04
container: ghcr.io/chatterino/chatterino2-build-ubuntu-20.04:latest
qt-version: 6.6.1
force-lto: false
plugins: true
skip-artifact: false
skip-crashpad: false
build-appimage: false
build-deb: true
- os: ubuntu-22.04
container: ghcr.io/chatterino/chatterino2-build-ubuntu-22.04:latest
qt-version: 6.6.1
force-lto: false
plugins: true
skip-artifact: false
skip-crashpad: false
build-appimage: true
build-deb: true
env:
C2_ENABLE_LTO: ${{ matrix.force-lto }}
C2_PLUGINS: ${{ matrix.plugins }}
C2_ENABLE_CRASHPAD: ${{ matrix.skip-crashpad == false }}
C2_BUILD_WITH_QT6: ${{ startsWith(matrix.qt-version, '6.') }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # allows for tags access
- name: Build
run: |
mkdir build
cd build
CXXFLAGS=-fno-sized-deallocation cmake \
-DCMAKE_INSTALL_PREFIX=appdir/usr/ \
-DCMAKE_BUILD_TYPE=Release \
-DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On \
-DUSE_PRECOMPILED_HEADERS=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \
-DCHATTERINO_LTO="$C2_ENABLE_LTO" \
-DCHATTERINO_PLUGINS="$C2_PLUGINS" \
-DCMAKE_PREFIX_PATH="$Qt6_DIR/lib/cmake" \
-DBUILD_WITH_QT6="$C2_BUILD_WITH_QT6" \
-DCHATTERINO_STATIC_QT_BUILD=On \
..
make -j"$(nproc)"
- name: Package - AppImage (Ubuntu)
if: matrix.build-appimage
run: |
cd build
sh ./../.CI/CreateAppImage.sh
- name: Upload artifact - AppImage (Ubuntu)
if: matrix.build-appimage
uses: actions/upload-artifact@v4
with:
name: Chatterino-x86_64-Qt-${{ matrix.qt-version }}.AppImage
path: build/Chatterino-x86_64.AppImage
- name: Package - .deb (Ubuntu)
if: matrix.build-deb
run: |
cd build
sh ./../.CI/CreateUbuntuDeb.sh
- name: Upload artifact - .deb (Ubuntu)
if: matrix.build-deb
uses: actions/upload-artifact@v4
with:
name: Chatterino-${{ matrix.os }}-Qt-${{ matrix.qt-version }}.deb
path: build/Chatterino-${{ matrix.os }}-x86_64.deb
build:
name: "Build ${{ matrix.os }}, Qt ${{ matrix.qt-version }} (LTO:${{ matrix.force-lto }}, crashpad:${{ matrix.skip-crashpad && 'off' || 'on' }})"
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Ubuntu 22.04, Qt 5.15
- os: ubuntu-22.04
qt-version: 5.15.2
force-lto: false
plugins: true
skip-artifact: false
skip-crashpad: false
# Ubuntu 22.04, Qt 6.2.4 - tests LTO
- os: ubuntu-22.04
qt-version: 6.2.4
force-lto: true
plugins: true
skip-artifact: false
skip-crashpad: false
# macOS
- os: macos-latest
qt-version: 5.15.2
force-lto: false
plugins: true
skip-artifact: false
skip-crashpad: false
# Windows
- os: windows-latest
qt-version: 6.5.0
force-lto: false
plugins: true
skip-artifact: false
skip-crashpad: false
# Windows 7/8
- os: windows-latest
qt-version: 5.15.2
force-lto: false
plugins: true
skip-artifact: false
skip-crashpad: true
fail-fast: false
env:
C2_ENABLE_LTO: ${{ matrix.force-lto }}
C2_PLUGINS: ${{ matrix.plugins }}
C2_ENABLE_CRASHPAD: ${{ matrix.skip-crashpad == false }}
C2_BUILD_WITH_QT6: ${{ startsWith(matrix.qt-version, '6.') }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # allows for tags access
- name: Fetch upstream commit
run: |
git remote add upstream https://github.com/chatterino/Chatterino2
git fetch upstream master
echo "☑ Fetched upstream"
OLD_BRANCH=$(git branch --show-current)
OLD_COMMIT=$(git rev-parse HEAD)
echo "Old branch was \"$OLD_BRANCH\"; old commit was \"$OLD_COMMIT\""
git checkout -b master --track upstream/master
echo "☑ Checked out upstream"
git pull
echo "☑ Pulled upstream"
git checkout "$OLD_BRANCH" || git checkout "$OLD_COMMIT"
echo "☑ Checked out old position"
shell: bash
- name: Install Qt5
if: startsWith(matrix.qt-version, '5.')
uses: jurplel/[email protected]
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
version: ${{ matrix.qt-version }}
- name: Install Qt 6.5.3 imageformats
if: startsWith(matrix.qt-version, '6.')
uses: jurplel/[email protected]
with:
cache: false
modules: qtimageformats
set-env: false
version: 6.5.3
extra: --noarchives
- name: Find Qt 6.5.3 Path
if: startsWith(matrix.qt-version, '6.') && startsWith(matrix.os, 'windows')
shell: pwsh
id: find-good-imageformats
run: |
cd "$Env:RUNNER_WORKSPACE/Qt/6.5.3"
cd (Get-ChildItem)[0].Name
cd plugins/imageformats
echo "PLUGIN_PATH=$(pwd)" | Out-File -Path "$Env:GITHUB_OUTPUT" -Encoding ASCII
- name: Install Qt6
if: startsWith(matrix.qt-version, '6.')
uses: jurplel/[email protected]
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
modules: qt5compat qtimageformats
version: ${{ matrix.qt-version }}
# WINDOWS
- name: Enable Developer Command Prompt (Windows)
if: startsWith(matrix.os, 'windows')
uses: ilammy/[email protected]
- name: Setup conan variables (Windows)
if: startsWith(matrix.os, 'windows')
run: |
"C2_USE_OPENSSL3=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "True" } else { "False" })" >> "$Env:GITHUB_ENV"
"C2_CONAN_CACHE_SUFFIX=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "-QT6" } else { "`" })" >> "$Env:GITHUB_ENV"
shell: powershell
- name: Setup sccache (Windows)
# sccache v0.7.4
uses: hendrikmuhs/[email protected]
if: startsWith(matrix.os, 'windows')
with:
variant: sccache
# only save on on the default (master) branch
save: ${{ github.event_name == 'push' }}
key: sccache-build-${{ matrix.os }}-${{ matrix.qt-version }}-${{ matrix.skip-crashpad }}
restore-keys: |
sccache-build-${{ matrix.os }}-${{ matrix.qt-version }}
- name: Cache conan packages (Windows)
if: startsWith(matrix.os, 'windows')
uses: actions/cache@v4
with:
key: ${{ runner.os }}-conan-user-${{ hashFiles('**/conanfile.py') }}${{ env.C2_CONAN_CACHE_SUFFIX }}
path: ~/.conan2/
- name: Install Conan (Windows)
if: startsWith(matrix.os, 'windows')
run: |
python3 -c "import site; import sys; print(f'{site.USER_BASE}\\Python{sys.version_info.major}{sys.version_info.minor}\\Scripts')" >> "$GITHUB_PATH"
pip3 install --user "conan==${{ env.CONAN_VERSION }}"
shell: powershell
- name: Setup Conan (Windows)
if: startsWith(matrix.os, 'windows')
run: |
conan --version
conan profile detect -f
shell: powershell
- name: Install dependencies (Windows)
if: startsWith(matrix.os, 'windows')
run: |
mkdir build
cd build
conan install .. `
-s build_type=RelWithDebInfo `
-c tools.cmake.cmaketoolchain:generator="NMake Makefiles" `
-b missing `
--output-folder=. `
-o with_openssl3="$Env:C2_USE_OPENSSL3"
shell: powershell
- name: Build (Windows)
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
cd build
cmake `
-G"NMake Makefiles" `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" `
-DUSE_PRECOMPILED_HEADERS=ON `
-DBUILD_WITH_CRASHPAD="$Env:C2_ENABLE_CRASHPAD" `
-DCHATTERINO_LTO="$Env:C2_ENABLE_LTO" `
-DCHATTERINO_PLUGINS="$Env:C2_PLUGINS" `
-DBUILD_WITH_QT6="$Env:C2_BUILD_WITH_QT6" `
..
set cl=/MP
nmake /S /NOLOGO
- name: Build crashpad (Windows)
if: startsWith(matrix.os, 'windows') && !matrix.skip-crashpad
shell: pwsh
run: |
cd build
set cl=/MP
nmake /S /NOLOGO chatterino-crash-handler
mkdir Chatterino2/crashpad
cp bin/crashpad/crashpad-handler.exe Chatterino2/crashpad/crashpad-handler.exe
7z a bin/chatterino-Qt-${{ matrix.qt-version }}.pdb.7z bin/chatterino.pdb
- name: Prepare build dir (windows)
if: startsWith(matrix.os, 'windows')
run: |
cd build
windeployqt bin/chatterino.exe --release --no-compiler-runtime --no-translations --no-opengl-sw --dir Chatterino2/
cp bin/chatterino.exe Chatterino2/
echo nightly > Chatterino2/modes
- name: Fix Qt6 (windows)
if: startsWith(matrix.qt-version, '6.') && startsWith(matrix.os, 'windows')
working-directory: build
run: |
cp ${{ steps.find-good-imageformats.outputs.PLUGIN_PATH }}/qwebp.dll Chatterino2/imageformats/qwebp.dll
- name: Package (windows)
if: startsWith(matrix.os, 'windows')
working-directory: build
run: |
7z a chatterino-windows-x86-64-Qt-${{ matrix.qt-version }}.zip Chatterino2/
- name: Upload artifact (Windows - binary)
if: startsWith(matrix.os, 'windows') && !matrix.skip-artifact
uses: actions/upload-artifact@v4
with:
name: chatterino-windows-x86-64-Qt-${{ matrix.qt-version }}.zip
path: build/chatterino-windows-x86-64-Qt-${{ matrix.qt-version }}.zip
- name: Upload artifact (Windows - symbols)
if: startsWith(matrix.os, 'windows') && !matrix.skip-artifact
uses: actions/upload-artifact@v4
with:
name: chatterino-windows-x86-64-Qt-${{ matrix.qt-version }}-symbols.pdb.7z
path: build/bin/chatterino-Qt-${{ matrix.qt-version }}.pdb.7z
- name: Clean Conan cache
if: startsWith(matrix.os, 'windows')
run: conan cache clean --source --build --download "*"
shell: bash
# MACOS
- name: Install dependencies (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
brew install boost openssl rapidjson p7zip create-dmg cmake tree
shell: bash
- name: Build (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \
-DUSE_PRECOMPILED_HEADERS=OFF \
-DCHATTERINO_LTO="$C2_ENABLE_LTO" \
-DCHATTERINO_PLUGINS="$C2_PLUGINS" \
-DBUILD_WITH_QT6="$C2_BUILD_WITH_QT6" \
..
make -j"$(sysctl -n hw.logicalcpu)"
shell: bash
- name: Package (MacOS)
if: startsWith(matrix.os, 'macos')
env:
OUTPUT_DMG_PATH: chatterino-macos-Qt-${{ matrix.qt-version}}.dmg
run: |
ls -la
pwd
ls -la build || true
cd build
./../.CI/MacDeploy.sh
./../.CI/CreateDMG.sh
shell: bash
- name: Upload artifact (MacOS)
if: startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v4
with:
name: chatterino-macos-Qt-${{ matrix.qt-version }}.dmg
path: build/chatterino-macos-Qt-${{ matrix.qt-version }}.dmg
create-release:
needs: [build-ubuntu-docker, build]
runs-on: ubuntu-latest
if: (github.event_name == 'push' && github.ref == 'refs/heads/dankerino')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # allows for tags access
# Windows
- uses: actions/download-artifact@v4
name: Windows Qt6.5.0
with:
name: chatterino-windows-x86-64-Qt-6.5.0.zip
path: release-artifacts/
- uses: actions/download-artifact@v4
name: Windows Qt6.5.0 symbols
with:
name: chatterino-windows-x86-64-Qt-6.5.0-symbols.pdb.7z
path: release-artifacts/
- uses: actions/download-artifact@v4
name: Windows Qt5.15.2
with:
name: chatterino-windows-x86-64-Qt-5.15.2.zip
path: release-artifacts/
# Linux
- uses: actions/download-artifact@v4
name: Linux AppImage
with:
name: Chatterino-x86_64-Qt-6.6.1.AppImage
path: release-artifacts/
- uses: actions/download-artifact@v4
name: Ubuntu 20.04 deb
with:
name: Chatterino-ubuntu-20.04-Qt-6.6.1.deb
path: release-artifacts/
- uses: actions/download-artifact@v4
name: Ubuntu 22.04 deb
with:
name: Chatterino-ubuntu-22.04-Qt-6.6.1.deb
path: release-artifacts/
- name: Copy flatpakref
run: |
cp .CI/chatterino-nightly.flatpakref release-artifacts/
shell: bash
# macOS
- uses: actions/download-artifact@v4
name: macOS x86_64 Qt5.15.2 dmg
with:
name: chatterino-macos-Qt-5.15.2.dmg
path: release-artifacts/
- name: Rename artifacts
run: |
ls -l
# Rename the macos build to indicate that it's for macOS 10.15 users
mv chatterino-macos-Qt-5.15.2.dmg Chatterino-macOS-10.15.dmg
# Mark all Windows Qt5 builds as old
mv chatterino-windows-x86-64-Qt-5.15.2.zip chatterino-windows-old-x86-64-Qt-5.15.2.zip
working-directory: release-artifacts
shell: bash
- name: Create release
uses: ncipollo/[email protected]
with:
replacesArtifacts: true
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "release-artifacts/*"
body: ${{ github.event.head_commit.message }}
prerelease: true
name: Nightly Release
tag: nightly-build
- name: Update nightly-build tag
run: |
git tag -f nightly-build
git push -f origin nightly-build
shell: bash