ci: extrac Lint and Tests to separate job

This way we can make PRs depend only on successful tests, and not whole
builds for all platforms, which take 10 minutes or more.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-08-26 15:18:45 +02:00
parent 47a31ae0aa
commit 0a4d181477
No known key found for this signature in database
GPG Key ID: 09AA5403E54D9931
5 changed files with 124 additions and 118 deletions

View File

@ -298,13 +298,12 @@ shadow-server:##@ Start shadow-cljs in server mode for watching
yarn shadow-cljs server yarn shadow-cljs server
test-watch: export TARGET := clojure test-watch: export TARGET := clojure
test-watch: status-go-library
test-watch: ##@ Watch tests and re-run no changes to cljs files test-watch: ##@ Watch tests and re-run no changes to cljs files
yarn install yarn install
nodemon --exec 'yarn shadow-cljs compile mocks && yarn shadow-cljs compile test && node --require ./test-resources/override.js target/test/test.js' -e cljs nodemon --exec 'yarn shadow-cljs compile mocks && yarn shadow-cljs compile test && node --require ./test-resources/override.js target/test/test.js' -e cljs
test: export TARGET := clojure test: export TARGET := clojure
test: status-go-library ##@test Run tests once in NodeJS test: ##@test Run tests once in NodeJS
# Here we creates the gyp bindings for nodejs # Here we creates the gyp bindings for nodejs
yarn install yarn install
yarn shadow-cljs compile mocks && \ yarn shadow-cljs compile mocks && \

View File

@ -56,32 +56,6 @@ pipeline {
} }
} }
} }
stage('Parallel Assemble') {
parallel {
stage('Checks') { stages {
stage('Lint') {
steps {
script {
/* We want the build result to be uploaded */
catchError(
message: 'Linting check failed!',
buildResult: 'FAILURE',
stageResult: 'FAILURE'
) {
sh 'make lint'
}
}
}
}
stage('Tests') {
steps {
script {
sh 'make test'
}
}
}
} }
stage('Build') { stages {
stage('Bundle') { stage('Bundle') {
steps { steps {
script { apks = android.bundle() } script { apks = android.bundle() }
@ -92,9 +66,6 @@ pipeline {
script { apks = android.sign(apks) } script { apks = android.sign(apks) }
} }
} }
} }
}
}
stage('Parallel Upload') { stage('Parallel Upload') {
parallel { parallel {
stage('Archive') { stage('Archive') {
@ -103,8 +74,7 @@ pipeline {
} } } }
} }
stage('Upload') { stage('Upload') {
steps { steps { script {
script {
def urls = apks.collect { s3.uploadArtifact(it) } def urls = apks.collect { s3.uploadArtifact(it) }
/* return only the universal APK */ /* return only the universal APK */
if (urls.size() > 1) { if (urls.size() > 1) {
@ -120,20 +90,14 @@ pipeline {
if (utils.isNightlyBuild()) { if (utils.isNightlyBuild()) {
env.DIAWI_URL = android.uploadToDiawi() env.DIAWI_URL = android.uploadToDiawi()
} }
} }
} }
} }
} }
} }
}
stage('Cleanup') {
steps {
sh 'make purge'
}
}
}
post { post {
success { script { github.notifyPR(true) } } success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } } failure { script { github.notifyPR(false) } }
always { sh 'make _fix-node-perms' } always { sh 'make purge' }
} }
} }

View File

@ -49,6 +49,9 @@ pipeline {
stage('Android e2e') { steps { script { stage('Android e2e') { steps { script {
apke2e = jenkins.Build('status-mobile/platforms/android-e2e') apke2e = jenkins.Build('status-mobile/platforms/android-e2e')
} } } } } }
stage('Tests') { steps { script {
ios = jenkins.Build('status-mobile/platforms/tests')
} } }
} }
} }
stage('Archive') { stage('Archive') {

View File

@ -55,32 +55,6 @@ pipeline {
} }
} }
} }
stage('Parallel Assemble') {
parallel {
stage('Checks') { stages {
stage('Lint') {
steps {
script {
/* We want the build result to be uploaded */
catchError(
message: 'Linting check failed!',
buildResult: 'FAILURE',
stageResult: 'FAILURE'
) {
sh 'make lint'
}
}
}
}
stage('Tests') {
steps {
script {
sh 'make test'
}
}
}
} }
stage('Build') { stages {
stage('JSBundle') { stage('JSBundle') {
steps { steps {
script { ios.jsbundle() } script { ios.jsbundle() }
@ -91,9 +65,6 @@ pipeline {
script { api = ios.bundle() } script { api = ios.bundle() }
} }
} }
} }
}
}
stage('Parallel Upload') { stage('Parallel Upload') {
parallel { parallel {
stage('Archive') { stage('Archive') {
@ -102,8 +73,7 @@ pipeline {
} }
} }
stage('Upload') { stage('Upload') {
steps { steps { script {
script {
env.PKG_URL = s3.uploadArtifact(api) env.PKG_URL = s3.uploadArtifact(api)
jenkins.setBuildDesc(IPA: env.PKG_URL) jenkins.setBuildDesc(IPA: env.PKG_URL)
/* e2e builds get tested in SauceLabs */ /* e2e builds get tested in SauceLabs */
@ -112,21 +82,14 @@ pipeline {
} else { } else {
env.DIAWI_URL = ios.uploadToDiawi() env.DIAWI_URL = ios.uploadToDiawi()
} }
} }
} }
} }
} }
} }
}
stage('Cleanup') {
steps {
sh 'make watchman-clean'
sh 'make purge'
}
}
}
post { post {
success { script { github.notifyPR(true) } } success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } } failure { script { github.notifyPR(false) } }
always { sh 'make _fix-node-perms' } always { sh 'make purge' }
} }
} }

77
ci/Jenkinsfile.tests Normal file
View File

@ -0,0 +1,77 @@
library 'status-jenkins-lib@v1.5.0'
/* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild()
pipeline {
agent { label 'linux && x86_64 && nix-2.8' }
options {
timestamps()
/* Prevent Jenkins jobs from running forever */
timeout(time: 10, unit: 'MINUTES')
/* Limit builds retained */
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '20',
artifactNumToKeepStr: '10',
))
/* Abort old PR builds. */
disableConcurrentBuilds(
abortPrevious: isPRBuild
)
}
parameters {
string(
name: 'BUILD_TYPE',
description: 'Specify build type. Values: pr / e2e / nightly / release',
defaultValue: 'pr',
)
}
environment {
LANG = "en_US.UTF-8"
LC_ALL = "en_US.UTF-8"
LANGUAGE = "en_US.UTF-8"
TARGET = 'tests'
BUILD_ENV = 'prod'
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
LOG_FILE = utils.pkgFilename(ext: 'log', arch: 'tests')
}
stages {
stage('Prep') {
steps {
script {
btype = utils.getBuildType()
print "Running ${btype} build!"
/* Cleanup and Prep */
commonPrep(btype)
}
}
}
stage('Checks') {
parallel {
stage('Lint') {
steps { sh "make lint > ${LOG_FILE}" }
}
stage('Tests') {
steps { sh "make test >> ${LOG_FILE}" }
}
}
}
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' }
}
}