github.com/diamondburned/arikawa/v2@v2.1.0/.gitlab-ci.yml (about) 1 { 2 "image": "golang:alpine", 3 "variables": { 4 "GO111MODULE": "on", 5 "CGO_ENABLED": "1", # for the race detector 6 "COV": "/tmp/cov_results", 7 "dismock": "github.com/mavolin/dismock/v2/pkg/dismock", 8 "dismock_v": "259685b84e4b6ab364b0fd858aac2aa2dfa42502", 9 # used only in integration_test 10 "tested": "./api,./gateway,./bot,./discord" 11 }, 12 "before_script": [ 13 "apk add git build-base" 14 ], 15 "stages": [ 16 "build", 17 "test" 18 ], 19 "build_test": { 20 "stage": "build", 21 "script": [ 22 "go build ./..." 23 ] 24 }, 25 "unit_test": { 26 "stage": "test", 27 "timeout": "2m", # 2 minutes 28 # Don't run the test if we have a $BOT_TOKEN, because 29 # integration_test will run instead. 30 "except": { 31 "variables": [ "$BOT_TOKEN" ] 32 }, 33 "script": [ 34 "go test -coverprofile $COV -tags unitonly -race ./...", 35 "go tool cover -func $COV" 36 ] 37 }, 38 "integration_test": { 39 "stage": "test", 40 "timeout": "5m", # 5 minutes 41 # Run the test only if we have $BOT_TOKEN, else fallback to unit 42 # tests. 43 "only": { 44 "variables": [ "$BOT_TOKEN", "$CHANNEL_ID", "$VOICE_ID" ] 45 }, 46 "script": [ 47 "go get ./...", 48 # Test this package along with dismock. 49 "go get $dismock@$dismock_v", 50 "go test -coverpkg $tested -coverprofile $COV -race ./... $dismock", 51 "go mod tidy", 52 "go tool cover -func $COV" 53 ] 54 } 55 }