SystemC-Components-Test/Jenkinsfile

106 lines
3.6 KiB
Plaintext
Raw Permalink Normal View History

2021-06-02 11:13:19 +02:00
void checkout_project() {
checkout([
$class: 'GitSCM',
branches: [
[name: '*/master']
],
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'CleanBeforeCheckout'],
[$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true, recursiveSubmodules: true, reference: '', trackingSubmodules: false]
],
submoduleCfg: [],
userRemoteConfigs: [
[credentialsId: 'gitea-jenkins', url: 'https://git.minres.com/SystemC/SystemC-Components-Test.git']
]
])
}
2021-06-02 12:13:59 +02:00
void setup_conan_stdc() {
2021-06-02 11:13:19 +02:00
sh"""
conan profile new default --detect --force
conan profile update settings.compiler.libcxx=libstdc++ default
"""
}
2021-06-02 12:13:59 +02:00
void setup_conan_stdc11() {
2021-06-02 11:13:19 +02:00
sh"""
conan profile new default --detect --force
conan profile update settings.compiler.libcxx=libstdc++11 default
"""
}
void build_project() {
sh"""
mkdir build; cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j10 VERBOSE=1
"""
}
void test_project() {
sh 'cd build; ctest -C Debug -V -j10 '
}
pipeline {
agent none
options {
// using the Timestamper plugin we can add timestamps to the console log
timestamps()
skipStagesAfterUnstable()
}
stages {
stage('SCC test pipeline') {
parallel {
stage('U18.04') {
agent {docker { image 'ubuntu-18.04' } }
stages {
stage('Ubuntu18.04: checkout') { steps { checkout_project() }}
2021-06-02 12:13:59 +02:00
stage('Ubuntu18.04: Conan') { steps { setup_conan_stdc11() }}
2021-06-02 11:13:19 +02:00
stage('Ubuntu18.04: Build') { steps { build_project() }}
stage('Ubuntu18.04: Test') { steps { test_project() }}
}
}
stage('U20.04') {
agent {docker { image 'ubuntu-20.04' } }
stages {
stage('Ubuntu20.04: checkout') { steps { checkout_project() }}
2021-06-02 12:13:59 +02:00
stage('Ubuntu20.04: Conan') { steps { setup_conan_stdc11() }}
2021-06-02 11:13:19 +02:00
stage('Ubuntu20.04: Build') { steps { build_project() }}
stage('Ubuntu20.04: Test') { steps { test_project() }}
}
}
stage('COS7') {
agent {docker { image 'centos7' } }
stages {
stage('CentOS7: checkout') { steps { checkout_project() }}
2021-06-02 12:13:59 +02:00
stage('CentOS7: conan') { steps { setup_conan_stdc() }}
2021-06-02 11:13:19 +02:00
stage('CentOS7: build') { steps { build_project() }}
stage('CentOS7: test') { steps { test_project() }}
}
}
stage('COS8') {
agent {docker { image 'centos8' } }
stages {
stage('CentOS8: checkout') { steps { checkout_project() }}
2021-06-02 12:13:59 +02:00
stage('CentOS8: conan') { steps { setup_conan_stdc11() }}
2021-06-02 11:13:19 +02:00
stage('CentOS8: build') { steps { build_project() }}
stage('CentOS8: test') { steps { test_project() }}
}
}
}
}
}
post {
success {
echo 'SCC tests PASSED!'
}
failure {
mail to: 'stas@minres.com',
subject: "SCC Test Pipeline Failed: ${currentBuild.fullDisplayName}",
body: "Something is wrong with ${env.BUILD_URL}"
}
}
}