mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-03-22 18:09:21 +00:00
CI: Unit and integration tests are now mutually exclusive
This commit is contained in:
parent
f91518f3c6
commit
783dfe7ba6
|
@ -3,33 +3,45 @@
|
||||||
"variables": {
|
"variables": {
|
||||||
"GO111MODULE": "on",
|
"GO111MODULE": "on",
|
||||||
"CGO_ENABLED": "0",
|
"CGO_ENABLED": "0",
|
||||||
"COV": "/tmp/cov_results"
|
"COV": "/tmp/cov_results",
|
||||||
|
"dismock": "github.com/mavolin/dismock/pkg/dismock",
|
||||||
|
# used only in integration_test
|
||||||
|
"tested": "./api,./gateway,./bot,./discord"
|
||||||
},
|
},
|
||||||
"before_script": [
|
"before_script": [
|
||||||
"apk add git"
|
"apk add git"
|
||||||
],
|
],
|
||||||
"stages": [
|
"stages": [
|
||||||
|
"build",
|
||||||
"test"
|
"test"
|
||||||
],
|
],
|
||||||
"build_test": {
|
"build_test": {
|
||||||
"stage": "test",
|
"stage": "build",
|
||||||
"script": [
|
"script": [
|
||||||
"go build ./..."
|
"go build ./..."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"unit_test": {
|
"unit_test": {
|
||||||
"stage": "test",
|
"stage": "test",
|
||||||
|
"timeout": "2m", # 2 minutes
|
||||||
"script": [
|
"script": [
|
||||||
|
# Don't run the test if we have a $BOT_TOKEN, because
|
||||||
|
# integration_test will run instead.
|
||||||
|
"[ $BOT_TOKEN ] && exit",
|
||||||
"go test -v -coverprofile $COV ./...",
|
"go test -v -coverprofile $COV ./...",
|
||||||
"go tool cover -func $COV"
|
"go tool cover -func $COV"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"integration_test": {
|
"integration_test": {
|
||||||
"stage": "test",
|
"stage": "test",
|
||||||
|
"timeout": "2m", # 2 minutes
|
||||||
"script": [
|
"script": [
|
||||||
"[ ! \"$BOT_TOKEN\" ] && exit",
|
# Run the test only if we have $BOT_TOKEN, else fallback to unit
|
||||||
|
# tests.
|
||||||
|
"[ ! $BOT_TOKEN ] && exit",
|
||||||
"go get ./...",
|
"go get ./...",
|
||||||
"timeout 120 go test -coverpkg \"./api,./gateway,./bot,./discord\" -coverprofile $COV -tags integration -v ./... github.com/mavolin/dismock/pkg/dismock",
|
# Test this package along with dismock.
|
||||||
|
"go test -coverpkg $tested -coverprofile $COV -tags integration -v ./... $dismock",
|
||||||
"go tool cover -func $COV"
|
"go tool cover -func $COV"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue