chore_: configure tests develop job (#5956)

* refactor_: rename isTestNightlyJob

* chore_: configure develop tests job

* chore_: isPRJob and getAmountToKeep
This commit is contained in:
Igor Sirotin 2024-10-19 12:01:28 +03:00 committed by GitHub
parent 9fcb153f32
commit 9f564010da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 13 deletions

View File

@ -17,27 +17,27 @@ pipeline {
) )
booleanParam( booleanParam(
name: 'UNIT_TEST_FAILFAST', name: 'UNIT_TEST_FAILFAST',
defaultValue: !isTestNightlyJob(), defaultValue: isPRJob(),
description: 'Should the job fail fast on first test failure?' description: 'Should the job fail fast on first test failure?'
) )
booleanParam( booleanParam(
name: 'UNIT_TEST_RERUN_FAILS', name: 'UNIT_TEST_RERUN_FAILS',
defaultValue: !isTestNightlyJob(), defaultValue: isPRJob(),
description: 'Should the job rerun failed tests?' description: 'Should the job rerun failed tests?'
) )
booleanParam( booleanParam(
name: 'UNIT_TEST_USE_DEVELOPMENT_LOGGER', name: 'UNIT_TEST_USE_DEVELOPMENT_LOGGER',
defaultValue: !isTestNightlyJob(), defaultValue: !isNightlyJob(),
description: 'Should the job use detailed logging for tests, potentially generating large logs?' description: 'Should the job use detailed logging for tests, potentially generating large logs?'
) )
booleanParam( booleanParam(
name: 'UNIT_TEST_REPORT_CODECLIMATE', name: 'UNIT_TEST_REPORT_CODECLIMATE',
defaultValue: true, defaultValue: !isNightlyJob(),
description: 'Should the job report test coverage to CodeClimate?' description: 'Should the job report test coverage to CodeClimate?'
) )
booleanParam( booleanParam(
name: 'UNIT_TEST_REPORT_CODECOV', name: 'UNIT_TEST_REPORT_CODECOV',
defaultValue: true, defaultValue: !isNightlyJob(),
description: 'Should the job report test coverage to Codecov?' description: 'Should the job report test coverage to Codecov?'
) )
booleanParam( booleanParam(
@ -55,9 +55,9 @@ pipeline {
disableConcurrentBuilds() disableConcurrentBuilds()
/* manage how many builds we keep */ /* manage how many builds we keep */
buildDiscarder(logRotator( buildDiscarder(logRotator(
numToKeepStr: isTestNightlyJob() ? '14' : '5', numToKeepStr: getAmountToKeep(),
daysToKeepStr: '30', daysToKeepStr: '30',
artifactNumToKeepStr: isTestNightlyJob() ? '14' : '1', artifactNumToKeepStr: getAmountToKeep(),
)) ))
} }
@ -113,7 +113,7 @@ pipeline {
stage('Migration') { stage('Migration') {
when { // https://github.com/status-im/status-go/issues/4993#issuecomment-2022685544 when { // https://github.com/status-im/status-go/issues/4993#issuecomment-2022685544
expression { !isTestNightlyJob() } expression { isPRJob() }
} }
steps { script { steps { script {
nix.shell('make migration-check', pure: false) nix.shell('make migration-check', pure: false)
@ -125,7 +125,7 @@ pipeline {
BASE_BRANCH = "${env.BASE_BRANCH}" BASE_BRANCH = "${env.BASE_BRANCH}"
} }
when { // https://github.com/status-im/status-go/issues/4993#issuecomment-2022685544 when { // https://github.com/status-im/status-go/issues/4993#issuecomment-2022685544
expression { !isTestNightlyJob() } expression { isPRJob() }
} }
steps { script { steps { script {
nix.shell('make commit-check', pure: false) nix.shell('make commit-check', pure: false)
@ -204,7 +204,7 @@ pipeline {
script { script {
env.PKG_URL = "${currentBuild.absoluteUrl}/consoleText" env.PKG_URL = "${currentBuild.absoluteUrl}/consoleText"
if (isTestNightlyJob()) { if (!isPRJob()) {
archiveArtifacts('report_*.xml, test_*.log, test-coverage.html, test-coverage.out, coverage/codeclimate.json') archiveArtifacts('report_*.xml, test_*.log, test-coverage.html, test-coverage.out, coverage/codeclimate.json')
} }
if (params.UNIT_TEST_RERUN_FAILS) { if (params.UNIT_TEST_RERUN_FAILS) {
@ -244,8 +244,14 @@ pipeline {
} // post } // post
} // pipeline } // 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' }