-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
72 lines (66 loc) · 1.68 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
---
image: golang:1.22
stages:
- test
default:
timeout: 10 minutes
# Check that all packages are compiling.
build:
stage: test
script:
- make build
only:
- branches
# Check that all integration tests are labeled.
test-short:
stage: test
script:
- make test-short
only:
- branches
# Runs all test.
test:
services:
- docker:dind
stage: test
variables:
DOCKER_HOST: tcp://docker:2375
TESTING_DB_URL: postgresql://postgres:postgres@docker:32260/postgres?sslmode=disable
before_script:
- curl -fsSL https://get.docker.com -o install-docker.sh
- sh install-docker.sh
- docker version
- docker compose version
- make test-env-up
script:
- make test
- go get github.com/boumenot/gocover-cobertura
- go run github.com/boumenot/gocover-cobertura < coverage.out > coverage.xml
after_script:
- make test-env-down
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
coverage: /^total:\s+\(statements\)\s+(\d+(?:\.\d+)?%)/
only:
- branches
# Check actuality of go.mod and go.sum
#
# See https://xorcare.ru/s/8dd13
check-go-modules:
stage: test
script:
- go mod tidy
- |
git diff --exit-code && exit 0 || true
echo -e "\033[0;31m"
echo '######################################################################'
echo
echo "ERROR: go.mod or go.sum is different from the committed version"
echo "Try using 'go mod tidy' to fix the go.mod and go.sum files"
echo "Also, don't forget to commit and push changes"
echo
echo '######################################################################'
exit 1