mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-27 17:23:00 +00:00
53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
{
|
|
"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"
|
|
},
|
|
"before_script": [
|
|
"apk add git"
|
|
],
|
|
"stages": [
|
|
"build",
|
|
"test"
|
|
],
|
|
"build_test": {
|
|
"stage": "build",
|
|
"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.
|
|
"except": {
|
|
"variables": [ "$BOT_TOKEN" ]
|
|
},
|
|
"script": [
|
|
"go test -v -coverprofile $COV ./...",
|
|
"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" ]
|
|
},
|
|
"script": [
|
|
"go get ./...",
|
|
# Test this package along with dismock.
|
|
"go test -coverpkg $tested -coverprofile $COV -tags integration -v ./... $dismock",
|
|
"go tool cover -func $COV"
|
|
]
|
|
}
|
|
}
|