47 lines
1.5 KiB
YAML
47 lines
1.5 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
workflow_dispatch:
|
|
|
|
|
|
name: SonarQube Scan
|
|
jobs:
|
|
sonarqube:
|
|
name: SonarQube Trigger
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checking out
|
|
uses: actions/checkout@v4
|
|
with:
|
|
# Disabling shallow clone is recommended for improving relevancy of reporting
|
|
fetch-depth: 0
|
|
- name: SonarQube Scan
|
|
uses: https://github.com/sonarsource/sonarqube-scan-action@master
|
|
with:
|
|
pollingTimeoutSec: 600
|
|
args: >
|
|
-Dsonar.projectKey=$SONAR_PROJECT_KEY
|
|
-Dsonar.verbose=true
|
|
env:
|
|
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
|
|
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
|
SONAR_PROJECT_KEY: ${{ secrets.SONARQUBE_PROJECT_KEY }}
|
|
|
|
# Check the Quality Gate status.
|
|
- name: SonarQube Quality Gate check
|
|
id: sonarqube-quality-gate-check
|
|
uses: https://github.com/sonarsource/sonarqube-quality-gate-action@master
|
|
with:
|
|
pollingTimeoutSec: 600
|
|
env:
|
|
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
|
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} #OPTIONAL
|
|
|
|
# Optionally you can use the output from the Quality Gate in another step.
|
|
# The possible outputs of the `quality-gate-status` variable are `PASSED`, `WARN` or `FAILED`.
|
|
- name: "Show SonarQube Quality Gate Status value"
|
|
run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}"
|
|
|