This repository has been archived by the owner on Jan 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
379 lines (335 loc) Β· 14 KB
/
build_desktop.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
# GitHub Action to build a YIO Remote Qt project for Linux, macOS and Windows.
#
# Based on https://www.qt.io/blog/building-qt-creator-plugins-with-github-actions
# Enhanced by Markus Zehnder
#
# TODO:
# - Create a re-usable GitHub Action
name: Build Desktop Libraries
on: [push, pull_request]
env:
# Attention: Qt version and Qt Creator version should correspond (check releases).
# Qt Creator is required for Qt linguist tools only. Hey Qt: why isn't there a simple and easy way to install lupdate & lreleaes on ALL platforms?
QT_VERSION: 5.12.6
QT_CREATOR_VERSION: 4.8.2
# Alternative non-LTS version:
# QT_VERSION: 5.14.0
# QT_CREATOR_VERSION: 4.11.0
APP_PRO: dock.pro
APP_NAME: libdock
PROJECT_NAME: integration.dock
PLUGIN_METAFILE: dock.json
# Build artifact output path. Used to set project specific YIO_BIN env var.
BIN_OUTPUT_PATH: "binaries"
DEBUG_OUTPUT: "false"
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {
name: "Linux Latest x64", artifact: "Linux-x64", build: "release",
qmake-args: "CONFIG+=release",
os: ubuntu-20.04
}
- {
name: "macOS Latest x64", artifact: "macOS-x64", build: "release",
qmake-args: "CONFIG+=release",
os: macos-latest
}
- {
name: "Windows Latest x64", artifact: "Windows-x64", build: "release",
qmake-args: "CONFIG+=release",
os: windows-latest,
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
}
steps:
- name: Checkout ${{ env.PROJECT_NAME }}
uses: actions/checkout@v2
with:
# history required to determine number of commits since last release tag
fetch-depth: 0
path: ${{ env.PROJECT_NAME }}
- name: Fetch all tags to determine version
run: |
cd ${{ env.PROJECT_NAME }}
git fetch origin +refs/tags/*:refs/tags/*
- name: Determine integrations.library version
shell: bash
run: |
YIO_INTG_LIB_VERSION=$(cat "${GITHUB_WORKSPACE}/${{ env.PROJECT_NAME }}/dependencies.cfg" | awk '/^integrations.library:/{print $2}')
echo "Required integrations.library: $YIO_INTG_LIB_VERSION"
echo "YIO_INTG_LIB_VERSION=$YIO_INTG_LIB_VERSION" >> $GITHUB_ENV
- name: Set build output directory
shell: bash
run: echo "YIO_BIN=${GITHUB_WORKSPACE}/${BIN_OUTPUT_PATH}" >> $GITHUB_ENV
- name: Checkout integrations.library
uses: actions/checkout@v2
with:
repository: YIO-Remote/integrations.library
ref: ${{ env.YIO_INTG_LIB_VERSION }}
path: integrations.library
- name: Install system libs
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install libavahi-client-dev libgl1-mesa-dev g++-8 libstdc++-8-dev
# Qt Creator library path is required for Qt linguist tools. Otherwise we'll get libicui18n.so.56 not found!
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/qtcreator/lib/Qt/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
- name: Download Qt Creator
id: qt_creator
shell: cmake -P {0}
run: |
string(REGEX MATCH "([0-9]+.[0-9]+).[0-9]+" outvar "$ENV{QT_CREATOR_VERSION}")
set(qtc_base_url "https://download.qt.io/official_releases/qtcreator/${CMAKE_MATCH_1}/$ENV{QT_CREATOR_VERSION}")
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/$ENV{BIN_OUTPUT_PATH}" qtc_output_directory)
if ("${{ runner.os }}" STREQUAL "Windows")
# special handling for Qt Creator 4.8 :-(
if (${{ env.QT_CREATOR_VERSION }} MATCHES "4.8.*")
set(qtc_platform "windows_vs2015_64")
elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat")
set(qtc_platform "windows_msvc2017_x64")
endif()
elseif ("${{ runner.os }}" STREQUAL "Linux")
set(qtc_platform "linux_gcc_64_rhel72")
elseif ("${{ runner.os }}" STREQUAL "macOS")
set(qtc_platform "mac_x64")
endif()
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/../downloads" download_dir)
file(MAKE_DIRECTORY ${qtc_output_directory})
file(MAKE_DIRECTORY qtcreator)
file(MAKE_DIRECTORY ${download_dir})
if (${{ env.DEBUG_OUTPUT }} STREQUAL "true")
message("Using download directory: ${download_dir}")
set(tar_options "xvf")
else()
set(tar_options "xf")
endif()
foreach(package qtcreator)
set(download_file "${qtc_base_url}/installer_source/${qtc_platform}/${package}.7z")
message("Downloading file: '${download_file}'")
file(DOWNLOAD
"${download_file}" ${download_dir}/${package}.7z
STATUS status
LOG log)
list(GET status 0 status_code)
list(GET status 1 status_string)
if (NOT status_code EQUAL 0)
message(FATAL_ERROR "Downloading '${download_file}' failed
status_code: ${status_code}
status_string: ${status_string}
log: ${log}")
endif()
message("Unpacking file: ${download_dir}/${package}.7z")
execute_process(COMMAND
${CMAKE_COMMAND} -E tar ${tar_options} ${download_dir}/${package}.7z
WORKING_DIRECTORY qtcreator
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Error unpacking '${package}.7z': ${result}")
endif()
endforeach()
if ("${{ runner.os }}" STREQUAL "macOS")
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory qtcreator/bin
COMMAND ${CMAKE_COMMAND} -E create_symlink
"$ENV{GITHUB_WORKSPACE}/qtcreator/Qt Creator.app"
"$ENV{GITHUB_WORKSPACE}/qtcreator/bin/Qt Creator.app"
)
endif()
- name: List Qt Creator dirs
if: env.DEBUG_OUTPUT == 'true'
shell: bash
run: |
ls -lah
ls -lah qtcreator || true
ls -lah qtcreator/bin || true
ls -lah qtcreator/lib/Qt/lib || true
- name: Download Qt
id: qt
shell: cmake -P {0}
run: |
set(qt_version $ENV{QT_VERSION})
string(REPLACE "." "" qt_version_dotless "${qt_version}")
if ("${{ runner.os }}" STREQUAL "Windows")
set(url_os "windows_x86")
if ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat")
set(qt_package_name "qt.qt5.${qt_version_dotless}.win64_msvc2017_64")
set(qt_dir_prefix "${qt_version}/msvc2017_64")
else()
endif()
elseif ("${{ runner.os }}" STREQUAL "Linux")
set(url_os "linux_x64")
set(qt_package_name "qt.qt5.${qt_version_dotless}.gcc_64")
set(qt_dir_prefix "${qt_version}/gcc_64")
elseif ("${{ runner.os }}" STREQUAL "macOS")
set(url_os "mac_x64")
set(qt_package_name "qt.qt5.${qt_version_dotless}.clang_64")
set(qt_dir_prefix "${qt_version}/clang_64")
endif()
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/../downloads" download_dir)
file(MAKE_DIRECTORY ${download_dir})
set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt5_${qt_version_dotless}")
set(download_file "${qt_base_url}/Updates.xml")
message("Downloading file: '${download_file}'")
file(DOWNLOAD "${download_file}" ${download_dir}/Updates.xml
STATUS status
LOG log
)
list(GET status 0 status_code)
list(GET status 1 status_string)
if (NOT status_code EQUAL 0)
message(FATAL_ERROR "Downloading '${download_file}' failed
status_code: ${status_code}
status_string: ${status_string}
log: ${log}")
endif()
file(READ ${download_dir}/Updates.xml updates_xml)
string(REGEX MATCH "<Name>${qt_package_name}.*<Version>([0-9+-.]+)</Version>.*<DownloadableArchives>qtbase([a-zA-Z0-9_-]+).7z"
updates_xml_output "${updates_xml}")
set(package_version ${CMAKE_MATCH_1})
set(package_suffix ${CMAKE_MATCH_2})
string(REPLACE "-debug-symbols" "" package_suffix "${package_suffix}")
file(MAKE_DIRECTORY qt5)
# Save the path for other steps
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt5/${qt_dir_prefix}" qt_dir)
message("::set-output name=qt_dir::${qt_dir}")
if (${{ env.DEBUG_OUTPUT }} STREQUAL "true")
message("Using download directory: ${download_dir}")
set(tar_options "xvf")
else()
set(tar_options "xf")
endif()
foreach(package qtbase qtdeclarative qttools qtsvg qtwebsockets qtquickcontrols2 qtconnectivity)
set(download_file "${qt_base_url}/${qt_package_name}/${package_version}${package}${package_suffix}.7z")
message("Downloading file: '${download_file}'")
file(DOWNLOAD
"${download_file}" ${download_dir}/${package}.7z
STATUS status
LOG log
)
list(GET status 0 status_code)
list(GET status 1 status_string)
if (NOT status_code EQUAL 0)
message(FATAL_ERROR "Downloading '${download_file}' failed
status_code: ${status_code}
status_string: ${status_string}
log: ${log}")
endif()
message("Unpacking file: ${download_dir}/${package}.7z")
execute_process(COMMAND
${CMAKE_COMMAND} -E tar ${tar_options} ${download_dir}/${package}.7z
WORKING_DIRECTORY qt5
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Error unpacking '${package}.7z': ${result}")
endif()
endforeach()
file(READ "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" qtconfig)
string(REPLACE "Enterprise" "OpenSource" qtconfig "${qtconfig}")
string(REPLACE "licheck.exe" "" qtconfig "${qtconfig}")
string(REPLACE "licheck64" "" qtconfig "${qtconfig}")
string(REPLACE "licheck_mac" "" qtconfig "${qtconfig}")
file(WRITE "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" "${qtconfig}")
- name: List Qt dirs
if: env.DEBUG_OUTPUT == 'true'
shell: bash
run: |
ls -lah
ls -lah qt5/${QT_VERSION} || true
ls -lah ${{ steps.qt.outputs.qt_dir }}/bin || true
- name: Create Qt config if missing
shell: bash
run: |
if [ ! -f ${{ steps.qt.outputs.qt_dir }}/bin/qt.conf ]; then
echo "Creating qt.conf with Prefix pointing to local installation"
echo "[Paths]
Prefix=.." > ${{ steps.qt.outputs.qt_dir }}/bin/qt.conf
fi
echo "qt.conf content:"
cat ${{ steps.qt.outputs.qt_dir }}/bin/qt.conf
- name: Configure
shell: cmake -P {0}
run: |
if ("${{ runner.os }}" STREQUAL "Windows")
execute_process(
COMMAND "${{ matrix.config.environment_script }}" && set
OUTPUT_FILE environment_script_output.txt
)
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qtcreator" qtcreator_dir)
if (${{ env.DEBUG_OUTPUT }} STREQUAL "true")
execute_process(
COMMAND ${{ steps.qt.outputs.qt_dir }}/bin/qmake --version
)
execute_process(
COMMAND ${{ steps.qt.outputs.qt_dir }}/bin/qmake -query
)
endif()
execute_process(
COMMAND ${{ steps.qt.outputs.qt_dir }}/bin/qmake
$ENV{APP_PRO}
${{ matrix.config.qmake-args }}
QTC_SOURCE="${qtcreator_dir}"
QTC_BUILD="${qtcreator_dir}"
WORKING_DIRECTORY $ENV{GITHUB_WORKSPACE}/$ENV{PROJECT_NAME}
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "qmake failed: bad exit status")
endif()
- name: Build
shell: cmake -P {0}
run: |
if ("${{ runner.os }}" STREQUAL "Windows")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
set(ENV{PATH} "${{ steps.qt.outputs.qt_dir }}/bin/;$ENV{PATH}")
else()
set(ENV{PATH} "${{ steps.qt.outputs.qt_dir }}/bin/:$ENV{PATH}")
endif()
include(ProcessorCount)
ProcessorCount(N)
set(make_program make -j ${N})
if ("${{ runner.os }}" STREQUAL "Windows")
set(make_program "$ENV{GITHUB_WORKSPACE}/qtcreator/bin/jom")
endif()
execute_process(
COMMAND ${make_program}
WORKING_DIRECTORY $ENV{GITHUB_WORKSPACE}/$ENV{PROJECT_NAME}
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Build failed: bad exit status")
endif()
execute_process(
COMMAND cp $ENV{GITHUB_WORKSPACE}/$ENV{PROJECT_NAME}/$ENV{PLUGIN_METAFILE} $ENV{YIO_BIN}
)
execute_process(
COMMAND cp $ENV{GITHUB_WORKSPACE}/$ENV{PROJECT_NAME}/version.txt $ENV{YIO_BIN}
)
- name: Set build artifact name
shell: bash
run: |
APP_VERSION=$(cat "${{ env.YIO_BIN }}/version.txt" | awk '{print $1}')
echo "App version: $APP_VERSION"
echo "ARTIFACT_NAME=${{ env.APP_NAME }}-$APP_VERSION-Qt${{ env.QT_VERSION }}-${{ matrix.config.artifact }}-${{ matrix.config.build }}" >> $GITHUB_ENV
- uses: actions/upload-artifact@v1
id: upload_artifact
with:
path: ${{ env.YIO_BIN }}
name: ${{ env.ARTIFACT_NAME }}