Add Sonar scan
This commit is contained in:
+12
-2
@@ -1,6 +1,7 @@
|
|||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
|
- analysis
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
@@ -24,12 +25,21 @@ Test Go Application:
|
|||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- make test
|
- make test
|
||||||
- GOPATH=$HOME/go go test -v ./... 2>&1 | /home/gitlab-runner/go/bin/go-junit-report > report.xml
|
- go test -v ./... 2>&1 | /home/gitlab-runner/go/bin/go-junit-report > report.xml
|
||||||
- GOPATH=$HOME/go go vet ./...
|
- go vet ./...
|
||||||
artifacts:
|
artifacts:
|
||||||
reports:
|
reports:
|
||||||
junit: report.xml
|
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:
|
Deploy To Staging:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
script:
|
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