github.com/diamondburned/arikawa@v1.3.14/.gitlab-ci.yml (about)

     1  {
     2      "image": "golang:alpine",
     3      "variables": {
     4          "GO111MODULE": "on",
     5          "CGO_ENABLED": "1", # for the race detector
     6          "COV": "/tmp/cov_results",
     7          "dismock": "github.com/mavolin/dismock/pkg/dismock",
     8          # used only in integration_test
     9          "tested": "./api,./gateway,./bot,./discord"
    10      },
    11      "before_script": [
    12          "apk add git build-base"
    13      ],
    14      "stages": [
    15          "build",
    16          "test"
    17      ],
    18      "build_test": {
    19          "stage": "build",
    20          "script": [
    21              "go build ./..."
    22          ]
    23      },
    24      "unit_test": {
    25          "stage": "test",
    26          "timeout": "2m", # 2 minutes
    27          # Don't run the test if we have a $BOT_TOKEN, because
    28          # integration_test will run instead.
    29          "except": {
    30              "variables": [ "$BOT_TOKEN" ]
    31          },
    32          "script": [
    33              "go test -coverprofile $COV -race -v ./...",
    34              "go tool cover -func $COV"
    35          ]
    36      },
    37      "integration_test": {
    38          "stage": "test",
    39          "timeout": "5m", # 5 minutes
    40          # Run the test only if we have $BOT_TOKEN, else fallback to unit
    41          # tests.
    42          "only": {
    43              "variables": [ "$BOT_TOKEN" ]
    44          },
    45          "script": [
    46              "go get ./...",
    47              # Test this package along with dismock.
    48              "go test -coverpkg $tested -coverprofile $COV -tags integration -race -v ./... $dismock",
    49              "go tool cover -func $COV"
    50          ]
    51      }
    52  }