mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-30 18:53:30 +00:00
40 lines
884 B
YAML
40 lines
884 B
YAML
image: golang:alpine
|
|
|
|
variables:
|
|
GO111MODULE: "on"
|
|
CGO_ENABLED: "0"
|
|
COV: "/tmp/cov_results"
|
|
|
|
before_script:
|
|
- apk add git
|
|
|
|
stages:
|
|
- test
|
|
|
|
build_test:
|
|
stage: test
|
|
script:
|
|
- go build ./...
|
|
|
|
unit_test:
|
|
stage: test
|
|
script:
|
|
- go test -v -coverprofile $COV ./...
|
|
- go tool cover -func $COV
|
|
| grep -F 'total:'
|
|
| sed -E 's|total:\s+\(.*?\)\s+([0-9]+\.[0-9]+%)|TEST_COVERAGE=\1|'
|
|
|
|
integration_test:
|
|
stage: test
|
|
script:
|
|
# Don't run if these variables aren't provided.
|
|
- '[ ! "$BOT_TOKEN" ] && exit'
|
|
# go get first, so it doesn't count towards the timeout.
|
|
- go get ./...
|
|
# Timeout test after 120 seconds (2 minutes)
|
|
- timeout 120 go test -tags integration -v -coverprofile $COV ./...
|
|
- go tool cover -func $COV
|
|
| grep -F 'total:'
|
|
| sed -E 's|total:\s+\(.*?\)\s+([0-9]+\.[0-9]+%)|TEST_COVERAGE=\1|'
|
|
|