jenkins: build and test web/satellite (#2908)
This commit is contained in:
parent
15e52e0985
commit
c4ee7eb51c
@ -4,8 +4,9 @@ FROM golang:1.12.9
|
|||||||
|
|
||||||
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
||||||
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
|
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
|
||||||
|
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y -qq postgresql-11 redis-server unzip libuv1-dev libjson-c-dev nettle-dev
|
RUN apt-get update && apt-get install -y -qq postgresql-11 redis-server unzip libuv1-dev libjson-c-dev nettle-dev nodejs
|
||||||
|
|
||||||
RUN rm /etc/postgresql/11/main/pg_hba.conf; \
|
RUN rm /etc/postgresql/11/main/pg_hba.conf; \
|
||||||
echo 'local all all trust' >> /etc/postgresql/11/main/pg_hba.conf; \
|
echo 'local all all trust' >> /etc/postgresql/11/main/pg_hba.conf; \
|
||||||
|
@ -2,13 +2,16 @@ pipeline {
|
|||||||
agent {
|
agent {
|
||||||
dockerfile {
|
dockerfile {
|
||||||
filename 'Dockerfile.jenkins'
|
filename 'Dockerfile.jenkins'
|
||||||
args '-u root:root --cap-add SYS_PTRACE -v "/tmp/gomod":/go/pkg/mod'
|
args '-u root:root --cap-add SYS_PTRACE -v "/tmp/gomod":/go/pkg/mod -v "/tmp/npm":/tmp/npm'
|
||||||
label 'main'
|
label 'main'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
options {
|
options {
|
||||||
timeout(time: 14, unit: 'MINUTES')
|
timeout(time: 14, unit: 'MINUTES')
|
||||||
}
|
}
|
||||||
|
environment {
|
||||||
|
NPM_CONFIG_CACHE = '/tmp/npm/cache'
|
||||||
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
@ -21,7 +24,7 @@ pipeline {
|
|||||||
// download dependencies
|
// download dependencies
|
||||||
sh 'go mod download'
|
sh 'go mod download'
|
||||||
|
|
||||||
sh 'make -j2 build-packages'
|
sh 'make -j3 build-packages'
|
||||||
sh 'make install-sim'
|
sh 'make install-sim'
|
||||||
|
|
||||||
sh 'service postgresql start'
|
sh 'service postgresql start'
|
||||||
@ -106,6 +109,18 @@ pipeline {
|
|||||||
sh 'make test-sim-backwards-compatible'
|
sh 'make test-sim-backwards-compatible'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
Makefile
4
Makefile
@ -72,11 +72,13 @@ proto: ## Rebuild protobuf files
|
|||||||
go run scripts/protobuf.go generate
|
go run scripts/protobuf.go generate
|
||||||
|
|
||||||
.PHONY: build-packages
|
.PHONY: build-packages
|
||||||
build-packages: build-packages-race build-packages-normal ## Test docker images locally
|
build-packages: build-packages-race build-packages-normal build-npm ## Test docker images locally
|
||||||
build-packages-race:
|
build-packages-race:
|
||||||
go install -v ./...
|
go install -v ./...
|
||||||
build-packages-normal:
|
build-packages-normal:
|
||||||
go install -v -race ./...
|
go install -v -race ./...
|
||||||
|
build-npm:
|
||||||
|
cd web/satellite && npm ci
|
||||||
|
|
||||||
##@ Simulator
|
##@ Simulator
|
||||||
|
|
||||||
|
@ -23,7 +23,14 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
leftover := strings.Split(strings.TrimSpace(string(out)), "\n")
|
leftover := strings.Split(strings.TrimSpace(string(out)), "\n")
|
||||||
leftover = ignoreDir(leftover, ".build")
|
leftover = ignorePrefix(leftover, ".build")
|
||||||
|
|
||||||
|
// there's no easy way to modify npm to use tmp folders
|
||||||
|
leftover = ignorePrefix(leftover, "web/satellite/node_modules/")
|
||||||
|
leftover = ignorePrefix(leftover, "web/satellite/coverage/")
|
||||||
|
leftover = ignorePrefix(leftover, "web/satellite/dist/")
|
||||||
|
// TODO: shouldn't this be already up to date?
|
||||||
|
leftover = ignorePrefix(leftover, "web/satellite/package-lock.json")
|
||||||
|
|
||||||
if len(leftover) != 0 {
|
if len(leftover) != 0 {
|
||||||
fmt.Println("Files left-over after running tests:")
|
fmt.Println("Files left-over after running tests:")
|
||||||
@ -34,7 +41,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ignoreDir(files []string, dir string) []string {
|
func ignorePrefix(files []string, dir string) []string {
|
||||||
result := files[:0]
|
result := files[:0]
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if file == "" {
|
if file == "" {
|
||||||
|
@ -20,6 +20,13 @@ var checkFiles = map[string]bool{
|
|||||||
".vue": true,
|
".vue": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ignoreFolder = map[string]bool{
|
||||||
|
".git": true,
|
||||||
|
"node_modules": true,
|
||||||
|
"coverage": true,
|
||||||
|
"dist": true,
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var failed int
|
var failed int
|
||||||
|
|
||||||
@ -28,7 +35,7 @@ func main() {
|
|||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if info.IsDir() && info.Name() == ".git" {
|
if info.IsDir() && ignoreFolder[info.Name()] {
|
||||||
return filepath.SkipDir
|
return filepath.SkipDir
|
||||||
}
|
}
|
||||||
if !checkFiles[filepath.Ext(path)] {
|
if !checkFiles[filepath.Ext(path)] {
|
||||||
|
@ -13,6 +13,13 @@ import (
|
|||||||
"storj.io/storj/internal/memory"
|
"storj.io/storj/internal/memory"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var ignoreFolder = map[string]bool{
|
||||||
|
".git": true,
|
||||||
|
"node_modules": true,
|
||||||
|
"coverage": true,
|
||||||
|
"dist": true,
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
const fileSizeLimit = 600 * memory.KB
|
const fileSizeLimit = 600 * memory.KB
|
||||||
|
|
||||||
@ -23,7 +30,7 @@ func main() {
|
|||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if info.IsDir() && info.Name() == ".git" {
|
if info.IsDir() && ignoreFolder[info.Name()] {
|
||||||
return filepath.SkipDir
|
return filepath.SkipDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,14 @@ var ignoreProto = map[string]bool{
|
|||||||
"gogo.proto": true,
|
"gogo.proto": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ignoreDir = map[string]bool{
|
||||||
|
".git": true,
|
||||||
|
".build": true,
|
||||||
|
"node_modules": true,
|
||||||
|
"coverage": true,
|
||||||
|
"dist": true,
|
||||||
|
}
|
||||||
|
|
||||||
var protoc = flag.String("protoc", "protoc", "protoc location")
|
var protoc = flag.String("protoc", "protoc", "protoc location")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -306,7 +314,7 @@ func listProtoFiles(root string) ([]string, error) {
|
|||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if info.IsDir() && info.Name() == ".git" {
|
if info.IsDir() && ignoreDir[info.Name()] {
|
||||||
return filepath.SkipDir
|
return filepath.SkipDir
|
||||||
}
|
}
|
||||||
if filepath.Ext(path) == ".proto" {
|
if filepath.Ext(path) == ".proto" {
|
||||||
|
Loading…
Reference in New Issue
Block a user