diff --git a/.travis.yml b/.travis.yml index baf9ac2f45..d21d15aed1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,9 +37,7 @@ jobs: - npm run lint - name: Backend Lint before_script: - - curl -sL -o ~/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme - - chmod +x ~/bin/gimme - - eval "$(gimme 1.13.4)" + - "./deploy/ci/travis/install-go.sh" - go get -u golang.org/x/lint/golint script: - golint src/jetstream/... @@ -58,12 +56,8 @@ jobs: - npm run test - npm run codecov - name: Backend Unit Tests - before_script: - - curl -sL -o ~/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme - - chmod +x ~/bin/gimme - - eval "$(gimme 1.13.4)" script: - - npm run test-backend + - "./deploy/ci/travis/run-backend-tests.sh" - name: Helm Chart Unit Tests script: - "./deploy/ci/travis/helm-chart-unit-tests.sh" diff --git a/build/bk-build.sh b/build/bk-build.sh index 5b7c0a599f..630f54f86a 100755 --- a/build/bk-build.sh +++ b/build/bk-build.sh @@ -29,19 +29,21 @@ fi # Build backend or run tests pushd "${STRATOS}/src/jetstream" > /dev/null +# Show go env +go env + +# Need to install swag in both cases +echo "Generating OpenAPI documentation..." +go get github.com/swaggo/swag/cmd/swag +swag init + if [ "${ACTION}" == "build" ]; then echo "Building backend ..." - echo "Generating OpenAPI documentation..." - go get github.com/swaggo/swag/cmd/swag - swag init echo "Building version: ${VERSION}" GO111MODULE=on go build -ldflags -X=main.appVersion=${VERSION} echo "Build complete ..." else echo "Running backend tests ..." - echo "Generating OpenAPI documentation..." - go get github.com/swaggo/swag/cmd/swag - swag init GO111MODULE=on go test ./... -v -count=1 fi diff --git a/deploy/ci/travis/e2e-build-script.sh b/deploy/ci/travis/e2e-build-script.sh index 084286483d..bcd396194f 100755 --- a/deploy/ci/travis/e2e-build-script.sh +++ b/deploy/ci/travis/e2e-build-script.sh @@ -61,10 +61,7 @@ else set -e # Get go - curl -sL -o ~/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme - chmod +x ~/bin/gimme - eval "$(gimme 1.13.4)" - go version + source "${DIRNAME}/install-go.sh" npm run build npm run build-backend diff --git a/deploy/ci/travis/install-go.sh b/deploy/ci/travis/install-go.sh new file mode 100755 index 0000000000..1bafd23283 --- /dev/null +++ b/deploy/ci/travis/install-go.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "Installing GO ..." +curl -sL -o ~/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme +chmod +x ~/bin/gimme +eval "$(gimme 1.13.4)" +go version diff --git a/deploy/ci/travis/run-backend-tests.sh b/deploy/ci/travis/run-backend-tests.sh new file mode 100755 index 0000000000..c36461abcf --- /dev/null +++ b/deploy/ci/travis/run-backend-tests.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +DIRNAME="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${DIRNAME}/install-go.sh" + +npm run test-backend