From 6a6c2007d9331821f6af3de0eb62de04eff3d69c Mon Sep 17 00:00:00 2001 From: gabriel Date: Tue, 30 Jan 2024 10:08:15 +0100 Subject: [PATCH] add Jenkinsfile --- Jenkinsfile | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..726508c --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,81 @@ +void checkout_project() { + checkout([ + $class: 'GitSCM', + branches: [ + [name: '*/main'] + ], + extensions: [ + [$class: 'CleanBeforeCheckout'], + [$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true, recursiveSubmodules: true, reference: '', trackingSubmodules: false] + ], + submoduleCfg: [], + userRemoteConfigs: [ + [credentialsId: 'gitea-jenkins', url: 'https://git.minres.com/Firmware/Firmwares.git'] + ] + ]) +} + +void checkout_develop() { + dir("bare-metal-bsp") { + withCredentials([usernamePassword(credentialsId: 'gitea-jenkins', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD')]) { + sh ("git pull origin develop") + } + } + //sh("cd bare-metal-bsp && git checkout develop") +} + +void make_hello(board) { + sh("make -C hello-world/ BOARD=${board}") + sh("make -C hello-world/ clean") +} + +pipeline { + agent { docker { + image 'ubuntu-riscv' + args '-v $HOME/.m2:/root/.m2' + }} + options { + // using the Timestamper plugin we can add timestamps to the console log + timestamps() + skipStagesAfterUnstable() + } + stages { + /*stage('checkout repo') { steps{ checkout_project()}} + stage('checkout develop') { steps{ checkout_develop()}} + stage('make iss') {steps { make_hello("iss")}} + stage('make hifive1') {steps { make_hello("hifive1")}} + stage('make TGC5L') {steps { make_hello("TGC5L")}} + stage('make rtl') {steps { make_hello("rtl")}} + stage('make ehrenberg') {steps { make_hello("ehrenberg")}} + stage('make tgc-vp') {steps { make_hello("tgc-vp")}}*/ + stage('make hello-world') { + matrix { + axes { + axis{ + name 'BOARD' + values 'iss', 'hifive1', 'TGC5L', 'ehrenberg', 'rtl', 'tgc-vp' + } + } + stages { + stage('Force sequential') { + options { + lock("One Board at a time") + } + stages { + stage("make") { + steps { + make_hello("${BOARD}") + } + } + } + } + } + } + } + } + post { + failure { + sh("make -C hello-world/ clean") + } + } +}