Skip to content

Instantly share code, notes, and snippets.

@sunnykrGupta
Forked from truongsinh/.gitlab-ci.yml
Created October 2, 2019 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunnykrGupta/e6f55d59f1d7047cbf89f74c7cd6c1b1 to your computer and use it in GitHub Desktop.
Save sunnykrGupta/e6f55d59f1d7047cbf89f74c7cd6c1b1 to your computer and use it in GitHub Desktop.
before_script:
- export GOPATH=$(pwd)
stages:
- build
- test
- deploy
validate-schema:
image: truongsinh/pg-client:9.4
services:
- postgres:9.4
stage: build
script:
- sql/validate.sh
format:
image: golang:1.5
stage: build
script:
- go get golang.org/x/tools/cmd/goimports
# If formatted is different than committed, exit with error
# goimports -w src/smarpshare/
- (if [ "$(bin/goimports -d src/smarpshare/)" == "" ]; then echo "Good format"; else echo "Bad format"; exit 33; fi);
# goimports -w src/*.go
- (if [ "$(bin/goimports -d src/*.go)" == "" ]; then echo "Good format"; else echo "Bad format"; exit 33; fi);
vet:
image: golang:1.5
stage: build
script:
# Vet dir src/smarpshare, dont care about unkeyed composites
- go tool vet -composites=false src/smarpshare
# Vet files in src/, dont care about unkeyed composites
- go tool vet -composites=false -shadow=true src/*.go
compile-go-1.4:
image: golang:1.4
stage: build
script:
- git submodule update --init
# Cannot use go build src/*.go
# Loop through src/*.go, go build, if exit code is not 0, then exit 66
- (for f in src/*.go; do echo "-> go build $f"; go build $f; if [ $? -ne 0 ]; then exit 66; fi; done);
compile-go-1.5:
image: golang:1.5
stage: build
script:
- git submodule update --init
# Cannot use go build src/*.go
# Loop through src/*.go, go build, if exit code is not 0, then exit 66
- (for f in src/*.go; do echo "-> go build $f"; go build $f; if [ $? -ne 0 ]; then exit 66; fi; done);
test-go-1.4:
image: golang:1.4
services:
- postgres:9.4
- truongsinh/rethinkdb:2.1.3
stage: test
script:
- git submodule update --init
- go run sql/latest_schema.sql.go
- go test -race -p 1 smarpshare/...
test-go-1.5-no-race:
image: golang:1.5
services:
- postgres:9.4
- truongsinh/rethinkdb:2.1.3
stage: test
script:
- git submodule update --init
- go run sql/latest_schema.sql.go
- go test -p 1 smarpshare/...
test-go-1.5:
image: golang:1.5
services:
- postgres:9.4
- truongsinh/rethinkdb:2.1.3
stage: test
script:
- git submodule update --init
- go run sql/latest_schema.sql.go
- go test -race -p 1 smarpshare/...
allow_failure: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment