Skip to content

Implement API/Client Sonarcloud GitHub Action #1

Implement API/Client Sonarcloud GitHub Action

Implement API/Client Sonarcloud GitHub Action #1

name: Test Client, Generate Coverage, and Run SonarCloud Analysis
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- "client/src/**"
- ".github/workflows/client-sonarcloud.yml"
push:
branches:
- main
paths:
- "client/src/**"
- ".github/workflows/client-sonarcloud.yml"
permissions:
pull-requests: read # allows SonarCloud to decorate PRs with analysis results
jobs:
SonarCloudAnalysis-Client:
name: SonarCloud Analysis client
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Important to fetch all history for accurate blame information
- name: Analyze client with SonarCloud
uses: SonarSource/sonarcloud-github-action@v2.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.CLIENT_SONAR_TOKEN }} # Needed to push to SonarCloud
with:
projectBaseDir: ./client/src
# Additional arguments for the sonarcloud scanner
args:
-Dsonar.projectKey=nuwcdivnpt_stig-manager-client
-Dsonar.projectName=nuwcdivnpt_stig-manager-client
-Dsonar.organization=nuwcdivnpt
-Dsonar.inclusions=**/*.js,**/*.html
-Dsonar.exclusions=**/node_modules/**
# This will fail the action if Quality Gate fails (leaving out for now )
# - name: Check Quality Gate
# uses: sonarsource/sonarqube-quality-gate-action@master
# env:
# SONAR_TOKEN: