forked from akvorado/akvorado
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
72 lines (69 loc) · 1.88 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
---
stages:
- tests
- build
run tests:
stage: tests
image: golang:1.23-alpine
cache:
- key:
files:
- go.sum
paths:
- .go-cache/
- bin/
- key:
files:
- console/frontend/package-lock.json
paths:
- .npm-cache
script:
# Tests on GitLab do not include functional tests. This was the case in the
# past but this is a slight burden to maintain in addition to GitHub CI.
# Check commit ceaa6ebf8ef6 for the last version supporting functional
# tests.
- time apk add --no-cache git make gcc musl-dev shared-mime-info npm curl
- export GOMODCACHE=$PWD/.go-cache
- npm config --user set cache $PWD/.npm-cache
- time go mod download
- time make && ./bin/akvorado version
- time make test-race
- time make test-js
- time make test-coverage
coverage: '/Code coverage: [0-9.]+/'
artifacts:
reports:
junit:
- test/go/tests.xml
- test/js/tests.xml
coverage_report:
coverage_format: cobertura
path: test/go/coverage.xml
# To execute manually:
# gitlab-runner exec docker "run tests"
build docker image:
stage: build
image: docker:stable
rules:
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_MERGE_REQUEST_ID
script:
- |
mkdir -p ~/.docker
cat <<EOF > ~/.docker/config.json
{
"proxies":
{
"default":
{
"httpProxy": "$http_proxy",
"httpsProxy": "$https_proxy",
"noProxy": "127.0.0.1/8${NO_PROXY:+,}NO_PROXY${no_proxy:+,}$no_proxy"
}
}
}
EOF
- docker info
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -f docker/Dockerfile -t $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH$CI_MERGE_REQUEST_ID .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH$CI_MERGE_REQUEST_ID