1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-05 06:26:08 +00:00
arikawa/.gitlab-ci.yml

56 lines
1.5 KiB
YAML
Raw Normal View History

2020-05-30 21:45:22 +00:00
{
"image": "golang:alpine",
"variables": {
"GO111MODULE": "on",
2020-10-29 20:06:27 +00:00
"CGO_ENABLED": "1", # for the race detector
"COV": "/tmp/cov_results",
"dismock": "github.com/mavolin/dismock/v2/pkg/dismock",
2020-12-16 23:18:05 +00:00
"dismock_v": "259685b84e4b6ab364b0fd858aac2aa2dfa42502",
# used only in integration_test
"tested": "./api,./gateway,./bot,./discord"
2020-05-30 21:45:22 +00:00
},
"before_script": [
2020-10-29 20:09:49 +00:00
"apk add git build-base"
2020-05-30 21:45:22 +00:00
],
"stages": [
"build",
2020-05-30 21:45:22 +00:00
"test"
],
"build_test": {
"stage": "build",
2020-05-30 21:45:22 +00:00
"script": [
"go build ./..."
]
},
"unit_test": {
"stage": "test",
"timeout": "2m", # 2 minutes
# Don't run the test if we have a $BOT_TOKEN, because
# integration_test will run instead.
2020-05-30 22:22:13 +00:00
"except": {
"variables": [ "$BOT_TOKEN" ]
},
2020-05-30 21:45:22 +00:00
"script": [
"go test -coverprofile $COV -tags unitonly -race ./...",
2020-05-30 21:45:22 +00:00
"go tool cover -func $COV"
]
},
"integration_test": {
"stage": "test",
"timeout": "5m", # 5 minutes
# Run the test only if we have $BOT_TOKEN, else fallback to unit
# tests.
"only": {
"variables": [ "$BOT_TOKEN" ]
},
2020-05-30 21:45:22 +00:00
"script": [
"go get ./...",
# Test this package along with dismock.
"go get $dismock@$dismock_v",
"go test -coverpkg $tested -coverprofile $COV -race ./... $dismock",
"go mod tidy",
2020-05-30 21:45:22 +00:00
"go tool cover -func $COV"
]
}
}