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

Christian Pointner's avatar
Christian Pointner committed
3
4
variables:
  GOPATH: "$CI_PROJECT_DIR/.gopath"
5
6
  GOFLAGS: -mod=readonly

7
8
cache:
  paths:
Christian Pointner's avatar
Christian Pointner committed
9
    - .gopath/
10
    - ui/assets_vfsdata.go
Christian Pointner's avatar
Christian Pointner committed
11
12
  key: default
  policy: pull
13

Christian Pointner's avatar
Christian Pointner committed
14
stages:
Christian Pointner's avatar
Christian Pointner committed
15
  - prepare
16
17
  - test
  - build
Christian Pointner's avatar
Christian Pointner committed
18

19

Christian Pointner's avatar
Christian Pointner committed
20
21
22
23
prepare:
  stage: prepare
  cache:
    policy: pull-push
24
  script:
Christian Pointner's avatar
Christian Pointner committed
25
26
27
    - mkdir -p .gopath
    - export GOPATH="$CI_PROJECT_DIR/.gopath"
    - go generate ./ui
28
29
    - go vet ./...

Christian Pointner's avatar
Christian Pointner committed
30

Christian Pointner's avatar
Christian Pointner committed
31
test-all-but-store:
32
33
34
  stage: test
  script:
    - go test -v -cover $(go list ./... | grep -v tank/store)
35
36

test-store-postgres:
37
38
  stage: test
  services:
39
    - postgres:10.19
40
41
42
43
44
45
46
  variables:
    POSTGRES_DB: "tank"
    POSTGRES_USER: "tank"
    POSTGRES_PASSWORD: "aura"
    AURA_TANK_TEST_DB_TYPE: "postgres"
    AURA_TANK_TEST_DB_HOST: "postgres"
  script:
47
    - go run contrib/waitfor-tcp.go postgres:5432 30
48
49
    - go test -v -cover ./store

Christian Pointner's avatar
Christian Pointner committed
50

Christian Pointner's avatar
Christian Pointner committed
51
build:
52
53
54
55
56
  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
57
58
  only:
    - master
59
60
61
  artifacts:
    paths:
      - tank
62
63
64
65
66
67

docker:
  stage: build
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
Christian Pointner's avatar
Christian Pointner committed
68
69
70
71
72
  cache:
    paths:
      - .docker/cache
    key: default
    policy: pull-push
73
  script:
74
75
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
76
77
  only:
    - master