Skip to content

fix: BIPS-35966/35972/35987/35993/35997 security and correctness fixes #456

fix: BIPS-35966/35972/35987/35993/35997 security and correctness fixes

fix: BIPS-35966/35972/35987/35993/35997 security and correctness fixes #456

Workflow file for this run

name: SonarQube
env:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_PUBLIC_REPOS }}
on:
pull_request:
types: [opened, synchronize]
workflow_dispatch:
permissions:
contents: read
jobs:
sonarqube:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: 'go.mod'
cache: true
- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_wrapper: false
- name: Run unit tests
run: |
export TF_ACC=1
go mod tidy
go test ./providers/... -cover -coverprofile=coverage.out -v
ls -alt
go tool cover -func="coverage.out"
- name: SonarQube Scan on PR
if: ${{ github.event_name == 'pull_request' && !startsWith(github.head_ref, 'dependabot/') }}
uses: sonarsource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602 # v6.0.0
with:
projectBaseDir: .
args: >
-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=**/*_test.go
-Dsonar.go.coverage.reportPaths=coverage.out
env:
SONAR_TOKEN: ${{ env.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ env.SONAR_HOST_URL}}
- name: SonarQube Scan on branch
if: ${{ github.event_name != 'pull_request' && !startsWith(github.head_ref, 'dependabot/') }}
uses: sonarsource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602 # v6.0.0
with:
projectBaseDir: .
args: >
-Dsonar.projectKey=${{ github.event.repository.name }}
-Dsonar.exclusions=**/*_test.go
-Dsonar.go.coverage.reportPaths=coverage.out
env:
SONAR_TOKEN: ${{ env.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ env.SONAR_HOST_URL}}
- name: SonarQube Quality Gate check
if: ${{ github.event_name != 'pull_request' && !startsWith(github.head_ref, 'dependabot/') }}
uses: sonarsource/sonarqube-quality-gate-action@cf038b0e0cdecfa9e56c198bbb7d21d751d62c3b # v1.2.0
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ env.SONAR_TOKEN }}