From e06127458928a78041440c4c24ae837d8d03bc54 Mon Sep 17 00:00:00 2001 From: Juan Ezquerro LLanes Date: Thu, 24 Sep 2026 01:03:29 +0200 Subject: [PATCH] ci: configure SonarQube Cloud coverage and GitHub Actions workflow --- .github/workflows/sonarcloud.yml | 37 ++++++++++++++++++++++++++++++++ .sonarcloud.properties | 7 ++++++ sonar-project.properties | 7 ++++++ 3 files changed, 51 insertions(+) create mode 100644 .github/workflows/sonarcloud.yml create mode 100644 .sonarcloud.properties create mode 100644 sonar-project.properties diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 0000000..feac9f7 --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,37 @@ +name: SonarQube Cloud Analysis + +on: + push: + branches: + - main + - master + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + +jobs: + sonarcloud: + name: SonarQube Cloud Scan + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + + - name: Run tests with coverage + run: | + go test -coverprofile=coverage.out -covermode=atomic ./... + + - name: SonarQube Cloud Scan + uses: SonarSource/sonarqube-scan-action@v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.sonarcloud.properties b/.sonarcloud.properties new file mode 100644 index 0000000..44d77ed --- /dev/null +++ b/.sonarcloud.properties @@ -0,0 +1,7 @@ +sonar.organization=arrase +sonar.projectKey=arrase_code-reducer +sonar.sources=. +sonar.exclusions=**/*_test.go,**/examples/** +sonar.tests=. +sonar.test.inclusions=**/*_test.go +sonar.go.coverage.reportPaths=coverage.out diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..44d77ed --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,7 @@ +sonar.organization=arrase +sonar.projectKey=arrase_code-reducer +sonar.sources=. +sonar.exclusions=**/*_test.go,**/examples/** +sonar.tests=. +sonar.test.inclusions=**/*_test.go +sonar.go.coverage.reportPaths=coverage.out