Skip to content

Commit

Permalink
Travis: Tidy up go installation to ensure consistent version (#4687)
Browse files Browse the repository at this point in the history
* Fix GOPROXY issue

* Unset goproxy

* Remvoe unset go env

* Run backend tests via script

* Fix typo in installation
  • Loading branch information
nwmac authored Oct 14, 2020
1 parent 8b3dab5 commit 306b215
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
10 changes: 2 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/...
Expand All @@ -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"
Expand Down
14 changes: 8 additions & 6 deletions build/bk-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 1 addition & 4 deletions deploy/ci/travis/e2e-build-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions deploy/ci/travis/install-go.sh
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions deploy/ci/travis/run-backend-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

DIRNAME="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${DIRNAME}/install-go.sh"

npm run test-backend

0 comments on commit 306b215

Please sign in to comment.