2023-06-29 13:40:43 +00:00
|
|
|
#!/usr/bin/env groovy
|
2024-03-27 12:07:45 +00:00
|
|
|
library 'status-jenkins-lib@v1.8.11'
|
2022-08-26 13:18:45 +00:00
|
|
|
|
|
|
|
/* Options section can't access functions in objects. */
|
|
|
|
def isPRBuild = utils.isPRBuild()
|
|
|
|
|
|
|
|
pipeline {
|
2024-02-07 10:44:43 +00:00
|
|
|
agent { label 'linux && x86_64 && nix-2.19' }
|
2022-08-26 13:18:45 +00:00
|
|
|
|
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
/* Prevent Jenkins jobs from running forever */
|
2024-02-28 09:47:45 +00:00
|
|
|
timeout(time: 20, unit: 'MINUTES')
|
2022-08-26 13:18:45 +00:00
|
|
|
/* Limit builds retained */
|
|
|
|
buildDiscarder(logRotator(
|
|
|
|
numToKeepStr: '10',
|
|
|
|
daysToKeepStr: '20',
|
2024-02-28 14:50:47 +00:00
|
|
|
artifactNumToKeepStr: '1',
|
2022-08-26 13:18:45 +00:00
|
|
|
))
|
|
|
|
/* Abort old PR builds. */
|
|
|
|
disableConcurrentBuilds(
|
|
|
|
abortPrevious: isPRBuild
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
parameters {
|
|
|
|
string(
|
|
|
|
name: 'BUILD_TYPE',
|
|
|
|
description: 'Specify build type. Values: pr / e2e / nightly / release',
|
|
|
|
defaultValue: 'pr',
|
|
|
|
)
|
2024-03-27 12:51:45 +00:00
|
|
|
booleanParam(
|
|
|
|
name: 'RUN_CONTRACT_TESTS',
|
|
|
|
description: 'Whether to run optional and slow contract tests.',
|
|
|
|
defaultValue: false,
|
|
|
|
)
|
2022-08-26 13:18:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
2024-03-27 12:07:45 +00:00
|
|
|
LANG = 'en_US.UTF-8'
|
|
|
|
LC_ALL = 'en_US.UTF-8'
|
|
|
|
LANGUAGE = 'en_US.UTF-8'
|
|
|
|
PLATFORM = 'tests'
|
2022-08-26 13:18:45 +00:00
|
|
|
BUILD_ENV = 'prod'
|
|
|
|
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
|
|
|
LOG_FILE = utils.pkgFilename(ext: 'log', arch: 'tests')
|
2024-03-27 12:51:45 +00:00
|
|
|
CLJ_LINTER_PRINT_WARNINGS = 'true'
|
2022-08-26 13:18:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
2024-03-27 12:51:45 +00:00
|
|
|
stage('Test') {
|
2022-08-26 13:18:45 +00:00
|
|
|
parallel {
|
|
|
|
stage('Lint') {
|
2024-03-27 12:51:45 +00:00
|
|
|
steps { make('lint') }
|
2022-08-26 13:18:45 +00:00
|
|
|
}
|
2024-03-27 12:51:45 +00:00
|
|
|
stage('Unit') {
|
|
|
|
steps { make('test-unit') }
|
|
|
|
}
|
|
|
|
stage('Component') {
|
|
|
|
steps { make('test-component') }
|
2022-08-26 13:18:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-03-27 12:51:45 +00:00
|
|
|
stage('Heavy Test') {
|
|
|
|
parallel {
|
|
|
|
stage('Contract') {
|
|
|
|
when { expression { params.RUN_CONTRACT_TESTS } }
|
|
|
|
steps { make('test-contract') }
|
|
|
|
}
|
|
|
|
stage('Integration') {
|
|
|
|
steps { make('test-integration') }
|
|
|
|
}
|
2023-02-21 05:42:33 +00:00
|
|
|
}
|
|
|
|
}
|
2022-08-26 13:18:45 +00:00
|
|
|
stage('Upload') {
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
env.PKG_URL = s3.uploadArtifact(LOG_FILE)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
success { script { github.notifyPR(true) } }
|
|
|
|
failure { script { github.notifyPR(false) } }
|
|
|
|
always { sh 'make purge' }
|
|
|
|
}
|
|
|
|
}
|
2024-03-27 12:51:45 +00:00
|
|
|
|
|
|
|
def make(target) {
|
|
|
|
sh """#!/bin/bash
|
|
|
|
set -eo pipefail
|
|
|
|
make ${target} 2>&1 | tee -a ${LOG_FILE}
|
|
|
|
"""
|
|
|
|
}
|