Skip to content

Commit

Permalink
chore: add sonar analysis in the CI
Browse files Browse the repository at this point in the history
Signed-off-by: Joris Mancini <joris.mancini_externe@rte-france.com>
  • Loading branch information
TheMaskedTurtle committed Sep 18, 2024
1 parent d6bc20b commit bf2bd73
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ module.exports = {
rules: {
'prettier/prettier': 'warn',
},
ignorePatterns: [
'coverage',
]
};
1 change: 1 addition & 0 deletions .github/config/.licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ header:
- '**/*.svg'
- '**/*.css'
- '**/*.conf'
- '**/*.properties'

comment: on-failure
17 changes: 15 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: CI
on: [push]
on:
push:
branches:
- 'main'
tags:
- 'v[0-9]*'
pull_request:

jobs:
license-headers:
Expand All @@ -24,6 +30,7 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false

- name: FixForNodeWarnings
Expand All @@ -35,5 +42,11 @@ jobs:
npm install
npm run licenses-check
npm run lint
npm run test
npm run test:coverage
npm run build
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v3.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"build": "vite build",
"prepublishOnly": "$npm_execpath run build",
"test": "jest",
"test:coverage": "jest --coverage",
"start": "vite demo/ --config vite.config.ts --open",
"lint": "eslint . --ext js,mjs,jsx,ts,mts,tsx --max-warnings 0",
"licenses-check": "license-checker --summary --excludePrivatePackages --production --onlyAllow \"$( jq -r .onlyAllow[] license-checker-config.json | tr '\n' ';')\" --excludePackages \"$( jq -r .excludePackages[] license-checker-config.json | tr '\n' ';')\""
Expand Down
4 changes: 4 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sonar.projectKey=powsybl_powsybl-diagram-viewer
sonar.organization=powsybl-ci-github
sonar.projectBaseDir=src
sonar.javascript.lcov.reportPaths=./coverage/lcov.info

0 comments on commit bf2bd73

Please sign in to comment.