1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-07-01 22:25:26 +02:00
jami-client-qt/extras/ci/client-qt-gnulinux/Jenkinsfile

110 lines
3.9 KiB
Text
Raw Normal View History

/*
* 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 {
agent {
node {
label 'jami-buildmachine-04.mtl.sfl'
}
}
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.')
}
stages {
stage('SCM Checkout') {
steps {
script {
sh """
git fetch ssh://jenkins@review.jami.net:29420/jami-client-qt $GERRIT_REFSPEC && git checkout FETCH_HEAD
git rev-parse HEAD
git submodule update --init --recursive
"""
}
}
}
stage('Building Docker Image') {
steps {
script {
docker.build('client-validation', "-f extras/build/docker/Dockerfile.client-qt-gnulinux --no-cache .")
}
}
}
stage('Build Client') {
steps {
script {
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
def cpuCount = sh returnStdout: true, script: 'nproc || echo -n 4'
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/'
ansiColor('css') {
exec_cmd("""
cd ${dockerTopDir}
./build.py --install --qt /usr/lib/libqt-jami/
cd build
cmake .. -DENABLE_TESTS=True
make -j${cpuCount}
""")
exec_cmd("""
cd ${dockerTopDir}
cd tests/qml/src
HOME=/tmp ../../../build/tests/qml_tests
""")
}
}
}
}
}
}
}
}