From 76ced401f0b6f87277b4612586d7a124d823a5b0 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Thu, 28 Oct 2021 21:18:13 +1000 Subject: [PATCH] chore(build): reduce the time to run yarn build:server from 1.5minutes, to 10 seconds (#5987) * reduce the time to run yarn build:server from 1.5minutes, to 10 seconds Signed-off-by: Sven Dowideit * add yarn test:server Signed-off-by: Sven Dowideit --- build/build_binary.sh | 15 ++++++++++----- package.json | 3 ++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/build/build_binary.sh b/build/build_binary.sh index b9fe6509c..24715d378 100755 --- a/build/build_binary.sh +++ b/build/build_binary.sh @@ -1,9 +1,14 @@ -binary="portainer" +set -x + mkdir -p dist -cd 'api/cmd/portainer' - +cd api +# the go get adds 8 seconds go get -t -d -v ./... -GOOS=$1 GOARCH=$2 CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags '-s' -mv "${binary}" "../../../dist/portainer" \ No newline at end of file +# the build takes 2 seconds +GOOS=$1 GOARCH=$2 CGO_ENABLED=0 go build \ + --installsuffix cgo \ + --ldflags '-s' \ + -o "../dist/portainer" \ + ./cmd/portainer/ diff --git a/package.json b/package.json index a67a7b332..ac1615932 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "format": "prettier --loglevel warn --write \"**/*.{js,css,html}\"", "lint": "yarn lint:client; yarn lint:server", "lint:server": "cd api && golangci-lint run -E exportloopref", - "lint:client": "eslint --cache --fix ." + "lint:client": "eslint --cache --fix .", + "test:server": "cd api && go test ./..." }, "scriptsComments": { "build": "Build the entire app (backend/frontend) in development mode",