Skip to content

Running code coverage tests within the Sonar Cloud Static Scan action #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions .github/workflows/sonar-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,30 @@ jobs:
sonarcloud:
name: Sonar Cloud Static Scans
runs-on: ubuntu-latest
env:
go_version: '1.23'

if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'

steps:
- name: Fetch Code Coverage Report
uses: actions/download-artifact@v4
- name: Checkout Provider
uses: actions/checkout@v4
with:
name: coverage-report
path: .
fetch-depth: 0

- name: Setup Go ${{ env.go_version }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.go_version }}

- name: Run unit tests with coverage
run: make testcov

# - name: Fetch Code Coverage Report
# uses: actions/download-artifact@v4
# with:
# name: coverage-report
# path: .

- name: Sonar Cloud Scan
uses: SonarSource/[email protected]
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/unit_test_and_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ jobs:
- name: Build the Provider
run: go build -v ./...

- name: Run unit tests with coverage
run: make testcov
- name: Run Provider Unit Tests
run: make test

- name: Upload code coverage report from unit tests
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: unit-testing.cov
# - name: Run unit tests with coverage
# run: make testcov

# - name: Upload code coverage report from unit tests
# uses: actions/upload-artifact@v4
# with:
# name: coverage-report
# path: unit-testing.cov