pipeline { agent { docker { label 'main' image docker.build("storj-ci", "--pull git://github.com/storj/ci.git#main").id args '-u root:root --cap-add SYS_PTRACE -v "/tmp/gomod":/go/pkg/mod -v "/tmp/npm":/npm --tmpfs "/tmp:exec,mode=777"' } } options { timeout(time: 40, unit: 'MINUTES') } environment { NPM_CONFIG_CACHE = '/npm/cache' GOTRACEBACK = 'all' COCKROACH_MEMPROF_INTERVAL=0 } stages { stage('Build') { steps { checkout scm sh 'mkdir -p .build' sh 'go mod download' sh 'service postgresql start' 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' } } } stage('UI') { environment { STORJ_TEST_COCKROACH = 'cockroach://root@localhost:26256/testui?sslmode=disable' STORJ_TEST_POSTGRES = 'postgres://postgres@localhost/testui?sslmode=disable' STORJ_TEST_BROWSER = '/usr/bin/chromium' STORJ_TEST_SATELLITE_WEB = "${pwd()}/.build/satellite-web" DISPLAY = ':99' } steps { sh 'cockroach sql --insecure --host=localhost:26256 -e \'create database testui;\'' sh 'psql -U postgres -c \'create database testui;\'' sh 'cp -r ./web/satellite/ ${STORJ_TEST_SATELLITE_WEB}/' // TODO: this is not quite correct sh 'mkdir ${STORJ_TEST_SATELLITE_WEB}/wasm' sh 'cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" ${STORJ_TEST_SATELLITE_WEB}/wasm/wasm_exec.js' sh 'GOOS=js GOARCH=wasm go build -o ${STORJ_TEST_SATELLITE_WEB}/wasm/main.wasm storj.io/storj/satellite/console/wasm' sh 'cd .build/satellite-web && npm install' sh 'cd .build/satellite-web && npm run build' sh 'Xvfb -ac :99 -screen 0 1280x1024x16 &' sh 'cd testsuite && go test -vet=off -race -json ./ui/... 2>&1 | tee ../.build/ui-tests.json | xunit -out ../.build/ui-tests.xml' } post { always { sh script: 'cat .build/ui-tests.json | tparse -all -top -slow 100', returnStatus: true archiveArtifacts artifacts: '.build/ui-tests.json' junit '.build/ui-tests.xml' } } } } post { always { sh "chmod -R 777 ." // ensure Jenkins agent can delete the working directory deleteDir() } } }