Skip to content

Add SonarQube Analysis #20

Add SonarQube Analysis

Add SonarQube Analysis #20

Workflow file for this run

name: test
on:
push:
branches-ignore:
- 'dependabot/**' #avoid duplicates: only run the PR, not the commit
tags-ignore:
- 'v*' #avoids rerun existing commit on release
pull_request:
branches:
- 'main'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub repo
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Run unit tests
working-directory: ./dashgit-web/test
run: |
mkdir actual
npm install
npm run report
- name: Publish test report files
if: always()
uses: actions/upload-artifact@v4.3.1
with:
name: "test-report-files"
path: |
dashgit-web/test/expected
dashgit-web/test/actual
dashgit-web/test/mochawesome-report
sonarqube:
needs: [test]
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}