2023-12-22 22:23:40 +01:00
|
|
|
def getBranch() {
|
|
|
|
if (env.BRANCH_NAME != null && !env.BRANCH_NAME.isEmpty() ) {
|
|
|
|
return env.BRANCH_NAME
|
|
|
|
} else {
|
|
|
|
return 'develop'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-02 11:13:19 +02:00
|
|
|
void checkout_project() {
|
|
|
|
checkout([
|
|
|
|
$class: 'GitSCM',
|
2023-12-22 22:13:38 +01:00
|
|
|
branches: [
|
|
|
|
[name: 'refs/heads/' + getBranch()]
|
|
|
|
],
|
2021-06-02 11:13:19 +02:00
|
|
|
extensions: [
|
|
|
|
[$class: 'CleanBeforeCheckout'],
|
2023-12-22 22:13:38 +01:00
|
|
|
[$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']
|
|
|
|
]
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
2024-07-06 10:22:02 +02:00
|
|
|
void build_n_test_project() {
|
2023-12-22 22:13:38 +01:00
|
|
|
sh'''
|
2024-07-06 10:07:51 +02:00
|
|
|
python3 -mvenv .venv
|
|
|
|
. .venv/bin/activate
|
|
|
|
pip3 install -r requirements.txt
|
|
|
|
cmake -S . -B build --preset Release
|
2023-12-22 22:13:38 +01:00
|
|
|
cmake --build build -j12
|
|
|
|
cmake --build build --target test
|
|
|
|
'''
|
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 {
|
2024-07-06 10:25:29 +02:00
|
|
|
stage('ubuntu-22.04') {
|
2023-12-22 22:35:08 +01:00
|
|
|
agent {docker { image 'ubuntu-22.04' } }
|
2021-06-02 11:13:19 +02:00
|
|
|
stages {
|
2023-12-22 22:13:38 +01:00
|
|
|
stage('Checkout') { steps { checkout_project() }}
|
|
|
|
stage('Build & test') { steps { build_n_test_project() }}
|
2021-06-02 11:13:19 +02:00
|
|
|
}
|
|
|
|
}
|
2024-07-06 10:25:29 +02:00
|
|
|
// stage('U20.04') {
|
|
|
|
// agent {docker { image 'ubuntu-20.04' } }
|
|
|
|
// stages {
|
|
|
|
// stage('Checkout') { steps { checkout_project() }}
|
|
|
|
// stage('Build & test') { steps { build_n_test_project() }}
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
stage('centos7') {
|
2021-06-02 11:13:19 +02:00
|
|
|
agent {docker { image 'centos7' } }
|
|
|
|
stages {
|
2023-12-22 22:13:38 +01:00
|
|
|
stage('Checkout') { steps { checkout_project() }}
|
2024-07-06 10:37:34 +02:00
|
|
|
stage('Build & test') { steps {
|
|
|
|
sh'''
|
|
|
|
python3 -mvenv .venv
|
|
|
|
. .venv/bin/activate
|
|
|
|
pip3 install -r requirements.txt
|
2024-07-06 10:41:41 +02:00
|
|
|
conan profile detect --force -vquiet
|
2024-07-06 10:37:34 +02:00
|
|
|
conan install --requires 'b2/[*]' --build='*'
|
|
|
|
cmake -S . -B build --preset Release
|
|
|
|
cmake --build build -j12
|
|
|
|
cmake --build build --target test
|
|
|
|
'''
|
|
|
|
}}
|
2021-06-02 11:13:19 +02:00
|
|
|
}
|
|
|
|
}
|
2024-07-06 10:25:29 +02:00
|
|
|
stage('rockylinux8') {
|
2023-12-22 22:13:38 +01:00
|
|
|
agent {docker { image 'rockylinux8' } }
|
2021-06-02 11:13:19 +02:00
|
|
|
stages {
|
2023-12-22 22:13:38 +01:00
|
|
|
stage('Checkout') { steps { checkout_project() }}
|
|
|
|
stage('Build & test') { steps { build_n_test_project() }}
|
2023-12-22 21:43:12 +01:00
|
|
|
}
|
|
|
|
}
|
2023-12-22 22:54:40 +01:00
|
|
|
//
|
2024-04-06 12:50:52 +02:00
|
|
|
stage('Format check') {
|
2023-12-22 22:54:40 +01:00
|
|
|
agent {docker { image 'ubuntu-riscv' } }
|
|
|
|
stages {
|
|
|
|
stage('Checkout') { steps { checkout_project() }}
|
|
|
|
stage('Build & check format') { steps {
|
|
|
|
sh'''
|
2024-07-06 10:25:29 +02:00
|
|
|
python3 -mvenv .venv
|
|
|
|
. .venv/bin/activate
|
|
|
|
pip3 install -r requirements.txt
|
2024-07-06 10:07:51 +02:00
|
|
|
cmake -S . -B build --preset Release
|
2023-12-22 22:54:40 +01:00
|
|
|
cmake --build build --target format-check
|
|
|
|
'''
|
|
|
|
}}
|
|
|
|
}
|
|
|
|
}
|
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>
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|