Add SonarQube

This commit is contained in:
2022-08-13 20:10:51 +01:00
parent c4de2f6025
commit 1037d6cd0a
2 changed files with 38 additions and 0 deletions

32
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,32 @@
name: Test
on:
pull-request:
push:
branches: [ main ]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create golangci-lint report
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.1
cd go
/home/runner/go/bin/golangci-lint run --out-format checkstyle -D deadcode,unused --build-tags=integration --timeout 10m --issues-exit-code 0 ./... > ../report.xml
cd ..
sed -i 's+<file name="+<file name="go/+g' report.xml
cat report.xml
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
- uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

6
sonar-project.properties Normal file
View File

@@ -0,0 +1,6 @@
sonar.projectKey=luketainton_iPilot_AYKYmHI397IDIMpeRtF7
sonar.sources=.
sonar.exclusions=,.github/**,.gitignore,CODEOWNERS,CHANGELOG.md,LICENSE.md,README.md,renovate.json,**/*_test.go
sonar.tests=.
sonar.test.inclusions=**/*_test.go
sonar.go.golangci-lint.reportPaths=report.xml