-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
42 lines (39 loc) · 1.32 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
include:
- template: Code-Quality.gitlab-ci.yml
- template: Security/SAST.gitlab-ci.yml
stages:
- test
code_quality:
services: [] # Shut off Docker-in-Docker
tags:
- codequality-no-dind
variables:
REPORT_FORMAT: html
artifacts:
paths: [gl-code-quality-report.html]
rules:
- if: '$CODE_QUALITY_DISABLED'
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' # Run code quality job in merge request pipelines
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' # Run code quality job in pipelines on the default branch (but not in other branch pipelines)
- if: '$CI_COMMIT_TAG' # Run code quality job in pipelines for tags
# Create unit test and coverage reports.
coverage:
image:
name: golang:1.17
stage: test
coverage: '/coverage: \d+.\d+% of statements/'
before_script:
- go get gotest.tools/gotestsum
- go get github.com/boumenot/gocover-cobertura
- "go get -d"
script:
- go test -v -coverprofile=coverage.out -covermode count -coverpkg=./...
- go run github.com/boumenot/gocover-cobertura < coverage.out > coverage.xml
- gotestsum --junitfile report.xml --format testname
artifacts:
reports:
junit: report.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml