build: improve npm build
Add go.mod to node_modules folder, that way Go compiler doesn't need to scan the node_module directories for any Go code. Change-Id: I747909416490c847d6b4bfa3438fea66660fcd53
This commit is contained in:
parent
05e165283f
commit
97e6e5a6a3
@ -35,10 +35,6 @@ pipeline {
|
||||
|
||||
// pre-check that we cannot do at a later stage reliably
|
||||
sh 'check-large-files'
|
||||
|
||||
// add a stub go.mod file to node projects to prevent go build ./... from scanning them
|
||||
sh 'mkdir -p web/satellite/node_modules web/storagenode/node_modules web/multinode/node_modules'
|
||||
sh 'touch web/satellite/node_modules/go.mod web/storagenode/node_modules/go.mod web/multinode/node_modules/go.mod'
|
||||
}
|
||||
}
|
||||
stage('Build Web') {
|
||||
|
@ -35,10 +35,6 @@ pipeline {
|
||||
|
||||
// pre-check that we cannot do at a later stage reliably
|
||||
sh 'check-large-files'
|
||||
|
||||
// add a stub go.mod file to node projects to prevent go build ./... from scanning them
|
||||
sh 'mkdir -p web/satellite/node_modules web/storagenode/node_modules web/multinode/node_modules'
|
||||
sh 'touch web/satellite/node_modules/go.mod web/storagenode/node_modules/go.mod web/multinode/node_modules/go.mod'
|
||||
}
|
||||
}
|
||||
stage('Gerrit status') {
|
||||
@ -93,7 +89,8 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build Web') {
|
||||
|
||||
stage('Build and Lint Web') {
|
||||
// The build code depends on the following assets being loaded.
|
||||
parallel {
|
||||
stage('web/satellite') {
|
||||
@ -158,99 +155,91 @@ pipeline {
|
||||
sh 'npm ci --prefer-offline --no-audit'
|
||||
sh 'npm run build'
|
||||
sh script: 'npm audit', returnStatus: true
|
||||
sh 'npm run check'
|
||||
sh 'npm run lint'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'check-mod-tidy'
|
||||
sh 'check-copyright'
|
||||
sh 'check-imports -race ./...'
|
||||
sh 'check-peer-constraints -race'
|
||||
sh 'check-atomic-align ./...'
|
||||
sh 'check-monkit ./...'
|
||||
sh 'check-errs ./...'
|
||||
sh 'staticcheck ./...'
|
||||
sh 'golangci-lint --config /go/ci/.golangci.yml -j=2 run'
|
||||
sh 'make check-monitoring'
|
||||
sh 'make test-wasm-size'
|
||||
stage('Lint') {
|
||||
steps {
|
||||
sh 'check-mod-tidy'
|
||||
sh 'check-copyright'
|
||||
sh 'check-imports -race ./...'
|
||||
sh 'check-peer-constraints -race'
|
||||
sh 'check-atomic-align ./...'
|
||||
sh 'check-monkit ./...'
|
||||
sh 'check-errs ./...'
|
||||
sh 'staticcheck ./...'
|
||||
sh 'golangci-lint --config /go/ci/.golangci.yml -j=2 run'
|
||||
sh 'make check-monitoring'
|
||||
sh 'make test-wasm-size'
|
||||
|
||||
sh 'protolock status'
|
||||
sh 'protolock status'
|
||||
|
||||
dir("testsuite/ui") {
|
||||
sh 'check-imports ./...'
|
||||
sh 'check-atomic-align ./...'
|
||||
sh 'check-monkit ./...'
|
||||
sh 'check-errs ./...'
|
||||
sh 'staticcheck ./...'
|
||||
sh 'golangci-lint --config /go/ci/.golangci.yml -j=2 run'
|
||||
}
|
||||
|
||||
sh './scripts/check-package-lock.sh'
|
||||
}
|
||||
dir("testsuite/ui") {
|
||||
sh 'check-imports ./...'
|
||||
sh 'check-atomic-align ./...'
|
||||
sh 'check-monkit ./...'
|
||||
sh 'check-errs ./...'
|
||||
sh 'staticcheck ./...'
|
||||
sh 'golangci-lint --config /go/ci/.golangci.yml -j=2 run'
|
||||
}
|
||||
stage('Lint Admin UI') {
|
||||
when {
|
||||
changeset "satellite/admin/ui"
|
||||
}
|
||||
steps {
|
||||
dir("satellite/admin/ui") {
|
||||
sh 'npm run check'
|
||||
sh 'npm run lint'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Tests') {
|
||||
environment {
|
||||
STORJ_TEST_HOST = '127.0.0.20;127.0.0.21;127.0.0.22;127.0.0.23;127.0.0.24;127.0.0.25'
|
||||
STORJ_TEST_COCKROACH = 'cockroach://root@localhost:26256/testcockroach?sslmode=disable;' +
|
||||
'cockroach://root@localhost:26257/testcockroach?sslmode=disable;' +
|
||||
'cockroach://root@localhost:26258/testcockroach?sslmode=disable;' +
|
||||
'cockroach://root@localhost:26259/testcockroach?sslmode=disable'
|
||||
STORJ_TEST_COCKROACH_NODROP = 'true'
|
||||
STORJ_TEST_COCKROACH_ALT = 'cockroach://root@localhost:26260/testcockroach?sslmode=disable'
|
||||
STORJ_TEST_POSTGRES = 'postgres://postgres@localhost/teststorj?sslmode=disable'
|
||||
STORJ_TEST_LOG_LEVEL = 'info'
|
||||
COVERFLAGS = "${ env.BRANCH_NAME == 'main' ? '-coverprofile=.build/coverprofile -coverpkg=storj.io/storj/private/...,storj.io/storj/satellite/...,storj.io/storj/storage/...,storj.io/storj/storagenode/...,storj.io/storj/versioncontrol/...' : ''}"
|
||||
}
|
||||
steps {
|
||||
sh 'cockroach sql --insecure --host=localhost:26256 -e \'create database testcockroach;\''
|
||||
sh 'cockroach sql --insecure --host=localhost:26257 -e \'create database testcockroach;\''
|
||||
sh 'cockroach sql --insecure --host=localhost:26258 -e \'create database testcockroach;\''
|
||||
sh 'cockroach sql --insecure --host=localhost:26259 -e \'create database testcockroach;\''
|
||||
sh 'cockroach sql --insecure --host=localhost:26260 -e \'create database testcockroach;\''
|
||||
|
||||
sh 'psql -U postgres -c \'create database teststorj;\''
|
||||
|
||||
sh 'use-ports -from 1024 -to 10000 &'
|
||||
|
||||
sh 'go test -tags noembed -parallel 4 -p 6 -vet=off $COVERFLAGS -timeout 32m -json -race ./... 2>&1 | tee .build/tests.json | xunit -out .build/tests.xml'
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
archiveArtifacts artifacts: '.build/tests.json'
|
||||
sh script: 'cat .build/tests.json | tparse -all -top -slow 100', returnStatus: true
|
||||
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',
|
||||
lineCoverageTargets: '70, 60, 50',
|
||||
autoUpdateHealth: false,
|
||||
autoUpdateStability: false,
|
||||
failUnhealthy: true
|
||||
}
|
||||
}
|
||||
|
||||
sh './scripts/check-package-lock.sh'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Tests') {
|
||||
environment {
|
||||
STORJ_TEST_HOST = '127.0.0.20;127.0.0.21;127.0.0.22;127.0.0.23;127.0.0.24;127.0.0.25'
|
||||
STORJ_TEST_COCKROACH = 'cockroach://root@localhost:26256/testcockroach?sslmode=disable;' +
|
||||
'cockroach://root@localhost:26257/testcockroach?sslmode=disable;' +
|
||||
'cockroach://root@localhost:26258/testcockroach?sslmode=disable;' +
|
||||
'cockroach://root@localhost:26259/testcockroach?sslmode=disable'
|
||||
STORJ_TEST_COCKROACH_NODROP = 'true'
|
||||
STORJ_TEST_COCKROACH_ALT = 'cockroach://root@localhost:26260/testcockroach?sslmode=disable'
|
||||
STORJ_TEST_POSTGRES = 'postgres://postgres@localhost/teststorj?sslmode=disable'
|
||||
STORJ_TEST_LOG_LEVEL = 'info'
|
||||
COVERFLAGS = "${ env.BRANCH_NAME == 'main' ? '-coverprofile=.build/coverprofile -coverpkg=storj.io/storj/private/...,storj.io/storj/satellite/...,storj.io/storj/storage/...,storj.io/storj/storagenode/...,storj.io/storj/versioncontrol/...' : ''}"
|
||||
}
|
||||
steps {
|
||||
sh 'cockroach sql --insecure --host=localhost:26256 -e \'create database testcockroach;\''
|
||||
sh 'cockroach sql --insecure --host=localhost:26257 -e \'create database testcockroach;\''
|
||||
sh 'cockroach sql --insecure --host=localhost:26258 -e \'create database testcockroach;\''
|
||||
sh 'cockroach sql --insecure --host=localhost:26259 -e \'create database testcockroach;\''
|
||||
sh 'cockroach sql --insecure --host=localhost:26260 -e \'create database testcockroach;\''
|
||||
|
||||
sh 'psql -U postgres -c \'create database teststorj;\''
|
||||
|
||||
sh 'use-ports -from 1024 -to 10000 &'
|
||||
|
||||
sh 'go test -tags noembed -parallel 4 -p 6 -vet=off $COVERFLAGS -timeout 32m -json -race ./... 2>&1 | tee .build/tests.json | xunit -out .build/tests.xml'
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
archiveArtifacts artifacts: '.build/tests.json'
|
||||
sh script: 'cat .build/tests.json | tparse -all -top -slow 100', returnStatus: true
|
||||
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',
|
||||
lineCoverageTargets: '70, 60, 50',
|
||||
autoUpdateHealth: false,
|
||||
autoUpdateStability: false,
|
||||
failUnhealthy: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Post') {
|
||||
parallel {
|
||||
|
3
satellite/admin/ui/.gitignore
vendored
3
satellite/admin/ui/.gitignore
vendored
@ -6,3 +6,6 @@ node_modules
|
||||
/package
|
||||
.env
|
||||
.env.*
|
||||
|
||||
# Stub for Go to avoid scanning node_modules.
|
||||
!node_modules/go.mod
|
5
satellite/admin/ui/node_modules/go.mod
vendored
Normal file
5
satellite/admin/ui/node_modules/go.mod
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
module storj.io/storj/satellite/admin/ui/node_modules
|
||||
|
||||
go 1.17
|
||||
|
||||
// Stub module to prevent Go from scanning node_modules directory.
|
3
web/multinode/.gitignore
vendored
3
web/multinode/.gitignore
vendored
@ -24,3 +24,6 @@ yarn-error.log*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw*
|
||||
|
||||
# Stub for Go to avoid scanning node_modules.
|
||||
!node_modules/go.mod
|
5
web/multinode/node_modules/go.mod
vendored
Normal file
5
web/multinode/node_modules/go.mod
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
module storj.io/storj/web/multinode/node_modules
|
||||
|
||||
go 1.17
|
||||
|
||||
// Stub module to prevent Go from scanning node_modules directory.
|
3
web/satellite/.gitignore
vendored
3
web/satellite/.gitignore
vendored
@ -30,3 +30,6 @@ yarn-error.log*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw*
|
||||
|
||||
# Stub for Go to avoid scanning node_modules.
|
||||
!node_modules/go.mod
|
5
web/satellite/node_modules/go.mod
vendored
Normal file
5
web/satellite/node_modules/go.mod
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
module storj.io/storj/web/satellite/node_modules
|
||||
|
||||
go 1.17
|
||||
|
||||
// Stub module to prevent Go from scanning node_modules directory.
|
3
web/storagenode/.gitignore
vendored
3
web/storagenode/.gitignore
vendored
@ -24,3 +24,6 @@ yarn-error.log*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw*
|
||||
|
||||
# Stub for Go to avoid scanning node_modules.
|
||||
!node_modules/go.mod
|
5
web/storagenode/node_modules/go.mod
vendored
Normal file
5
web/storagenode/node_modules/go.mod
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
module storj.io/storj/web/storagenode/node_modules
|
||||
|
||||
go 1.17
|
||||
|
||||
// Stub module to prevent Go from scanning node_modules directory.
|
Loading…
Reference in New Issue
Block a user