SystemC-Components-Test/Jenkinsfile

104 lines
3.6 KiB
Plaintext
Raw Normal View History

2021-06-02 11:13:19 +02:00
void checkout_project() {
checkout([
$class: 'GitSCM',
branches: [
[name: 'refs/heads/' + getBranch()]
],
2021-06-02 11:13:19 +02:00
extensions: [
[$class: 'CleanBeforeCheckout'],
[$class: 'SubmoduleOption',
disableSubmodules: false,
recursiveSubmodules: true,
trackingSubmodules: false,
parentCredentials: true,
shallow: true
]
2021-06-02 11:13:19 +02:00
],
submoduleCfg: [],
userRemoteConfigs: [
[credentialsId: 'gitea-jenkins', url: 'https://git.minres.com/SystemC/SystemC-Components-Test.git']
]
])
}
void setup_conan() {
sh'''
pip3 install "conan<2.0" pyucis
2021-06-02 11:13:19 +02:00
conan profile new default --detect --force
conan remote list | grep minres > /dev/null
[ $? ] || conan remote add minres https://git.minres.com/api/packages/Tooling/conan
'''
2021-06-02 11:13:19 +02:00
}
void build_n_test_project() {
sh'''
cmake -S . -B build
cmake --build build -j12
cmake --build build --target test
cmake --build build --target format-check
'''
2021-06-02 11:13:19 +02:00
}
2023-12-22 21:43:12 +01:00
pipeline {
2021-06-02 11:13:19 +02:00
agent none
options {
2023-12-22 21:43:12 +01:00
// using the Timestamper plugin we can add timestamps to the console log
2021-06-02 11:13:19 +02:00
timestamps()
skipStagesAfterUnstable()
2023-12-22 21:43:12 +01:00
}
2021-06-02 11:13:19 +02:00
2023-12-22 21:43:12 +01:00
stages {
stage('SCC test pipeline') {
2021-06-02 11:13:19 +02:00
parallel {
stage('U18.04') {
agent {docker { image 'ubuntu-18.04' } }
stages {
stage('Checkout') { steps { checkout_project() }}
stage('Setup') { steps { setup_conan() }}
stage('Build & test') { steps { build_n_test_project() }}
2021-06-02 11:13:19 +02:00
}
}
stage('U20.04') {
agent {docker { image 'ubuntu-20.04' } }
stages {
stage('Checkout') { steps { checkout_project() }}
stage('Setup') { steps { setup_conan() }}
stage('Build & test') { steps { build_n_test_project() }}
2023-12-22 21:43:12 +01:00
}
}
2021-06-02 11:13:19 +02:00
stage('COS7') {
agent {docker { image 'centos7' } }
stages {
stage('Checkout') { steps { checkout_project() }}
stage('Setup') { steps { setup_conan() }}
stage('Build & test') { steps { build_n_test_project() }}
2021-06-02 11:13:19 +02:00
}
}
stage('RCK8') {
agent {docker { image 'rockylinux8' } }
2021-06-02 11:13:19 +02:00
stages {
stage('Checkout') { steps { checkout_project() }}
stage('Setup') { steps { setup_conan() }}
stage('Build & test') { steps { build_n_test_project() }}
2023-12-22 21:43:12 +01:00
}
}
}
}
}
2021-06-02 11:13:19 +02:00
2023-12-22 21:43:12 +01:00
post {
success {
rocketSend ":thumbsup: SCC test run passed, results at ${env.RUN_DISPLAY_URL} "
}
failure {
rocketSend ":thumbsdown: SCC test failed, please check ${env.RUN_DISPLAY_URL} "
emailext recipientProviders: [culprits(), requestor()],
subject: "SCC Test Pipeline Failed: ${currentBuild.fullDisplayName}",
body: """
<p>Build Status: ${currentBuild.currentResult}</p>
<p> Check logs at <a href='${env.BUILD_URL}console'> Build Console Logs </a> or at <a href='${env.RUN_DISPLAY_URL}'> Overview </a></p>
"""
}
}
}