forked from Chatterino/chatterino2
-
Notifications
You must be signed in to change notification settings - Fork 0
317 lines (277 loc) · 9.82 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
---
name: Build
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
qt-version: [5.15.2, 5.12.12]
pch: [true]
include:
- os: ubuntu-latest
qt-version: 5.15.2
pch: false
fail-fast: false
steps:
- name: Set environment variables for windows-latest
if: matrix.os == 'windows-latest'
run: |
echo "vs_version=2022" >> $GITHUB_ENV
shell: bash
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # allows for tags access
- name: Cache Qt
id: cache-qt
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/qt/"
key: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
cached: ${{ steps.cache-qt.outputs.cache-hit }}
version: ${{ matrix.qt-version }}
dir: "${{ github.workspace }}/qt/"
# WINDOWS
- name: Cache conan packages part 1
if: startsWith(matrix.os, 'windows')
uses: actions/cache@v3
with:
key: ${{ runner.os }}-conan-user-${{ hashFiles('**/conanfile.txt') }}
path: ~/.conan/
- name: Cache conan packages part 2
if: startsWith(matrix.os, 'windows')
uses: actions/cache@v3
with:
key: ${{ runner.os }}-conan-root-${{ hashFiles('**/conanfile.txt') }}
path: C:/.conan/
- name: Add Conan to path
if: startsWith(matrix.os, 'windows')
run: echo "C:\Program Files\Conan\conan\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install dependencies (Windows)
if: startsWith(matrix.os, 'windows')
run: |
choco install conan -y
- name: Enable Developer Command Prompt
if: startsWith(matrix.os, 'windows')
uses: ilammy/[email protected]
- name: Build (Windows)
if: startsWith(matrix.os, 'windows')
run: |
mkdir build
cd build
conan install .. -b missing
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DUSE_CONAN=ON ..
set cl=/MP
nmake /S /NOLOGO
windeployqt bin/chatterino.exe --release --no-compiler-runtime --no-translations --no-opengl-sw --dir Chatterino2/
cp bin/chatterino.exe Chatterino2/
echo nightly > Chatterino2/modes
7z a chatterino-windows-x86-64.zip Chatterino2/
- name: Upload artifact (Windows)
if: startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v3
with:
name: chatterino-windows-x86-64-${{ matrix.qt-version }}.zip
path: build/chatterino-windows-x86-64.zip
- name: Clean Conan pkgs
if: startsWith(matrix.os, 'windows')
run: conan remove "*" -fsb
shell: bash
# LINUX
- name: Install dependencies (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get -y install \
cmake \
virtualenv \
rapidjson-dev \
libssl-dev \
libboost-dev \
libxcb-randr0-dev \
libboost-system-dev \
libboost-filesystem-dev \
libpulse-dev \
libxkbcommon-x11-0 \
libgstreamer-plugins-base1.0-0 \
build-essential \
libgl1-mesa-dev \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-xinerama0
- name: Build (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
mkdir build
cd build
cmake \
-DCMAKE_INSTALL_PREFIX=appdir/usr/ \
-DCMAKE_BUILD_TYPE=Release \
-DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On \
-DUSE_PRECOMPILED_HEADERS=${{ matrix.pch }} \
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \
..
make -j$(nproc)
shell: bash
- name: clang-tidy review
if: (startsWith(matrix.os, 'ubuntu') && matrix.pch == false && matrix.qt-version == '5.15.2' && github.event_name == 'pull_request')
uses: ZedThree/[email protected]
id: review
with:
build_dir: build
config_file: '.clang-tidy'
split_workflow: true
- uses: actions/upload-artifact@v3
if: (startsWith(matrix.os, 'ubuntu') && matrix.pch == false && matrix.qt-version == '5.15.2' && github.event_name == 'pull_request')
with:
name: clang-tidy-review
path: |
clang-tidy-review-output.json
clang-tidy-review-metadata.json
- name: Package - AppImage (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
cd build
sh ./../.CI/CreateAppImage.sh
shell: bash
- name: Package - .deb (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
cd build
sh ./../.CI/CreateUbuntuDeb.sh
shell: bash
- name: Upload artifact - AppImage (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
uses: actions/upload-artifact@v3
with:
name: Chatterino-x86_64-${{ matrix.qt-version }}.AppImage
path: build/Chatterino-x86_64.AppImage
- name: Upload artifact - .deb (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
uses: actions/upload-artifact@v3
with:
name: Chatterino-${{ matrix.qt-version }}.deb
path: build/Chatterino.deb
# 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=${{ matrix.pch }} \
..
make -j$(sysctl -n hw.logicalcpu)
shell: bash
- name: Package (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
ls -la
pwd
ls -la build || true
cd build
sh ./../.CI/CreateDMG.sh
shell: bash
- name: Upload artifact (MacOS)
if: startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v3
with:
name: chatterino-osx-${{ matrix.qt-version }}.dmg
path: build/chatterino-osx.dmg
create-release:
needs: build
runs-on: ubuntu-latest
if: (github.event_name == 'push' && github.ref == 'refs/heads/master')
steps:
- name: Create release
id: create_release
uses: pajlada/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly-build
backup_tag_name: backup-nightly-build
release_name: Nightly Release
body: |
Nightly Build
prerelease: true
- uses: actions/download-artifact@v3
with:
name: chatterino-windows-x86-64-5.15.2.zip
path: windows/
- uses: actions/download-artifact@v3
with:
name: Chatterino-x86_64-5.15.2.AppImage
path: linux/
- uses: actions/download-artifact@v3
with:
name: Chatterino-5.15.2.deb
path: ubuntu/
- uses: actions/download-artifact@v3
with:
name: chatterino-osx-5.15.2.dmg
path: macos/
# TODO: Extract dmg and appimage
# - name: Read upload URL into output
# id: upload_url
# run: |
# echo "::set-output name=upload_url::$(cat release-upload-url.txt/release-upload-url.txt)"
- name: Upload release asset (Windows)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./windows/chatterino-windows-x86-64.zip
asset_name: chatterino-windows-x86-64.zip
asset_content_type: application/zip
- name: Upload release asset (Ubuntu)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./linux/Chatterino-x86_64.AppImage
asset_name: Chatterino-x86_64.AppImage
asset_content_type: application/x-executable
- name: Upload release asset (Ubuntu .deb)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ubuntu/Chatterino.deb
asset_name: Chatterino-x86_64.deb
asset_content_type: application/vnd.debian.binary-package
- name: Upload release asset (MacOS)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./macos/chatterino-osx.dmg
asset_name: chatterino-osx.dmg
asset_content_type: application/x-bzip2