Skip to content

Commit

Permalink
ci: adding sonarqube steps (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivgonzalezc authored Feb 21, 2024
1 parent 9a5fca1 commit 1aaa145
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Run unit tests
run: |
cd api
go test -race -coverprofile=coverage.out -v ./...
go tool cover -func="coverage.out"
- name: Save unit tests coverage
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage.xml
path: api/coverage.out

sonarqube:
# Sonar scan is not required for dependabot PRs
Expand All @@ -55,9 +61,9 @@ jobs:
-Dsonar.projectKey=${{ github.event.repository.name }}
-Dsonar.pullrequest.key=${{ github.event.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=${{ github.base_ref }}
# -Dsonar.exclusions=
# -Dsonar.go.coverage.reportPaths=
-Dsonar.pullrequest.base=${{ github.base_ref }}}
-Dsonar.go.coverage.reportPaths=coverage.out
-Dsonar.exclusions=api/**/**_test.go,api/entities/**,api/logging/**,api/utils/**,main.go
env:
SONAR_TOKEN: ${{ env.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonar.dev.beyondtrust.com
Expand All @@ -69,8 +75,8 @@ jobs:
projectBaseDir: .
args: >
-Dsonar.projectKey=${{ github.event.repository.name }}
# -Dsonar.exclusions=
# -Dsonar.go.coverage.reportPaths=
-Dsonar.go.coverage.reportPaths=coverage.out
-Dsonar.exclusions=api/**/**_test.go,api/entities/**,api/logging/**,api/utils/**,main.go
env:
SONAR_TOKEN: ${{ env.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonar.dev.beyondtrust.com
Expand All @@ -85,6 +91,7 @@ jobs:
x-ray:
needs: [build, sonarqube]
runs-on: ubuntu-latest
if: false
steps:

- name: Publish Build Information
Expand Down

0 comments on commit 1aaa145

Please sign in to comment.