-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'gurka-feat-harp_ci' into 'main'
jenkins: [FEATURE] Integrate harp into Jenkins See merge request ndk/ofm!416
- Loading branch information
Showing
2 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,4 +151,90 @@ def commonPrekladMultiVerRun(COMPONENTS, ofm_path = pwd()) { | |
} | ||
} | ||
|
||
def commonPrekladHarpRun(COMPONENTS, ofm_path = pwd()) { | ||
// Clean old builds from Jenkins history | ||
cleanBuilds() | ||
|
||
// fetch sources from GIT | ||
checkout scm | ||
// clean artifacts possibly left by previous builds | ||
sh "git clean -df" | ||
|
||
// every midnight check for new commits and run pipeline if they exist | ||
properties([pipelineTriggers([pollSCM('H H(0-2) * * *')])]) | ||
|
||
def failed = [] | ||
//load new fpga_version and set default simulator | ||
def toolsel = "set +x\n" | ||
toolsel += "source fpga_version.sh\n" | ||
toolsel += "fpga_sim -d\n" | ||
toolsel += "set -x\n" | ||
|
||
def venv_dir = "$ofm_path/python/harp/harp_venv" | ||
|
||
// prepare virtual environment with HARP | ||
stage("Prepare virtual env") { | ||
sh """ | ||
if ! command -v python3.9; then | ||
echo "Python 3.9 is not installed. Please install Python 3.9." | ||
exit 1 | ||
fi | ||
python3.9 -m venv $venv_dir | ||
source $venv_dir/bin/activate | ||
pip install --upgrade pip | ||
pip install $ofm_path/python/harp | ||
""" | ||
} | ||
|
||
def env_source = "source $venv_dir/bin/activate\n" | ||
|
||
for(c in COMPONENTS) { | ||
// parse | ||
def name = c[0] | ||
def path = c[1] | ||
|
||
// exec vsim | ||
try { // try-catch is a hack to continue even after the first failed verification | ||
timeout(time: 4, unit: 'HOURS') { | ||
stage("$name") { | ||
dir("$path") { | ||
def command = "harp multiver" | ||
sh "${env_source}${toolsel}${command}" | ||
} | ||
} | ||
} | ||
} catch(err) { | ||
currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins | ||
failed.add("$name") | ||
} finally { // collect interesting files | ||
// there is unknown path to transcripts folder | ||
// archiveArtifacts "$path/transcript*" | ||
if(currentBuild.result == "FAILURE") { | ||
archiveArtifacts "$path/failed_combinations.csv" // failed combinations summary with seed | ||
// there is unknown path to wave folder | ||
// archiveArtifacts "$path/vsim.wlf" | ||
} | ||
} | ||
} | ||
|
||
// send out emails if failure is detected | ||
if(currentBuild.result == "FAILURE") { | ||
println "FAILED on components: ${failed}." | ||
emailext \ | ||
recipientProviders: [culprits(), developers()], | ||
to: '[email protected]', | ||
subject: "[Jenkins] ${currentBuild.currentResult} ${env.JOB_NAME} #${currentBuild.number}", | ||
body: """\ | ||
The build of the repository (with HARP) ${env.JOB_NAME} #${currentBuild.number} ends up with status ${currentBuild.currentResult} on components: ${failed}. You can find build log in the attachments. | ||
|
||
For more details see ${env.BUILD_URL}. | ||
|
||
Yours sincerely | ||
Jenkins\ | ||
""".stripIndent(), | ||
attachLog: true, | ||
compressLog: true | ||
} | ||
} | ||
|
||
return this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters