-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
52 lines (43 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
image: golang:1.11
services:
- docker:dind
variables:
REPO_NAME: gitlab.com/polychain/tezos-hsm-signer
CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
before_script:
- apt-get update
- apt-get install -y libtool
- go get -d -v ./...
stages:
- test
- build
coverage:
stage: test
script:
- go test $(go list ./... | grep -v /vendor/) -coverprofile cover.out; go tool cover -func cover.out
test:
stage: test
script:
- go mod verify
- go fmt $(go list ./... | grep -v /vendor/)
- go vet $(go list ./... | grep -v /vendor/)
- go test -race $(go list ./... | grep -v /vendor/)
build-binary:
stage: build
script:
- GOOS=linux go build -race -o $CI_PROJECT_DIR/tezos-hsm-signer
artifacts:
paths:
- tezos-hsm-signer
build-image:
image: docker:stable
stage: build
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
script:
- docker build --tag $CONTAINER_IMAGE:$CI_COMMIT_SHA --tag $CONTAINER_IMAGE:$CI_COMMIT_REF_SLUG --tag $CONTAINER_IMAGE:latest .
- docker push $CONTAINER_IMAGE:$CI_COMMIT_SHA
- docker push $CONTAINER_IMAGE:$CI_COMMIT_REF_SLUG
- docker push $CONTAINER_IMAGE:latest