Skip to content

Commit

Permalink
fix: coverage calculation Sonar (#4810)
Browse files Browse the repository at this point in the history
Signed-off-by: Lennart Krauch <lennart.krauch@inovex.de>
  • Loading branch information
Lennart01 authored Jan 27, 2025
1 parent 989f4f9 commit a68e0cc
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 25 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,56 @@ jobs:
make test
make build-alpine
sonarqube:
name: SonarQube
runs-on: ubuntu-latest
# needs: [test-frontend, test-backend]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- uses: actions/setup-go@v5
with:
go-version: "^1.22"
cache: false

- name: Cache Go Modules
id: cache-go-modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('server/src/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download Go Modules
if: steps.cache-go-modules.outputs.cache-hit != 'true'
working-directory: ./server/src
run: go mod download

- name: Verify Go Modules
working-directory: ./server/src
run: go list -m all

- name: Get coverage report
id: coverage
working-directory: ./server
run: |
make test
sed -i 's|scrumlr.io/server/|server/src/|g' src/coverage.txt
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v4
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: SonarQube Quality Gate
uses: SonarSource/sonarqube-quality-gate-action@v1
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
package:
needs: [test-frontend, test-backend]
uses: ./.github/workflows/package.yml
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/sonarqube.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ sonar.organization=scrumlr
#sonar.sourceEncoding=UTF-8

sonar.typescript.tsconfigPath=tsconfig.json
sonar.go.coverage.reportPaths=server/src/coverage.txt
sonar.coverage.exclusions=src/**/*

0 comments on commit a68e0cc

Please sign in to comment.