Skip to content

Modern Docker Management, Designed for Everyone

ci/cd: add coverage report to sonarqube

Kyle Mendell219cd8cc3b69
diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml
index b56891bc4..4c32d5485 100644
--- a/.github/workflows/sonar.yml
+++ b/.github/workflows/sonar.yml
@@ -1,20 +1,42 @@
name: SonarQube
-
-on:
+"on":
push:
branches:
- main
-
jobs:
build:
- name: Codegate analyze
+ name: scan
runs-on: depot-ubuntu-24.04-8
+ defaults:
+ run:
+ working-directory: backend
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
+ - name: Set up Depot CLI
+ uses: depot/setup-action@v1
+ - name: Setup Go
+ uses: actions/setup-go@v6
+ with:
+ go-version-file: backend/go.mod
+ cache: true
+ cache-dependency-path: backend/go.sum
+ - name: Install GCC
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y gcc
+ - name: Download modules
+ run: go mod download
+ - name: Run unit tests
+ env:
+ CGO_ENABLED: "1"
+ run: |
+ go test -tags=exclude_frontend ./... -race -coverprofile=coverage.out -covermode=atomic -json > test-report.out
+ mv coverage.out ../coverage.out
+ mv test-report.out ../test-report.out
- uses: SonarSource/sonarqube-scan-action@v6
env:
- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
+ SONAR_TOKEN: "${{ secrets.SONAR_TOKEN }}"
+ SONAR_HOST_URL: "${{ secrets.SONAR_HOST_URL }}"
diff --git a/sonar-project.properties b/sonar-project.properties
index a9cee554d..38d4dbea0 100644
--- a/sonar-project.properties
+++ b/sonar-project.properties
@@ -1 +1,3 @@
-sonar.projectKey=getarcaneapp_arcane_7820b102-6a29-478b-b61e-cbe482139fb0
\ No newline at end of file
+sonar.projectKey=getarcaneapp_arcane_7820b102-6a29-478b-b61e-cbe482139fb0
+sonar.go.tests.reportPaths=test-report.out
+sonar.go.coverage.reportPaths=coverage.out