Add Sonar scan

This commit is contained in:
Thomas Peetz
2019-09-23 09:38:57 +02:00
parent 64b44bde5f
commit 5c6e8e65d4
2 changed files with 29 additions and 2 deletions
+12 -2
View File
@@ -1,6 +1,7 @@
stages:
- build
- test
- analysis
- deploy
before_script:
@@ -24,12 +25,21 @@ Test Go Application:
stage: test
script:
- make test
- GOPATH=$HOME/go go test -v ./... 2>&1 | /home/gitlab-runner/go/bin/go-junit-report > report.xml
- GOPATH=$HOME/go go vet ./...
- go test -v ./... 2>&1 | /home/gitlab-runner/go/bin/go-junit-report > report.xml
- go vet ./...
artifacts:
reports:
junit: report.xml
Code analysis:
stage: analysis
script:
- go test -json ./... > test-report.out
- go test -coverprofile=coverage.out ./...
- /home/gitlab-runner/go/bin/golint ./... > golint-report.out
- go vet ./... 2> govet-report.out
- /data/sonar-scanner/bin/sonar-scanner -Dsonar.projectVersion=$(git describe --abbrev=0) -Dsonar.host.url=https://sonar.ingenieurbuero-peetz.de -Dsonar.login=ed0634e05811fb2b1cdd0f16b0a924f943623520
Deploy To Staging:
stage: deploy
script: