.gitlab-ci.yml 1.11 KB
Newer Older
Christian Pointner's avatar
Christian Pointner committed
1
image: golang:1.12
Christian Pointner's avatar
Christian Pointner committed
2

3

4
5
cache:
  paths:
Christian Pointner's avatar
Christian Pointner committed
6
    - .gopath/
7
8

before_script:
Christian Pointner's avatar
Christian Pointner committed
9
10
  - mkdir -p .gopath
  - export GOPATH="$CI_PROJECT_DIR/.gopath"
11

12

Christian Pointner's avatar
Christian Pointner committed
13
stages:
14
15
16
  - vet
  - test
  - build
Christian Pointner's avatar
Christian Pointner committed
17

18

Christian Pointner's avatar
Christian Pointner committed
19
vet:
20
21
22
23
  stage: vet
  script:
    - go vet ./...

Christian Pointner's avatar
Christian Pointner committed
24
25

test:
26
27
28
  stage: test
  script:
    - go test -v -cover $(go list ./... | grep -v tank/store)
29
30

test-store-mysql:
31
32
33
34
35
36
37
38
39
40
41
42
  stage: test
  services:
    - mysql:5.7
  variables:
    MYSQL_DATABASE: "tank"
    MYSQL_USER: "tank"
    MYSQL_PASSWORD: "aura"
    MYSQL_ROOT_PASSWORD: "yes"
    AURA_TANK_TEST_DB_TYPE: "mysql"
    AURA_TANK_TEST_DB_HOST: "mysql"
  script:
    - go test -v -cover ./store
43
44

test-store-postgres:
45
46
47
48
49
50
51
52
53
54
55
56
  stage: test
  services:
    - postgres:9.6
  variables:
    POSTGRES_DB: "tank"
    POSTGRES_USER: "tank"
    POSTGRES_PASSWORD: "aura"
    AURA_TANK_TEST_DB_TYPE: "postgres"
    AURA_TANK_TEST_DB_HOST: "postgres"
  script:
    - go test -v -cover ./store

Christian Pointner's avatar
Christian Pointner committed
57

Christian Pointner's avatar
Christian Pointner committed
58
build:
59
60
61
62
63
64
65
66
  stage: build
  script:
    - go build -ldflags "-extldflags '-static'" -tags netgo -o $CI_PROJECT_DIR/tank ./cmd/tank
    ## sqlite needs cgo... :(
    ##- go build -o $CI_PROJECT_DIR/tank ./cmd/tank
  artifacts:
    paths:
      - tank