Merge pull request #76 from mean-dao/release/v1.3.23 #123
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SonarQube | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: # do not change to pull_request_target. See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/#:~:text=The%20main%20differences%20between%20the,but%20not%20from%20external%20forks. | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Nodejs | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'yarn' | |
- name: Install | |
run: yarn install | |
- name: Unit Tests | |
run: yarn test:cov | |
# Run the Quality Scanner | |
- name: SonarQube Scanner | |
uses: sonarsource/sonarqube-scan-action@master | |
continue-on-error: true # Skipping this step for PRs from an external fork which will fail because not having access to secrets | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
with: | |
args: > | |
-Dsonar.verbose=false | |
-Dsonar.projectKey=${{ github.event.repository.name }} | |
-Dsonar.sources=. | |
-Dsonar.exclusions=tests/*.ts | |
-Dsonar.tests=tests/ | |
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info | |
# Check the Quality Gate status. | |
- name: SonarQube Quality Gate check | |
id: sonarqube-quality-gate-check | |
uses: sonarsource/sonarqube-quality-gate-action@master | |
# Force to fail step after specific time. | |
timeout-minutes: 5 | |
continue-on-error: true # Skipping this step for PRs from an external fork which will fail because not having access to secrets | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
# 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: "SonarQube Quality Gate Status" | |
# run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}" |