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

3

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

before_script:
Christian Pointner's avatar
Christian Pointner committed
10
11
  - mkdir -p .gopath
  - export GOPATH="$CI_PROJECT_DIR/.gopath"
12
  - go generate ./ui
13

14

Christian Pointner's avatar
Christian Pointner committed
15
stages:
16
17
18
  - vet
  - test
  - build
Christian Pointner's avatar
Christian Pointner committed
19

20

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

Christian Pointner's avatar
Christian Pointner committed
26

Christian Pointner's avatar
Christian Pointner committed
27
test-all-but-store:
28
29
30
  stage: test
  script:
    - go test -v -cover $(go list ./... | grep -v tank/store)
31
32

test-store-mysql:
33
34
35
36
37
38
39
  stage: test
  services:
    - mysql:5.7
  variables:
    MYSQL_DATABASE: "tank"
    MYSQL_USER: "tank"
    MYSQL_PASSWORD: "aura"
40
    MYSQL_RANDOM_ROOT_PASSWORD: "yes"
41
42
43
    AURA_TANK_TEST_DB_TYPE: "mysql"
    AURA_TANK_TEST_DB_HOST: "mysql"
  script:
44
    - go run contrib/waitfor-tcp.go mysql:3306 30
45
    - go test -v -cover ./store
46

Christian Pointner's avatar
Christian Pointner committed
47
48
49
50
51
52
53
54
test-store-mariadb:
  stage: test
  services:
    - mariadb:10.1
  variables:
    MYSQL_DATABASE: "tank"
    MYSQL_USER: "tank"
    MYSQL_PASSWORD: "aura"
55
    MYSQL_RANDOM_ROOT_PASSWORD: "yes"
Christian Pointner's avatar
Christian Pointner committed
56
57
58
    AURA_TANK_TEST_DB_TYPE: "mysql"
    AURA_TANK_TEST_DB_HOST: "mariadb"
  script:
59
    - go run contrib/waitfor-tcp.go mariadb:3306 30
Christian Pointner's avatar
Christian Pointner committed
60
61
    - go test -v -cover ./store

62
test-store-postgres:
63
64
65
66
67
68
69
70
71
72
  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:
73
    - go run contrib/waitfor-tcp.go postgres:5432 30
74
75
    - go test -v -cover ./store

Christian Pointner's avatar
Christian Pointner committed
76

Christian Pointner's avatar
Christian Pointner committed
77
build:
78
79
80
81
82
83
84
85
  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
86
87
88
89
90
91
92
93
94
95
96
97
98

docker:
  stage: build
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination aura/tank:$CI_COMMIT_TAG --tarPath $CI_PROJECT_DIR/docker.tar
  only:
    - master
  artifacts:
    paths:
      - docker.tar