ef8bc88328
Change-Id: If26a005df45f6067240511d603fb4dd613f92b79
165 lines
6.8 KiB
Plaintext
165 lines
6.8 KiB
Plaintext
pipeline {
|
|
agent {
|
|
docker {
|
|
label 'main'
|
|
image docker.build("storj-ci", "https://github.com/storj/ci.git").id
|
|
args '-u root:root --cap-add SYS_PTRACE -v "/tmp/gomod":/go/pkg/mod -v "/tmp/npm":/tmp/npm'
|
|
}
|
|
}
|
|
options {
|
|
timeout(time: 26, unit: 'MINUTES')
|
|
}
|
|
environment {
|
|
NPM_CONFIG_CACHE = '/tmp/npm/cache'
|
|
}
|
|
stages {
|
|
stage('Build') {
|
|
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'
|
|
|
|
sh 'service postgresql start'
|
|
|
|
sh 'make -j3 build-packages'
|
|
sh 'make install-sim'
|
|
|
|
sh 'cockroach start --insecure --store=\'/tmp/crdb\' --listen-addr=localhost:26257 --http-addr=localhost:8080 --join=localhost:26257 --background'
|
|
sh 'cockroach init --insecure --host=localhost:26257'
|
|
}
|
|
}
|
|
|
|
|
|
stage('Verification') {
|
|
parallel {
|
|
stage('Lint') {
|
|
steps {
|
|
sh 'check-copyright'
|
|
sh 'check-large-files'
|
|
sh 'check-imports -race ./...'
|
|
sh 'check-peer-constraints -race'
|
|
sh 'storj-protobuf --protoc=$HOME/protoc/bin/protoc lint'
|
|
sh 'storj-protobuf --protoc=$HOME/protoc/bin/protoc check-lock'
|
|
sh 'check-atomic-align ./...'
|
|
sh 'check-errs ./...'
|
|
sh 'bash ./scripts/check-dbx-version.sh'
|
|
sh 'staticcheck ./...'
|
|
sh 'golangci-lint --config /go/ci/.golangci.yml -j=2 run'
|
|
sh 'check-mod-tidy -mod .build/go.mod.orig'
|
|
sh 'make check-satellite-config-lock'
|
|
sh 'make check-monitoring'
|
|
}
|
|
}
|
|
|
|
stage('Tests') {
|
|
environment {
|
|
STORJ_COCKROACH_TEST = 'cockroach://root@localhost:26257/testcockroach?sslmode=disable'
|
|
STORJ_POSTGRES_TEST = 'postgres://postgres@localhost/teststorj?sslmode=disable'
|
|
COVERFLAGS = "${ env.BRANCH_NAME != 'master' ? '' : '-coverprofile=.build/coverprofile -coverpkg=-coverpkg=storj.io/storj/private/...,storj.io/storj/lib/...,storj.io/storj/pkg/...,storj.io/storj/satellite/...,storj.io/storj/storage/...,storj.io/storj/storagenode/...,storj.io/storj/uplink/...,storj.io/storj/versioncontrol/...'}"
|
|
}
|
|
steps {
|
|
sh 'cockroach sql --insecure --host=localhost:26257 -e \'create database testcockroach;\''
|
|
sh 'psql -U postgres -c \'create database teststorj;\''
|
|
sh 'use-ports -from 1024 -to 10000 &'
|
|
sh 'go test -parallel 4 -p 6 -vet=off $COVERFLAGS -timeout 20m -json -race ./... 2>&1 | tee .build/tests.json | xunit -out .build/tests.xml'
|
|
sh 'check-clean-directory'
|
|
}
|
|
|
|
post {
|
|
always {
|
|
sh script: 'cat .build/tests.json | tparse -all -top -slow 100', returnStatus: true
|
|
archiveArtifacts artifacts: '.build/tests.json'
|
|
junit '.build/tests.xml'
|
|
|
|
script {
|
|
if(fileExists(".build/coverprofile")){
|
|
sh script: 'filter-cover-profile < .build/coverprofile > .build/clean.coverprofile', returnStatus: true
|
|
sh script: 'gocov convert .build/clean.coverprofile > .build/cover.json', returnStatus: true
|
|
sh script: 'gocov-xml < .build/cover.json > .build/cobertura.xml', returnStatus: true
|
|
cobertura coberturaReportFile: '.build/cobertura.xml'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Integration') {
|
|
environment {
|
|
// use different hostname to avoid port conflicts
|
|
STORJ_NETWORK_HOST4 = '127.0.0.2'
|
|
STORJ_NETWORK_HOST6 = '127.0.0.2'
|
|
|
|
STORJ_SIM_POSTGRES = 'postgres://postgres@localhost/teststorj2?sslmode=disable'
|
|
}
|
|
|
|
steps {
|
|
sh 'psql -U postgres -c \'create database teststorj2;\''
|
|
sh 'make test-sim'
|
|
// sh 'make test-certificates' // flaky
|
|
}
|
|
}
|
|
|
|
stage('Cockroach Integration') {
|
|
environment {
|
|
STORJ_NETWORK_HOST4 = '127.0.0.4'
|
|
STORJ_NETWORK_HOST6 = '127.0.0.4'
|
|
|
|
STORJ_SIM_POSTGRES = 'cockroach://root@localhost:26257/testcockroach4?sslmode=disable'
|
|
}
|
|
|
|
steps {
|
|
sh 'cockroach sql --insecure --host=localhost:26257 -e \'create database testcockroach4;\''
|
|
sh 'make test-sim'
|
|
}
|
|
}
|
|
|
|
stage('Backwards Compatibility') {
|
|
environment {
|
|
STORJ_NETWORK_HOST4 = '127.0.0.3'
|
|
STORJ_NETWORK_HOST6 = '127.0.0.3'
|
|
|
|
STORJ_SIM_POSTGRES = 'postgres://postgres@localhost/teststorj3?sslmode=disable'
|
|
}
|
|
|
|
steps {
|
|
sh 'psql -U postgres -c \'create database teststorj3;\''
|
|
sh 'make test-sim-backwards-compatible'
|
|
}
|
|
}
|
|
|
|
stage('Build [gomobile]') {
|
|
steps {
|
|
// just to verify its building with recent changes
|
|
sh '(cd .build && ./../lib/uplink-gomobile/build.sh)'
|
|
}
|
|
}
|
|
|
|
stage('npm') {
|
|
steps {
|
|
dir("web/satellite") {
|
|
sh 'npm run build'
|
|
sh 'npm run lint'
|
|
// TODO: reenable with vue4
|
|
sh script: 'npm audit', returnStatus: true
|
|
sh 'npm run test'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
always {
|
|
sh "chmod -R 777 ." // ensure Jenkins agent can delete the working directory
|
|
deleteDir()
|
|
}
|
|
}
|
|
}
|