ci: clearer initial build

We can run a lot of the code building and downloading steps in parallel.
We were using Makefile, however, that doesn't integrate with Jenkins,
which means, when there's a failure, you have no clue where.

This separates the concurrent build steps and makes it clear what we are
running concurrently.

Change-Id: I1c1dccd09dab67d2ef428a58d5eb9e004b11a74c
This commit is contained in:
Egon Elbre 2021-06-09 14:50:57 +03:00
parent 072dd24696
commit 1cd13adc1c

View File

@ -15,24 +15,49 @@ pipeline {
COCKROACH_MEMPROF_INTERVAL=0
}
stages {
stage('Build') {
stage('Checkout') {
steps {
checkout scm
sh 'mkdir -p .build'
// make a backup of the mod file in case, for later linting
sh 'cp go.mod .build/go.mod.orig'
// download dependencies
sh 'go mod download'
}
}
stage('Build') {
parallel {
stage('go') {
steps {
sh 'go build -v ./...'
}
}
stage('go -race') {
steps {
sh 'go build -v -race ./...'
// install storj-sim
sh 'go install -race -v storj.io/storj/cmd/satellite '+
'storj.io/storj/cmd/storagenode ' +
'storj.io/storj/cmd/storj-sim ' +
'storj.io/storj/cmd/versioncontrol ' +
'storj.io/storj/cmd/uplink ' +
'storj.io/storj/cmd/identity ' +
'storj.io/storj/cmd/certificates ' +
'storj.io/storj/cmd/multinode'
}
}
stage('go -race gateway') {
steps {
// install gateway for storj-sim
sh 'go install -race -v storj.io/gateway@latest'
}
}
stage('db') {
steps {
sh 'service postgresql start'
sh 'make -j4 build-packages'
sh 'make install-sim'
dir(".build") {
dir('.build') {
sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26256 --http-addr=localhost:8086 --cache 512MiB --max-sql-memory 512MiB --background'
sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26257 --http-addr=localhost:8087 --cache 512MiB --max-sql-memory 512MiB --background'
sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26258 --http-addr=localhost:8088 --cache 512MiB --max-sql-memory 512MiB --background'
@ -42,6 +67,33 @@ pipeline {
}
}
stage('web/satellite') {
steps {
dir('web/satellite') {
sh 'npm ci --prefer-offline --no-audit'
sh 'npm run build'
}
}
}
stage('web/storagenode') {
steps {
dir('web/storagenode') {
sh 'npm ci --prefer-offline --no-audit'
sh 'npm run build'
}
}
}
stage('web/multinode') {
steps {
dir('web/multinode') {
sh 'npm ci --prefer-offline --no-audit'
sh 'npm run build'
}
}
}
}
}
stage('Verification') {
parallel {
stage('Lint') {
@ -204,17 +256,6 @@ pipeline {
}
}
stage('satellite npm') {
steps {
dir("web/satellite") {
sh 'npm run build'
sh 'npm run lint'
sh script: 'npm audit', returnStatus: true
sh 'npm run test'
}
}
}
stage('wasm npm') {
steps {
dir(".build") {
@ -225,10 +266,9 @@ pipeline {
}
}
stage('storagenode npm') {
stage('web/satellite') {
steps {
dir("web/storagenode") {
sh 'npm run build'
dir("web/satellite") {
sh 'npm run lint'
sh script: 'npm audit', returnStatus: true
sh 'npm run test'
@ -236,10 +276,19 @@ pipeline {
}
}
stage('multinode npm') {
stage('web/storagenode') {
steps {
dir("web/storagenode") {
sh 'npm run lint'
sh script: 'npm audit', returnStatus: true
sh 'npm run test'
}
}
}
stage('web/multinode') {
steps {
dir("web/multinode") {
sh 'npm run build'
sh 'npm run lint'
sh script: 'npm audit', returnStatus: true
sh 'npm run test'