Merge pull request #137 from eclipse-tractusx/dependabot/npm_and_yarn… #25
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: "Sonar Cloud Workflow" | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
paths: | |
- 'src/**' | |
- 'package.json' | |
- 'Dockerfile' | |
workflow_call: | |
secrets: | |
SONAR_TOKEN: | |
required: true | |
workflow_dispatch: | |
# Trigger manually | |
jobs: | |
Analysis: | |
name: Analyse | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [ 20.x ] | |
steps: | |
- uses: actions/checkout@v4 | |
# Add this step to remove the cache | |
- name: Clear cache | |
run: | | |
rm -rf node_modules | |
rm -f package-lock.json | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Run npm install | |
run: npm install --legacy-peer-deps | |
- name: Build and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: npm run coverage | |
- name: Test | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |