diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bab6fb..af2acd6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,9 @@ jobs: timeout-minutes: 10 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + fetch-depth: 0 + persist-credentials: false - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7 with: go-version: ${{ needs.versions.outputs.go }} @@ -41,6 +44,14 @@ jobs: with: name: coverage path: coverage.out + - name: Analyze with SonarQube Cloud + if: >- + github.event_name == 'push' || + (github.event.pull_request.head.repo.full_name == github.repository && + github.actor != 'dependabot[bot]') + uses: SonarSource/sonarqube-scan-action@59202af334b4ba7b5db01b701b8e79f8b3bef0f4 # v8.5.0 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} integration: name: PostgreSQL integration and end-to-end diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..ce236b5 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,12 @@ +# Publish analysis to the existing Hardcore project in SonarQube Cloud. +sonar.organization=fuf-stack +sonar.projectKey=fuf-stack_hardcore + +# Go keeps tests alongside production code. Classify each file only once. +sonar.sources=. +sonar.exclusions=**/*_test.go +sonar.tests=. +sonar.test.inclusions=**/*_test.go + +# The CI workflow generates this profile when it runs make check. +sonar.go.coverage.reportPaths=coverage.out