forked from podengo-project/idmsvc-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
65 lines (56 loc) · 1.48 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
---
image: golang:1.19
stages:
- check
- test
- build
check missed commits:
stage: check
tags:
- shared
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- apt-get update
- apt-get install -y python3-venv python3-pip
- python3 -m venv .venv
- .venv/bin/pip install yamllint
script:
# Check install go tools
- make install-go-tools
# - echo "Checking missed 'make tidy'"
# - make tidy && git diff --exit-code go.mod go.sum
- echo "get dependencies"
- go get ./...
- echo "Checking missed 'make generate-api'"
- make generate-api && git diff --exit-code internal/api/public/
- echo "Checking missed 'make generate-mock'"
- make generate-mock && git diff --exit-code internal/test/mock/
- echo "Checking missed 'go fmt'"
- make go-fmt && git diff --exit-code .
- echo "Checking yaml files"
- .venv/bin/python3 -m yamllint .
run tests:
stage: test
tags:
- shared
needs: []
script:
- go vet $(go list ./... | grep -v /vendor/)
- make test
- go get github.com/boumenot/gocover-cobertura
- go run github.com/boumenot/gocover-cobertura < coverage.out > coverage.xml
- go tool cover -func ./coverage.out
coverage: '/total:\s+\(statements\)(?:\s+)?(\d+(?:\.\d+)?%)/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
compile project:
stage: build
tags:
- shared
needs: ["run tests"]
script:
- make build