-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
41 lines (39 loc) · 951 Bytes
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
stages:
- test
- release
unittest:
stage: test
image: golang:1.13.0-stretch
only:
- branches
- tags
cache:
paths:
- .cache
variables:
GO111MODULE: "on"
script:
- mkdir -p .cache
- export GOPATH="$CI_PROJECT_DIR/.cache"
- go vet ./...
# don't check mocks folder
- go test -coverprofile=coverage.out $(go list ./... | grep -v /mocks)
- go tool cover -func=coverage.out
coverage: '/total:\s+\(statements\)\s+(\d+.\d+\%)/'
release-image:
stage: release
image: docker:18.03.1-ce
only:
- tags
services:
- docker:18.03.1-ce-dind
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
before_script:
- docker info
script:
- echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
- docker build -t chihkaiyu/gitlack:$CI_COMMIT_REF_NAME .
- docker push chihkaiyu/gitlack:$CI_COMMIT_REF_NAME
- docker logout