Skip to content

Commit

Permalink
Moved SonarQube jobs to a dedicated workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
simao-silva committed Oct 9, 2023
1 parent 70355e7 commit a967f5c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 42 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/pr-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,12 @@ jobs:

- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Check isort compliance
uses: isort/[email protected]
with:
sort-paths: renew.py

# Triggering SonarQube analysis as results of it are required by Quality Gate check
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

# Check the Quality Gate status
- uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

# Output from the Quality Gate
# The possible outputs of the "quality-gate-status" variable are "PASSED", "WARN" or "FAILED"
- name: "Example show SonarQube Quality Gate Status value"
if: always() # Run even if Quality Gate check failed
run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}"

- name: Build image for tests
uses: docker/[email protected]
with:
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/pr-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,12 @@ jobs:

- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Check isort compliance
uses: isort/[email protected]
with:
sort-paths: renew.py

# Triggering SonarQube analysis as results of it are required by Quality Gate check
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

# Check the Quality Gate status
- uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

# Output from the Quality Gate
# The possible outputs of the "quality-gate-status" variable are "PASSED", "WARN" or "FAILED"
- name: "Example show SonarQube Quality Gate Status value"
if: always() # Run even if Quality Gate check failed
run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}"

- name: Build image for tests
uses: docker/[email protected]
with:
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: SonarQube analysis

on:
# Trigger analysis when pushing in master or pull requests, and when creating
# a pull request.
push:
branches:
- master
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
build_alpine:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

# Triggering SonarQube analysis as results of it are required by Quality Gate check
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

# Check the Quality Gate status
- uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

# Output from the Quality Gate
# The possible outputs of the "quality-gate-status" variable are "PASSED", "WARN" or "FAILED"
- name: "Example show SonarQube Quality Gate Status value"
if: always() # Run even if Quality Gate check failed
run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}"

0 comments on commit a967f5c

Please sign in to comment.