| 1 |
# Use the same image version as the minimum version on go.mod |
| 2 |
image: golang:1.25 |
| 3 |
|
| 4 |
variables: |
| 5 |
GOPATH: $CI_PROJECT_DIR/.mygo |
| 6 |
|
| 7 |
cache: |
| 8 |
key: |
| 9 |
files: |
| 10 |
- go.mod |
| 11 |
- go.sum |
| 12 |
paths: |
| 13 |
- .mygo/pkg/mod |
| 14 |
|
| 15 |
stages: |
| 16 |
- test |
| 17 |
|
| 18 |
test: |
| 19 |
stage: test |
| 20 |
script: |
| 21 |
- go mod tidy |
| 22 |
- git diff --exit-code go.mod go.sum || (echo "Run go mod tidy!" >&2 ; exit 1) |
| 23 |
- go test -v -coverprofile .testCoverage.txt -covermode count ./client 2>&1 | go tool go-junit-report -set-exit-code > test.xml |
| 24 |
- go tool gocover-cobertura < .testCoverage.txt > coverage.xml |
| 25 |
artifacts: |
| 26 |
reports: |
| 27 |
coverage_report: |
| 28 |
coverage_format: cobertura |
| 29 |
path: coverage.xml |
| 30 |
junit: test.xml |
| 31 |
|
| 32 |
lint: |
| 33 |
stage: test |
| 34 |
image: golangci/golangci-lint:v2.12 |
| 35 |
script: |
| 36 |
- golangci-lint run --output.text.path stdout --output.code-climate.path gl-code-quality-report.json |
| 37 |
artifacts: |
| 38 |
when: always |
| 39 |
reports: |
| 40 |
codequality: gl-code-quality-report.json |