-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
98 lines (88 loc) · 1.79 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
92
93
94
95
96
97
98
stages:
- test
- deploy
.docker: &docker
image: docker:latest
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
.webclient: &webclient
image: node
only:
changes:
- .gitlab-ci.yml
- web/**/*
- core/**/*
before_script:
- cd web
- yarn install
variables:
CORE_IMG: "$CI_REGISTRY_IMAGE/core"
WEBCLIENT_IMG: "$CI_REGISTRY_IMAGE/web"
core-test:
stage: test
image: golang
only:
changes:
- .gitlab-ci.yml
- core/**/*
- web/**/*
cache:
paths:
- /go/pkg/mod
coverage: /^total:.+\)\s+(\d+.?\d*)%$/
before_script:
- cd core
- go mod download
script:
- go test -race -short ./...
- go test -covermode=count -coverprofile cover.cov ./...
- go tool cover -func=cover.cov
webclient-check:
<<: *webclient
stage: test
script:
- yarn check
webclient-test:
stage: test
<<: *webclient
coverage: /^Lines\s*:\s(\d+.?\d*)%/
script:
- yarn test --collect-coverage
build-master-core:
stage: deploy
<<: *docker
script:
- cd core
- docker build --pull -t "$CORE_IMG" .
- docker push "$CORE_IMG"
only:
- master
build-core:
stage: deploy
<<: *docker
script:
- cd core
- docker build --pull -t "$CORE_IMG:$CI_COMMIT_REF_SLUG" .
- docker push "$CORE_IMG:$CI_COMMIT_REF_SLUG"
except:
- master
build-master-webclient:
stage: deploy
<<: *docker
script:
- cd web
- docker build --pull -t "$WEBCLIENT_IMG" .
- docker push "$WEBCLIENT_IMG"
only:
- master
build-webclient:
stage: deploy
<<: *docker
script:
- cd web
- docker build --pull -t "$WEBCLIENT_IMG:$CI_COMMIT_REF_SLUG" .
- docker push "$WEBCLIENT_IMG:$CI_COMMIT_REF_SLUG"
except:
- master