Update go-jet to support CircleCi build.

This commit is contained in:
go-jet 2019-06-21 16:16:57 +02:00
parent 17f6bab2e7
commit 454cd6f12b
16 changed files with 297 additions and 251 deletions

View file

@ -6,21 +6,62 @@ jobs:
build:
docker:
# specify the version
- image: circleci/golang:1.9
- image: circleci/golang:1.11
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4
- image: circleci/postgres:10.6-alpine
environment: # environment variables for primary container
POSTGRES_USER: jet
POSTGRES_PASSWORD: jet
POSTGRES_DB: jetdb
working_directory: /go/src/github.com/go-jet/jet
environment: # environment variables for the build itself
TEST_RESULTS: /tmp/test-results # path to where test results will be saved
#### TEMPLATE_NOTE: go expects specific checkout path representing url
#### expecting it in the form of
#### /go/src/github.com/circleci/go-tool
#### /go/src/bitbucket.org/circleci/go-tool
working_directory: /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}}
steps:
- checkout
# specify any bash command here prefixed with `run: `
- run: go get -v -t -d ./...
- run: go test -v ./...
- run:
name: Install dependencies
command: |
go get github.com/google/uuid
go get github.com/lib/pq
go get github.com/serenize/snaker
go get github.com/pkg/profile
go get gotest.tools/assert
go get github.com/davecgh/go-spew/spew
go get github.com/jstemmer/go-junit-report
- run: mkdir -p $TEST_RESULTS/unit-tests
- run: mkdir -p $TEST_RESULTS/integration-tests
- run: go test -v 2>&1 | go-junit-report > $TEST_RESULTS/unit-tests/results.xml
- run:
name: Waiting for Postgres to be ready
command: |
for i in `seq 1 10`;
do
nc -z localhost 5432 && echo Success && exit 0
echo -n .
sleep 1
done
echo Failed waiting for Postgres && exit 1
- run:
name: Run integration tests
command: |
cd tests
go run ./init/init.go
go test -v 2>&1 | go-junit-report > $TEST_RESULTS/integration-tests/results.xml
cd ..
- store_artifacts: # Upload test summary for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
path: /tmp/test-results
destination: raw-test-output
- store_test_results: # Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/
path: /tmp/test-results