-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
91 lines (79 loc) · 2.04 KB
/
.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
variables:
PKG: "gitlab.com/unitto/nohi"
STABLE_IMAGE: ${REGISTRY_IMAGE}:stable
TAG_IMAGE: ${REGISTRY_IMAGE}:${CI_COMMIT_TAG}
stages:
- test
- build
image: golang:1.14.7-alpine3.12
test:
stage: test
before_script:
- apk add --no-cache gcc=9.3.0-r2 g++=9.3.0-r2
script:
- go test -v ./... -cover -race
lint:
stage: test
before_script:
- apk add --no-cache gcc=9.3.0-r2 g++=9.3.0-r2
- wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.30.0
script:
- ./bin/golangci-lint -v run
docs:
image:
name: squidfunk/mkdocs-material:5.5.3
entrypoint: [""]
stage: test
except:
- master
before_script:
- apk add --no-cache git
script:
- sed -i "s~{commit}~$(git rev-parse --short HEAD)~g" docs/index.md
- mkdocs build --verbose
artifacts:
paths:
- site
pages:
image:
name: squidfunk/mkdocs-material:5.5.3
entrypoint: [""]
stage: build
only:
- master
before_script:
- apk add --no-cache git
script:
- sed -i "s~{commit}~$(git rev-parse --short HEAD)~g" docs/index.md
- mkdocs build --verbose --site-dir public
artifacts:
paths:
- public
build-master:
image: docker:stable
stage: build
services:
- docker:stable-dind
only:
- master
before_script:
- docker login -u ${REGISTRY_USER} -p ${REGISTRY_PASSWORD}
script:
- docker build --build-arg flags="-X ${PKG}/cmd.Commit=${CI_COMMIT_SHORT_SHA}" -t ${REGISTRY_IMAGE} .
- docker run ${REGISTRY_IMAGE} version
- docker push ${REGISTRY_IMAGE}
build-tags:
image: docker:stable
stage: build
services:
- docker:stable-dind
only:
- tags
before_script:
- docker login -u ${REGISTRY_USER} -p ${REGISTRY_PASSWORD}
script:
- docker build --build-arg flags="-X ${PKG}/cmd.Commit=${CI_COMMIT_SHORT_SHA} -X ${PKG}/cmd.Version=${CI_COMMIT_TAG}" -t ${TAG_IMAGE} .
- docker run ${TAG_IMAGE} version
- docker push ${TAG_IMAGE}
- docker tag ${TAG_IMAGE} ${STABLE_IMAGE}
- docker push ${STABLE_IMAGE}