-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
58 lines (53 loc) · 1.29 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
---
# yamllint disable rule:key-ordering
image: registry.gitlab.com/yakshaving.art/dockerfiles/go-builder:master
stages:
- check
- build
- release
check:
image: registry.gitlab.com/yakshaving.art/dockerfiles/critic:master
stage: check
script:
- bash .gitlab.d/ci/scripts/check.sh
build-binary:
stage: build
coverage: '/^total:\s+\(statements\)\s+(\d+.\d+)%$/'
variables:
CGO_ENABLED: 0
GOCACHE: ${CI_PROJECT_DIR}/.cache/go-build
cache:
key: build-cache
paths:
- .cache/go-build
artifacts:
paths:
- hurrdurr
script:
- make test build
.build-image: &build-image
image: docker:stable
stage: release
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
before_script:
- echo ${CI_JOB_TOKEN} | docker login -u gitlab-ci-token --password-stdin ${CI_REGISTRY}
after_script:
- docker logout ${CI_REGISTRY}
release_latest:
<<: *build-image
script:
- docker build --cache-from ${CI_REGISTRY_IMAGE}:latest
--tag ${CI_REGISTRY_IMAGE}:latest .
- docker push ${CI_REGISTRY_IMAGE}:latest
release_tag:
<<: *build-image
script:
- docker build --cache-from ${CI_REGISTRY_IMAGE}:latest
--tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG} .
- docker push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
only:
- tags