2022-12-02 11:12:17 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2022 Savoir-faire Linux Inc.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public
|
|
|
|
* License along with this program. If not, see
|
|
|
|
* <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Requirements:
|
|
|
|
// - gerrit-trigger plugin
|
|
|
|
// - Docker plugin
|
|
|
|
// - ansicolor plugin
|
|
|
|
|
|
|
|
pipeline {
|
2022-12-02 11:29:43 -05:00
|
|
|
agent {
|
|
|
|
node {
|
|
|
|
label 'jami-buildmachine-04.mtl.sfl'
|
|
|
|
}
|
|
|
|
}
|
2022-12-02 11:12:17 -05:00
|
|
|
|
|
|
|
triggers {
|
|
|
|
gerrit customUrl: '',
|
|
|
|
gerritProjects: [
|
|
|
|
[branches: [[compareType: 'PLAIN', pattern: 'master']],
|
|
|
|
compareType: 'PLAIN',
|
|
|
|
disableStrictForbiddenFileVerification: false,
|
|
|
|
pattern: 'jami-client-qt']],
|
|
|
|
triggerOnEvents: [
|
|
|
|
commentAddedContains('!build'),
|
|
|
|
patchsetCreated(excludeDrafts: true, excludeNoCodeChange: true,
|
|
|
|
excludeTrivialRebase: true)]
|
|
|
|
}
|
|
|
|
|
|
|
|
options {
|
|
|
|
ansiColor('xterm')
|
|
|
|
}
|
|
|
|
|
|
|
|
parameters {
|
|
|
|
string(name: 'GERRIT_REFSPEC',
|
|
|
|
defaultValue: 'refs/heads/master',
|
|
|
|
description: 'The Gerrit refspec to fetch.')
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('SCM Checkout') {
|
|
|
|
deleteDir()
|
|
|
|
// Checkout jami-project to obtain daemon/LRC/client-qt repositories
|
|
|
|
sh """
|
|
|
|
|
|
|
|
git clone --depth=1 --branch=master https://${JAMI_GERRIT_URL}/jami-project
|
|
|
|
cd jami-project
|
|
|
|
# git submodule update --init daemon lrc client-qt
|
|
|
|
git submodule update --init daemon client-qt
|
|
|
|
git submodule foreach 'git checkout master'
|
|
|
|
|
|
|
|
cd client-qt
|
|
|
|
git fetch "https://${JAMI_GERRIT_URL}/jami-client-qt" ${GERRIT_REFSPEC}
|
|
|
|
git checkout FETCH_HEAD
|
|
|
|
git submodule update --init --recursive
|
|
|
|
cd ..
|
|
|
|
"""
|
|
|
|
topDir = pwd() + '/jami-project'
|
|
|
|
}
|
|
|
|
|
|
|
|
dir (topDir) {
|
|
|
|
stage('Building Docker Image') {
|
|
|
|
docker.build('client-validation', "-f client-qt/extras/build/docker/Dockerfile.client-qt-gnulinux --no-cache .")
|
|
|
|
}
|
|
|
|
|
|
|
|
def jenkinsUID = sh(returnStdout: true, script: 'id -u jenkins').replaceAll("\n", '').trim()
|
|
|
|
def jenkinsGID = sh(returnStdout: true, script: 'id -g jenkins').replaceAll("\n", '').trim()
|
|
|
|
def jenkinsUser = jenkinsUID+':'+jenkinsGID
|
2022-12-02 11:29:43 -05:00
|
|
|
def cpuCount = sh returnStdout: true, script: 'nproc || echo -n 4'
|
2022-12-02 11:12:17 -05:00
|
|
|
|
|
|
|
docker.image('client-validation').withRun('-t -u '+jenkinsUser+' -v '+pwd()+':/foo:rw -w /foo -e BATCH_MODE=1', '/bin/bash') {
|
|
|
|
container -> code:{
|
|
|
|
def base_cmd = 'docker exec -t '+container.id+" sh -c '"
|
|
|
|
def exec_cmd = { cmd -> sh base_cmd+cmd+"'" }
|
|
|
|
|
|
|
|
def dockerTopDir = '/foo'
|
|
|
|
def daemonDir = dockerTopDir + '/daemon'
|
|
|
|
def clientDir = dockerTopDir + '/client-qt'
|
|
|
|
def installDir = dockerTopDir + '/install'
|
|
|
|
|
|
|
|
stage('Build Client') {
|
|
|
|
ansiColor('css') {
|
|
|
|
exec_cmd("""
|
|
|
|
cd ${clientDir}
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake .. -DCMAKE_INSTALL_PREFIX=${installDir}/client-qt \
|
|
|
|
-DLIBJAMI_INCLUDE_DIR=${daemonDir}/src/jami \
|
|
|
|
-DLIBJAMI_XML_INTERFACES_DIR=${daemonDir}/bin/dbus \
|
|
|
|
-DCMAKE_PREFIX_PATH=/usr/lib/libqt-jami \
|
|
|
|
-DENABLE_TESTS=True
|
|
|
|
make -j${cpuCount}
|
|
|
|
make install
|
|
|
|
""")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Run Tests') {
|
|
|
|
ansiColor('css') {
|
|
|
|
exec_cmd("""
|
|
|
|
cd ${clientDir}
|
|
|
|
cd tests/qml
|
|
|
|
../../../build/tests/qml_tests
|
|
|
|
""")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|