1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-09-29 21:58:57 +00:00
arikawa/.gitlab-ci.yml

49 lines
1.3 KiB
YAML
Raw Normal View History

2020-05-30 21:45:22 +00:00
{
"image": "golang:alpine",
"variables": {
"GO111MODULE": "on",
"CGO_ENABLED": "0",
"COV": "/tmp/cov_results",
"dismock": "github.com/mavolin/dismock/pkg/dismock",
# used only in integration_test
"tested": "./api,./gateway,./bot,./discord"
2020-05-30 21:45:22 +00:00
},
"before_script": [
"apk add git"
],
"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
2020-05-30 21:45:22 +00:00
"script": [
# Don't run the test if we have a $BOT_TOKEN, because
# integration_test will run instead.
"[ $BOT_TOKEN ] && exit",
2020-05-30 21:45:22 +00:00
"go test -v -coverprofile $COV ./...",
"go tool cover -func $COV"
]
},
"integration_test": {
"stage": "test",
"timeout": "2m", # 2 minutes
2020-05-30 21:45:22 +00:00
"script": [
# Run the test only if we have $BOT_TOKEN, else fallback to unit
# tests.
"[ ! $BOT_TOKEN ] && exit",
2020-05-30 21:45:22 +00:00
"go get ./...",
# Test this package along with dismock.
"go test -coverpkg $tested -coverprofile $COV -tags integration -v ./... $dismock",
2020-05-30 21:45:22 +00:00
"go tool cover -func $COV"
]
}
}