diff --git a/_assets/ci/Jenkinsfile.tests b/_assets/ci/Jenkinsfile.tests index 2eefe7c35..627f4e71c 100644 --- a/_assets/ci/Jenkinsfile.tests +++ b/_assets/ci/Jenkinsfile.tests @@ -17,27 +17,27 @@ pipeline { ) booleanParam( name: 'UNIT_TEST_FAILFAST', - defaultValue: !isTestNightlyJob(), + defaultValue: isPRJob(), description: 'Should the job fail fast on first test failure?' ) booleanParam( name: 'UNIT_TEST_RERUN_FAILS', - defaultValue: !isTestNightlyJob(), + defaultValue: isPRJob(), description: 'Should the job rerun failed tests?' ) booleanParam( name: 'UNIT_TEST_USE_DEVELOPMENT_LOGGER', - defaultValue: !isTestNightlyJob(), + defaultValue: !isNightlyJob(), description: 'Should the job use detailed logging for tests, potentially generating large logs?' ) booleanParam( name: 'UNIT_TEST_REPORT_CODECLIMATE', - defaultValue: true, + defaultValue: !isNightlyJob(), description: 'Should the job report test coverage to CodeClimate?' ) booleanParam( name: 'UNIT_TEST_REPORT_CODECOV', - defaultValue: true, + defaultValue: !isNightlyJob(), description: 'Should the job report test coverage to Codecov?' ) booleanParam( @@ -55,9 +55,9 @@ pipeline { disableConcurrentBuilds() /* manage how many builds we keep */ buildDiscarder(logRotator( - numToKeepStr: isTestNightlyJob() ? '14' : '5', + numToKeepStr: getAmountToKeep(), daysToKeepStr: '30', - artifactNumToKeepStr: isTestNightlyJob() ? '14' : '1', + artifactNumToKeepStr: getAmountToKeep(), )) } @@ -113,7 +113,7 @@ pipeline { stage('Migration') { when { // https://github.com/status-im/status-go/issues/4993#issuecomment-2022685544 - expression { !isTestNightlyJob() } + expression { isPRJob() } } steps { script { nix.shell('make migration-check', pure: false) @@ -125,7 +125,7 @@ pipeline { BASE_BRANCH = "${env.BASE_BRANCH}" } when { // https://github.com/status-im/status-go/issues/4993#issuecomment-2022685544 - expression { !isTestNightlyJob() } + expression { isPRJob() } } steps { script { nix.shell('make commit-check', pure: false) @@ -204,7 +204,7 @@ pipeline { script { env.PKG_URL = "${currentBuild.absoluteUrl}/consoleText" - if (isTestNightlyJob()) { + if (!isPRJob()) { archiveArtifacts('report_*.xml, test_*.log, test-coverage.html, test-coverage.out, coverage/codeclimate.json') } if (params.UNIT_TEST_RERUN_FAILS) { @@ -244,8 +244,14 @@ pipeline { } // post } // pipeline -def isTestNightlyJob() { env.JOB_BASE_NAME == 'tests-nightly' } +def isNightlyJob() { env.JOB_BASE_NAME == 'tests-nightly' } -def getDefaultUnitTestCount() { isTestNightlyJob() ? '20' : '1' } +def isDevelopJob() { env.JOB_BASE_NAME == 'tests-develop' } -def getDefaultTimeout() { isTestNightlyJob() ? 5*60 : 50 } +def isPRJob() { !isNightlyJob() && !isDevelopJob() } + +def getDefaultUnitTestCount() { isNightlyJob() ? '20' : '1' } + +def getDefaultTimeout() { isNightlyJob() ? 5*60 : 50 } + +def getAmountToKeep() { isNightlyJob() ? '14' : isDevelopJob() ? '10' : '5' } \ No newline at end of file