Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/sonar scanner #1016

Merged
merged 4 commits into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 32 additions & 7 deletions .github/workflows/frontend_sonar_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,40 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Cache dependencies
uses: actions/cache@v2
with:
path: govtool/frontend/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('govtool/frontend/package-lock.json') }}

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: "govtool/frontend/.nvmrc"

- name: 🧪 Test
working-directory: govtool/frontend
env:
NODE_OPTIONS: "--max_old_space_size=4096"
run: |
npm install
npm run test:coverage

# Running with docker
#
# - name: Run SonarQube Scanner
# run: |
# docker run --rm \
# -e SONAR_HOST_URL="https://sonarcloud.io" \
# -e SONAR_TOKEN="ec4183646e59dd70c8077acfabe52062ccbea7a9" \
# -v "$(pwd):/usr/src" \
# --workdir=/usr/src/govtool/frontend \
# sonarsource/sonar-scanner-cli:5.0.1

- uses: sonarsource/sonarqube-scan-action@master
with:
projectBaseDir: govtool/frontend
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io

# Fail the build if it doesn't meet quality gate
# - uses: sonarsource/sonarqube-quality-gate-action@master
# timeout-minutes: 5
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io
Loading