status-go/_assets/ci/Jenkinsfile.tests-rpc

80 lines
2.1 KiB
Groovy

#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.6'
pipeline {
agent { label 'linux && x86_64 && nix-2.19' }
parameters {
string(
name: 'BRANCH',
defaultValue: 'develop',
description: 'Name of branch to build.'
)
booleanParam(
name: 'FUNCTIONAL_TESTS_REPORT_CODECOV',
defaultValue: true,
description: 'Should the job report test coverage to Codecov?'
)
}
options {
timestamps()
/* Prevent Jenkins jobs from running forever */
timeout(time: 30, unit: 'MINUTES')
disableConcurrentBuilds()
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: getAmountToKeep(),
daysToKeepStr: '-1',
artifactNumToKeepStr: getAmountToKeep(),
))
}
environment {
PLATFORM = 'tests-rpc'
PKG_URL = "${currentBuild.absoluteUrl}/consoleText"
/* Hack-fix for params not being set in env on first job run. */
BRANCH = "${params.BRANCH}"
FUNCTIONAL_TESTS_REPORT_CODECOV = "${params.FUNCTIONAL_TESTS_REPORT_CODECOV}"
}
stages {
stage('RPC Tests') {
steps { script {
withCredentials([
string(
credentialsId: 'codecov-repository-upload-token',
variable: 'CODECOV_TOKEN'
),
]) {
nix.shell('make test-functional', pure: false)
}
} }
}
} // stages
post {
always {
script {
archiveArtifacts(
artifacts: 'tests-functional/reports/*.xml, tests-functional/*.log, tests-functional/coverage/coverage.html',
allowEmptyArchive: true,
)
junit(
testResults: 'tests-functional/reports/*.xml',
skipOldReports: true,
skipPublishingChecks: true,
skipMarkingBuildUnstable: true,
)
}
}
success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } }
cleanup { sh 'make git-clean' }
} // post
} // pipeline
def isDevelopJob() { env.JOB_BASE_NAME == 'tests-rpc-develop' }
def getAmountToKeep() { isDevelopJob() ? '30' : '5' }