forked from Serial-Studio/Serial-Studio
-
Notifications
You must be signed in to change notification settings - Fork 0
336 lines (291 loc) · 10.2 KB
/
deploy.yml
File metadata and controls
336 lines (291 loc) · 10.2 KB
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
#--------------------------------------------------------------------------------
# Workflow configuration
#--------------------------------------------------------------------------------
name: Deploy
on:
push: # Run on push
paths-ignore: # File patterns to ignore
- '**.md' # Ignore changes to *.md files
pull_request: # Run on pull-request
paths-ignore: # File-patterns to ignore
- '**.md' # Ignore changes to *.md files
#--------------------------------------------------------------------------------
# Define application name & version
#--------------------------------------------------------------------------------
env:
VERSION: "1.2.0"
EXECUTABLE: "SerialStudio"
APPLICATION: "Serial Studio"
UNIXNAME: "serial-studio"
QMAKE_PROJECT: "Serial-Studio.pro"
QML_DIR_NIX: "assets/qml"
QML_DIR_WIN: "assets\\qml"
PUBLISHER: "Alex Spataru"
REPO_DIR: "/home/runner/work/Serial-Studio"
QT_VERSION: 6.3.0
QMAKE: qmake6
CORES: 16
#--------------------------------------------------------------------------------
# Workflow jobs (GNU/Linux, macOS & Windows)
#--------------------------------------------------------------------------------
jobs:
#
# GNU/Linux build
#
build-linux:
runs-on: ubuntu-20.04
name: '🐧 Ubuntu 20.04'
steps:
- name: '🧰 Checkout'
uses: actions/checkout@v2
with:
submodules: recursive
- name: '⚙️ Cache Qt'
id: cache-qt
uses: actions/cache@v1
with:
path: ../Qt
key: ${{runner.os}}-qtcachedir-${{env.QT_VERSION}}
- name: '⚙️ Install Qt'
uses: jurplel/install-qt-action@v2
with:
version: ${{env.QT_VERSION}}
modules: qtserialport qt5compat qtconnectivity
aqtversion: '==2.0.0'
cached: ${{steps.cache-qt.outputs.cache-hit}}
- name: '⚙️ Install dependencies'
run: |
sudo apt-get update
sudo apt-get install libgl1-mesa-dev libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libzstd-dev
- name: '🚧 Compile application'
run: |
${{env.QMAKE}} ${{env.QMAKE_PROJECT}} CONFIG+=release PREFIX=/usr
make -j${{env.CORES}}
- name: '⚙️ Install linuxdeploy'
run: |
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-plugin-qt-x86_64.AppImage
- name: '📦 Create AppImage'
run: |
export QML_SOURCES_PATHS="${{env.QML_DIR_NIX}}"
export QMAKE=${{env.REPO_DIR}}/Qt/${{env.QT_VERSION}}/gcc_64/bin/${{env.QMAKE}}
export PATH=${{env.REPO_DIR}}/Qt/${{env.QT_VERSION}}/gcc_64/libexec:$PATH
./linuxdeploy-x86_64.AppImage --appdir AppDir -e ${{env.UNIXNAME}} -i deploy/linux/${{env.UNIXNAME}}.png -d deploy/linux/${{env.UNIXNAME}}.desktop --plugin qt --output appimage
rm linuxdeploy-x86_64.AppImage
rm linuxdeploy-plugin-qt-x86_64.AppImage
mv *.AppImage ${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage
- name: '📤 Upload artifact: AppImage'
uses: actions/upload-artifact@v2
with:
name: ${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage
path: ${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage
#
# macOS build
#
build-mac:
runs-on: macos-12
name: '🍎 macOS Monterey'
steps:
- name: '🧰 Checkout'
uses: actions/checkout@v2
with:
submodules: recursive
- name: '⚙️ Cache Qt'
id: cache-qt
uses: actions/cache@v1
with:
path: ../Qt
key: ${{runner.os}}-qtcachedir-${{env.QT_VERSION}}
- name: '⚙️ Install Qt'
uses: jurplel/install-qt-action@v2
with:
version: ${{env.QT_VERSION}}
modules: qtserialport qt5compat qtconnectivity
aqtversion: '==2.0.0'
cached: ${{steps.cache-qt.outputs.cache-hit}}
- name: '🚧 Compile application'
run: |
${{env.QMAKE}} ${{env.QMAKE_PROJECT}} CONFIG+=release PREFIX=/usr
make -j${{env.CORES}}
- name: '📦 Package application (macdeployqt and zipfile)'
run: |
macdeployqt ${{env.EXECUTABLE}}.app -qmldir="${{env.QML_DIR_NIX}}"
mv "${{env.EXECUTABLE}}.app" "${{env.APPLICATION}}.app"
ditto -c -k --sequesterRsrc --keepParent "${{env.APPLICATION}}.app" ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.zip
- name: '📤 Upload artifact: ZIP'
uses: actions/upload-artifact@v2
with:
name: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.zip
path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.zip
#
# Windows build
#
build-windows:
runs-on: windows-2022
name: '🧊 Windows Server 2022'
steps:
- name: '🧰 Checkout'
uses: actions/checkout@v2
with:
submodules: recursive
- name: '⚙️ Configure MSVC'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
spectre: true
- name: '⚙️ Cache Qt'
id: cache-qt
uses: actions/cache@v1
with:
path: ../Qt
key: ${{runner.os}}-qtcachedir-${{env.QT_VERSION}}
- name: '⚙️ Install Qt'
uses: jurplel/install-qt-action@v2
with:
version: ${{env.QT_VERSION}}
modules: qtserialport qt5compat qtconnectivity
aqtversion: '==2.0.0'
cached: ${{steps.cache-qt.outputs.cache-hit}}
- name: '🚧 Compile application'
run: |
${{env.QMAKE}} ${{env.QMAKE_PROJECT}} CONFIG+=release PREFIX=/usr
nmake
- name: '📦 Package application (windeployqt)'
run: |
mkdir bin
move release/${{env.EXECUTABLE}}.exe bin
windeployqt bin/${{env.EXECUTABLE}}.exe -qmldir="${{env.QML_DIR_WIN}}" --compiler-runtime
mkdir "${{env.APPLICATION}}"
move bin "${{env.APPLICATION}}"
xcopy deploy\windows\resources\icon.ico "${{env.APPLICATION}}"
xcopy deploy\windows\openssl\*.dll "${{env.APPLICATION}}\bin"
move "${{env.APPLICATION}}" deploy\windows\nsis\
- name: '📦 Make NSIS installer'
uses: joncloud/makensis-action@v3.6
with:
script-file: deploy/windows/nsis/setup.nsi
- name: '📦 Check NSIS version & hash'
run: |
makensis /HDRINFO
- name: '📦 Rename installer'
run: |
dir
cd deploy/windows/nsis/
dir
ren *.exe ${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe
- name: '📤 Upload artifact: NSIS installer'
uses: actions/upload-artifact@v2
with:
name: ${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe
path: deploy/windows/nsis/${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe
#
# Windows MSYS2 build
#
msys2-makepkg:
if: ${{false}}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- { icon: '🟪', msystem: MINGW64, arch: x86_64 }
- { icon: '🟦', msystem: MINGW32, arch: i686 }
name: ${{ matrix.icon }} ${{ matrix.msystem }} | ${{ matrix.arch }} | makepkg
defaults:
run:
shell: msys2 {0}
steps:
- run: git config --global core.autocrlf input
shell: bash
- name: '🧰 Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: '${{ matrix.icon }} Setup MSYS2'
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: true
install: >
base-devel
mingw-w64-${{ matrix.arch }}-toolchain
- name: '🚧 Build'
run: |
cd msys2
tries=0
# Try building three times due to the arbitrary 'Bad address' error
while [ $tries -lt 3 ]; do
makepkg-mingw --noconfirm --noprogressbar -sCLf && break || tries=$((tries+1))
done
env:
MINGW_INSTALLS: ${{ matrix.msystem }}
- name: '📤 Upload artifact: MSYS2 ${{ matrix.arch }} package'
uses: actions/upload-artifact@v2
with:
name: msys2-pkgs
path: msys2/*.zst
# Test Windows MSYS2 packages
msys2-test:
if: ${{false}}
needs: msys2-makepkg
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- { icon: '🟪', msystem: MINGW64, arch: x86_64 }
- { icon: '🟦', msystem: MINGW32, arch: i686 }
name: ${{ matrix.icon }} ${{ matrix.msystem }} | ${{ matrix.arch }} | Test
defaults:
run:
shell: msys2 {0}
steps:
- name: '${{ matrix.icon }} Setup MSYS2'
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: true
install: >
tree
tar
zstd
- name: '📥 Download artifacts: MSYS2 packages'
uses: actions/download-artifact@v2
with:
name: msys2-pkgs
- name: 'Install MSYS2 package'
run: |
pacman -U --noconfirm --noprogressbar *${{ matrix.arch }}*.zst
- name: 'List contents of package'
run: |
mkdir tmp
cd tmp
/usr/bin/tar xf ../*${{ matrix.arch }}*.zst
tree ${{ matrix.msystem }}
#
# Upload continuous build
#
upload:
name: '🗂 Create release and upload artifacts'
needs:
- build-linux
- build-mac
- build-windows
runs-on: ubuntu-latest
steps:
- name: '📥 Download artifacts'
uses: actions/download-artifact@v2
- name: '🗂 Inspect directory after downloading artifacts'
run: ls -alFR
- name: '🚀 Create release and upload artifacts'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage
chmod +x pyuploadtool-x86_64.AppImage
./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage
./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.zip
./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe