Add Sonar scan
This commit is contained in:
+12
-2
@@ -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:
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
sonar.projectKey=kalorienmanager
|
||||
sonar.projectName='Kalorien Manager'
|
||||
sonar.host.url=https://sonar.ingenieurbuero-peetz.de
|
||||
sonar.login=ed0634e05811fb2b1cdd0f16b0a924f943623520
|
||||
|
||||
sonar.sources=.
|
||||
sonar.exclusions=**/*_test.go,docs/**
|
||||
|
||||
sonar.tests=.
|
||||
sonar.test.inclusions=**/*_test.go
|
||||
sonar.test.exclusions=docs/**
|
||||
|
||||
sonar.go.tests.reportPaths=test-report.out
|
||||
sonar.go.coverage.reportPaths=coverage.out
|
||||
sonar.go.govet.reportPaths=govet-report.out
|
||||
sonar.go.golint.reportPaths=golint-report.out
|
||||
|
||||
Reference in New Issue
Block a user