forked from alex-spataru/QtApp-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
261 lines (233 loc) · 7.23 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
#--------------------------------------------------------------------------------
# Workflow configuration
#--------------------------------------------------------------------------------
name: Build
on:
push: # Run on push
pull_request: # Run on pull-request
#--------------------------------------------------------------------------------
# Define application name & version
#--------------------------------------------------------------------------------
env:
VERSION: "1.0.0"
EXECUTABLE: "QtApp"
APPLICATION: "Qt App"
QMAKE_PROJECT: "QtApp.pro"
QML_DIR_NIX: "assets/qml"
QML_DIR_WIN: "assets\\qml"
QT_DOWNLOAD_MIRROR: http://mirrors.ocf.berkeley.edu/qt/
#--------------------------------------------------------------------------------
# Workflow jobs (GNU/Linux, macOS & Windows)
#--------------------------------------------------------------------------------
jobs:
#
# GNU/Linux build (we run on Ubuntu 16.04 to generate AppImage)
#
build-linux:
runs-on: ubuntu-16.04
steps:
#
# Checkout the repository
#
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
#
# Cache Qt
#
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ../Qt
key: ${{runner.os}}-QtCache
#
# Install Qt
#
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
modules: qtcharts
mirror: ${{env.QT_DOWNLOAD_MIRROR}}
cached: ${{steps.cache-qt.outputs.cache-hit}}
#
# Install additional dependencies, stolen from:
# https://github.com/mapeditor/tiled/blob/master/.github/workflows/packages.yml
#
- 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
#
# Compile the application
#
- name: Compile
run: |
qmake ${{env.QMAKE_PROJECT}} CONFIG+=release PREFIX=/usr
make -j8
#
# Create the AppImage
#
- name: Create AppImage
run: |
make INSTALL_ROOT=appdir install
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" -O linuxdeployqt
chmod a+x linuxdeployqt
./linuxdeployqt appdir/usr/share/applications/*.desktop -appimage -qmldir="${{env.QML_DIR_NIX}}"
#
# Rename AppImage to match "%AppName%-%Version%-Linux.AppImage" format
#
- name: Rename AppImage
run: mv *.AppImage ${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage
#
# Upload AppImage to build artifacts
#
- name: Upload 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-latest
steps:
#
# Checkout the repository
#
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
#
# Cache Qt
#
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ../Qt
key: ${{runner.os}}-QtCache
#
# Install Qt
#
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
modules: qtcharts
mirror: ${{env.QT_DOWNLOAD_MIRROR}}
cached: ${{steps.cache-qt.outputs.cache-hit}}
#
# Compile application
#
- name: Compile
run: |
qmake ${{env.QMAKE_PROJECT}} CONFIG+=release
make -j8
#
# Deploy application
#
- name: Deploy app
run: |
macdeployqt ${{env.EXECUTABLE}}.app -qmldir="${{env.QML_DIR_NIX}}"
mv "${{env.EXECUTABLE}}.app" "${{env.APPLICATION}}.app"
#
# ZIP application "%AppName%-%Version%-macOS.zip"
# We use ditto instead of zip to use the same commands as Finder
#
- name: Create ZIP file
run: |
ditto -c -k --sequesterRsrc --keepParent "${{env.APPLICATION}}.app" ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.zip
#
# Upload ZIP to build artifacts
#
- name: Upload 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-latest
steps:
#
# Checkout the repository
#
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
#
# Configure MSVC
#
- name: Configure MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
spectre: true
#
# Cache Qt
#
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ../Qt
key: ${{runner.os}}-QtCache
#
# Install Qt
#
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
modules: qtcharts
mirror: ${{env.QT_DOWNLOAD_MIRROR}}
cached: ${{steps.cache-qt.outputs.cache-hit}}
#
# Install NSIS
#
- name: Install NSIS
run: |
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
scoop bucket add extras
scoop install nsis
#
# Compile application
#
- name: Compile
run: |
qmake ${{env.QMAKE_PROJECT}} CONFIG+=release
nmake
#
# Copy Qt & OpenSSL DLLs, compiler runtime & application icon
#
- name: Deploy
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"
#
# Create NSIS installer
#
- name: Make NSIS installer
run: |
move "${{env.APPLICATION}}" deploy\windows\nsis\
cd deploy\windows\nsis
makensis /X"SetCompressor /FINAL lzma" setup.nsi
ren *.exe ${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe
#
# Upload installer to build artifacts
#
- name: Upload 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