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

chore: add sonar analysis in build CI #109

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
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
21 changes: 17 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: CI

on: [push]
on:
push:
branches:
- 'main'
tags:
- 'v[0-9]*'
pull_request:

jobs:
license-headers:
Expand All @@ -18,14 +24,15 @@ jobs:
uses: apache/skywalking-eyes/[email protected]
with:
config: .github/config/.licenserc.yaml

build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
fetch-depth: 0
persist-credentials: false

- name: Parse tag
Expand All @@ -36,9 +43,15 @@ jobs:
run: |
npm install
npm run licenses-check
npm run-script test
npm run-script lint
npm run-script build
npm run-script test
npm run-script test:coverage

- name: SonarCloud Scan
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Build and publish Docker image - Main
if: github.ref == 'refs/heads/main'
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"start": "PORT=3003 react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --watchAll=false --transformIgnorePatterns \"node_modules/(?!@gridsuite/commons-ui|react-dnd|dnd-core|@react-dnd)\" --moduleNameMapper \"{\\\"^.+\\\\\\.(css|less|scss)$\\\": \\\"identity-obj-proxy\\\"}\"",
"test:coverage": "react-scripts test --coverage --watchAll=false --transformIgnorePatterns \"node_modules/(?!@gridsuite/commons-ui|react-dnd|dnd-core|@react-dnd)\" --moduleNameMapper \"{\\\"^.+\\\\\\.(css|less|scss)$\\\": \\\"identity-obj-proxy\\\"}\"",
"eject": "react-scripts eject",
"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 All @@ -50,6 +51,10 @@
}
},
"eslintConfig": {
"ignorePatterns": [
"build",
"coverage"
],
"extends": [
"react-app",
"plugin:prettier/recommended"
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=gridsuite_griddyna-app
sonar.organization=gridsuite
sonar.projectBaseDir=src
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
Loading