-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathJenkinsfile
242 lines (222 loc) · 7.45 KB
/
Jenkinsfile
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
pipeline {
agent none
environment {
JOB_QT_APP = "silverkey-qt"
}
stages {
stage('Build') {
parallel {
stage('linux') {
environment {
STAGE_ARCH = "x64_86"
STAGE_OS = "linux"
STAGE_ARTIFACT = "${JOB_QT_APP}-${STAGE_OS}-${STAGE_ARCH}"
LINUXDEPLOYQT_BUILD_DIR = "/opt/linuxdeployqt"
TMP_FILE = "/tmp/${JOB_QT_APP}"
ARTIFACT_SHARE_HOST_DIR = "/opt/silverkey"
ARTIFACT_SHARE_CONTAINER_DIR = "/opt/silverkey"
SK_ICON_PATH = "/tmp/silverkey-icon.png"
}
agent {
dockerfile {
reuseNode true
label 'master'
args "--privileged --cap-add SYS_PTRACE -v /opt/silverkey:/opt/silverkey"
}
}
steps {
step([$class: 'WsCleanup'])
echo "---- PR build test 8888"
checkout scm
dir('src') {
sh 'qmake'
sh 'make -j4'
sh "chmod +x ${JOB_QT_APP}"
sh "cp -v ${JOB_QT_APP} ${TMP_FILE}"
sh "mv -v ${JOB_QT_APP} ${STAGE_ARTIFACT}"
}
archiveArtifacts "src/${STAGE_ARTIFACT}"
//dir("${LINUXDEPLOYQT_BUILD_DIR}") {
sh """
sudo mkdir --mode=777 -p "${LINUXDEPLOYQT_BUILD_DIR}"
cd "${LINUXDEPLOYQT_BUILD_DIR}"
pwd
id
ls -ltr "${LINUXDEPLOYQT_BUILD_DIR}"
mkdir -p usr/bin usr/lib usr/share/applications usr/share/icons/hicolor/256x256/apps
cp -v "${TMP_FILE}" "usr/bin/${JOB_QT_APP}"
cp -v "${SK_ICON_PATH}" usr/share/icons/hicolor/256x256/apps/silverkey-qt.png
cat<<EOF > "usr/share/applications/${JOB_QT_APP}.desktop"
[Desktop Entry]
Type=Application
Name=Silverkey
Comment=The best Qt Application Ever
Exec=${JOB_QT_APP}
Icon=${JOB_QT_APP}
Categories=Office;
EOF
export PATH=/opt/Qt/5.11.0/gcc_64/bin/:${PATH}
sudo /opt/Qt/5.11.0/gcc_64/bin/linuxdeployqt usr/share/applications/silverkey-qt.desktop -appimage -qmake=/opt/Qt/5.11.0/gcc_64/bin/qmake
sudo chown user: ${LINUXDEPLOYQT_BUILD_DIR}/Silverkey-x86_64.AppImage
ls -ltr ${env.WORKSPACE}/
cp -vr ${LINUXDEPLOYQT_BUILD_DIR}/Silverkey-x86_64.AppImage ${env.WORKSPACE}/
"""
archiveArtifacts "Silverkey-x86_64.AppImage"
}
}
/*
stage('qt-5.9-linux-static') {
environment {
STAGE_ARCH = "x64_86"
STAGE_OS = "linux"
STAGE_ARTIFACT = "${JOB_QT_APP}-${STAGE_OS}-static-${STAGE_ARCH}"
}
agent {
dockerfile {
filename 'qt_5_9_linux_static.Dockerfile'
reuseNode true
label 'master'
}
}
steps {
step([$class: 'WsCleanup'])
checkout scm
dir('src') {
sh 'qmake -profile release'
sh 'make -j4'
sh "mv -v ${JOB_QT_APP} ${STAGE_ARTIFACT}"
}
archiveArtifacts "src/${STAGE_ARTIFACT}"
}
}
*/
stage('osx') {
environment {
STAGE_ARTIFACT = "${JOB_QT_APP}.app/**"
}
agent {
label 'mac-slave'
}
steps {
step([$class: 'WsCleanup'])
echo "---- PR build test 8888"
checkout scm
dir('src') {
sh '/usr/local/Cellar/qt/5.10.1/bin/qmake'
sh 'make -j4'
sh '/usr/local/Cellar/qt/5.10.1/bin/macdeployqt ${JOB_QT_APP}.app'
archiveArtifacts "${STAGE_ARTIFACT}"
}
}
}
}
}
stage('linux xfce4 funcational test') {
environment {
ARTIFACT_SHARE_CONTAINER_DIR = "/opt/silverkey"
}
agent {
dockerfile {
filename 'wm-xfce.Dockerfile'
reuseNode true
label 'master'
args "--network=silverkey-ci-test --privileged -v /opt/silverkey:/opt/silverkey --volumes-from=silverkeyci_ci_1"
}
}
steps {
sh """
startxfce4 &
sleep 5
"""
checkout scm
dir('.') {
sh "chmod +x /var/jenkins_home/jobs/silverkey-ui-crossplatform-build-pipeline/builds/${env.BUILD_NUMBER}/archive/Silverkey-x86_64.AppImage"
sh "./test-scenario.sh /var/jenkins_home/jobs/silverkey-ui-crossplatform-build-pipeline/builds/${env.BUILD_NUMBER}/archive/Silverkey-x86_64.AppImage"
}
}
}
stage('linux xfce4 trusty funcational test') {
environment {
ARTIFACT_SHARE_CONTAINER_DIR = "/opt/silverkey"
}
agent {
dockerfile {
filename 'wm-xfce-trusty.Dockerfile'
reuseNode true
label 'master'
args "--network=silverkey-ci-test --privileged -v /opt/silverkey:/opt/silverkey --volumes-from=silverkeyci_ci_1"
}
}
steps {
sh """
startxfce4 &
sleep 5
"""
checkout scm
dir('.') {
sh "chmod +x /var/jenkins_home/jobs/silverkey-ui-crossplatform-build-pipeline/builds/${env.BUILD_NUMBER}/archive/Silverkey-x86_64.AppImage"
sh "./test-scenario.sh /var/jenkins_home/jobs/silverkey-ui-crossplatform-build-pipeline/builds/${env.BUILD_NUMBER}/archive/Silverkey-x86_64.AppImage"
}
}
}
/*
stage('linux fvwm2 funcational test') {
environment {
ARTIFACT_SHARE_CONTAINER_DIR = "/opt/silverkey"
}
agent {
dockerfile {
filename 'wm-fvwm.Dockerfile'
reuseNode true
label 'master'
args "--network=silverkey-ci-test --privileged -v /opt/silverkey:/opt/silverkey --volumes-from=silverkeyci_ci_1"
}
}
steps {
sh """
fvwm -replace &
sleep 5
"""
checkout scm
dir('.') {
sh "chmod +x /var/jenkins_home/jobs/silverkey-ui-crossplatform-build-pipeline/builds/${env.BUILD_NUMBER}/archive/Silverkey-x86_64.AppImage"
sh "./test-scenario.sh /var/jenkins_home/jobs/silverkey-ui-crossplatform-build-pipeline/builds/${env.BUILD_NUMBER}/archive/Silverkey-x86_64.AppImage"
}
}
}
*/
stage('Publish latest artifacts') {
environment {
ARTIFACT_SHARE_CONTAINER_DIR = "/opt/silverkey"
}
agent {
dockerfile {
filename 'publish-artifacts.Dockerfile'
reuseNode true
label 'master'
args "--privileged --cap-add SYS_PTRACE -v /opt/silverkey:/opt/silverkey"
}
}
steps {
sh """
sudo cp /var/jenkins_home/jobs/silverkey-ui-crossplatform-build-pipeline/builds/${env.BUILD_NUMBER}/archive/Silverkey-x86_64.AppImage ${ARTIFACT_SHARE_CONTAINER_DIR}/artifacts/silverkey-latest-linux.run
"""
sh """
cd /var/jenkins_home/jobs/silverkey-ui-crossplatform-build-pipeline/builds/${env.BUILD_NUMBER}/archive/
sudo chmod +x silverkey-qt.app/Contents/MacOS/silverkey-qt
sudo zip -r ${ARTIFACT_SHARE_CONTAINER_DIR}/artifacts/silverkey-latest-osx.zip silverkey-qt.app
"""
}
}
}
post {
success {
script {
// CHANGE_ID is set only for pull requests, so it is safe to access the pullRequest global variable
if (env.CHANGE_ID) {
pullRequest.addLabel('Build success')
}
}
}
}
}