Skip to content

Commit 759ced3

Browse files
committed
fix: zero code coverage in sonar
1 parent 64e7de2 commit 759ced3

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

.github/workflows/build-on-commit.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,37 @@ jobs:
2222
needs: prepare-variables
2323
steps:
2424
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
2527

2628
- name: Set up Go
2729
uses: actions/setup-go@v4
2830
with:
2931
go-version: '1.24.2'
3032

31-
- name: Build
33+
- name: Install Sonar Scanner
3234
run: |
33-
cd paas-mediation-service
34-
CGO_ENABLED=0 go build
35+
npm install -g sonar-scanner
36+
37+
- name: Build
38+
working-directory: paas-mediation-service
39+
run: CGO_ENABLED=0 go build
3540

3641
- name: Test with coverage
37-
run: |
38-
cd paas-mediation-service
39-
go test -v ./... -coverprofile coverage.out
42+
working-directory: paas-mediation-service
43+
run: go test -v ./... -coverprofile coverage.out
4044

4145
- name: Upload coverage report to SonarCloud
42-
uses: SonarSource/sonarcloud-github-action@v2
46+
working-directory: paas-mediation-service
47+
run: |
48+
sonar-scanner \
49+
-Dproject.settings=sonar-project.properties \
50+
-Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} \
51+
-Dsonar.organization=${{ vars.SONAR_ORGANIZATION }} \
52+
-Dsonar.host.url=${{ vars.SONAR_HOST_URL }} \
53+
-Dsonar.go.coverage.reportPaths=coverage.out
4354
env:
44-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
45-
with:
46-
args: >
47-
-Dproject.settings=paas-mediation-service/sonar-project.properties
48-
-Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }}
49-
-Dsonar.organization=${{ vars.SONAR_ORGANIZATION }}
50-
-Dsonar.host.url=${{ vars.SONAR_HOST_URL }}
51-
-Dsonar.go.coverage.reportPaths=paas-mediation-service/coverage.out
55+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
5256

5357
- name: Log in to GitHub Container Registry
5458
uses: docker/login-action@v2

0 commit comments

Comments
 (0)