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

SonarCloud integration #211

Merged
merged 54 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
3adaf0b
initial sonarqube configuration
luluiz Oct 7, 2024
dc37299
updated props
luluiz Oct 7, 2024
4c50d3d
changed sonarqube version
luluiz Oct 7, 2024
a085ceb
changed to v3 scan
luluiz Oct 7, 2024
0d9a4f3
testing sonarcloud
luluiz Oct 7, 2024
639b9fa
changed names
luluiz Oct 7, 2024
eb47e50
testing sonar project key
luluiz Oct 7, 2024
e8a4bc8
paths to sources and tests
luluiz Oct 8, 2024
3eeffcb
path test
luluiz Oct 8, 2024
ff3b3f2
test tsconfig
luluiz Oct 8, 2024
06487ff
testing tsconfig path
luluiz Oct 8, 2024
7410753
Updated sonar props
luluiz Oct 8, 2024
9c593a6
sonarqube
luluiz Oct 8, 2024
97c1b4a
test sonar
luluiz Oct 8, 2024
b11d6e7
removed unnecessary steps from sonarqube action job
luluiz Oct 8, 2024
4483528
install before analisys
luluiz Oct 8, 2024
d77385e
corepack enable
luluiz Oct 8, 2024
b89e0fe
removed yarn install
luluiz Oct 8, 2024
5c0ac1a
instal install with node version
luluiz Oct 8, 2024
e1aed1a
code coverage
luluiz Oct 8, 2024
070ba3f
test
luluiz Oct 8, 2024
0bb5615
config
luluiz Oct 8, 2024
e2825fe
test code changes
luluiz Oct 8, 2024
b6c6385
testing with coverage before sonar scanning
luluiz Oct 8, 2024
eb3bef9
added workflow dispatch
luluiz Oct 8, 2024
4682298
removed unnecessary line
luluiz Oct 8, 2024
48b8727
removed unnecessary code coverage configuration
luluiz Oct 8, 2024
2424eb6
added action on PRs
luluiz Oct 8, 2024
0571173
removed sonarqube from gh action
luluiz Oct 9, 2024
c413af7
removed foced changes
luluiz Oct 9, 2024
db55cf7
added a preblematic component to test sonar failures
luluiz Oct 9, 2024
9d5c01c
fake code
luluiz Oct 9, 2024
8bc00a9
lint configurations
luluiz Oct 9, 2024
3277ec9
added lint and report step
luluiz Oct 9, 2024
abb6b0e
solved lint issues in the dummy problematic component
luluiz Oct 10, 2024
63885b9
lint
luluiz Oct 10, 2024
9786914
quiet lint report
luluiz Oct 10, 2024
ee3e772
removed lint from sonarqube
luluiz Oct 10, 2024
4deb5ea
removed coverage from clean
luluiz Oct 10, 2024
539bb74
tsconfig
luluiz Oct 10, 2024
0670a79
fixed lint issue
luluiz Oct 10, 2024
4000d85
using ProblematicComponent
luluiz Oct 10, 2024
79bf44d
eslint on sonar
luluiz Oct 10, 2024
3e4505c
fixed lint ci report script
luluiz Oct 10, 2024
9aeed89
tests with lint report
luluiz Oct 10, 2024
d1837d2
added configuration to continue on error in the lint step
luluiz Oct 10, 2024
48bca20
added tsc in the step
luluiz Oct 10, 2024
76c0886
listing files
luluiz Oct 10, 2024
337761d
print eslint report
luluiz Oct 10, 2024
6504377
testing path
luluiz Oct 10, 2024
bfb579d
removed sed
luluiz Oct 10, 2024
37492ba
update pathfiles in eslint report json
luluiz Oct 10, 2024
c3fcad6
fixed filepaths from eslint report file
luluiz Oct 10, 2024
ff11d9c
removed dummy code
luluiz Oct 10, 2024
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 .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ignorePatterns:
- "packages/**/wasm/*.js"
- "!.storybook"
- storybook-static
- coverage

plugins:
- file-progress
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: SonarCloud

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
build:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
lfs: true

- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: 16.17

- name: Enable corepack
run: corepack enable yarn

- name: Install dependencies
run: yarn install

- name: Generates lint report and file path formatting
run: |
yarn lint:ci:report
sed -i 's|/home/runner/work/lichtblick/lichtblick/|./|g' eslint-report.json
continue-on-error: true

- name: Test and coverage
run: yarn test:coverage
continue-on-error: true

- name: ScanCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ coverage/

# Extensions
*.foxe

# SonarQube files
.sonar_lock
.scannerwork
eslint-report.json
10 changes: 9 additions & 1 deletion jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,13 @@
"<rootDir>/ci/jest.config.json",
"<rootDir>/desktop/jest.config.json",
"<rootDir>/packages/*/jest.config.json"
]
],
"collectCoverage": true,
"coverageReporters": [
"text",
"lcov",
"json",
"xml"
],
"coverageDirectory": "coverage"
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"node": ">=16"
},
"scripts": {
"clean": "tsc --build --clean packages/**/tsconfig.json && rimraf .webpack */.webpack dist storybook-screenshots storybook-static",
"clean": "tsc --build --clean packages/**/tsconfig.json && rimraf .webpack */.webpack dist storybook-screenshots storybook-static coverage",
"build:packages": "tsc --build --verbose packages/*/tsconfig.json packages/*/src/*/tsconfig.json",
"desktop:build:dev": "webpack --mode development --progress --config desktop/webpack.config.ts",
"desktop:build:prod": "webpack --mode production --progress --config desktop/webpack.config.ts",
Expand All @@ -35,9 +35,11 @@
"license-check": "ts-node ci/license-check.ts",
"lint": "TIMING=1 eslint --report-unused-disable-directives --fix .",
"lint:ci": "TIMING=1 eslint --report-unused-disable-directives --config .eslintrc.ci.yaml .",
"lint:ci:report": "yarn lint:ci -f json -o eslint-report.json --quiet",
"lint:unused-exports": "ts-node ./ci/lint-unused-exports.ts",
"lint:dependencies": "ts-node ./ci/lint-dependencies.ts .",
"test": "jest",
"test:coverage": "jest --coverage",
"test:debug": "cross-env NODE_OPTIONS='--inspect-brk' jest",
"test:watch": "jest --watch",
"test:integration": "jest --forceExit --projects desktop/integration-test",
Expand Down
24 changes: 24 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# General
sonar.projectKey=Lichtblick-Suite_lichtblick
sonar.organization=lichtblick-suite

# TS and Lint
sonar.typescript.tsconfigPath=tsconfig.json
sonar.eslint.reportPaths=eslint-report.json

# Path to sources
sonar.sources=benchmark,ci,desktop,packages,web
sonar.exclusions=**/*.test.ts,**/*.test.tsx
sonar.inclusions=\
**/*.ts,\
**/*.tsx,\
**/*.js,\
**/package.json

# Path to tests
sonar.tests=benchmark,ci,desktop,packages,web
sonar.test.inclusions=**/*.test.ts,**/*.test.tsx

# Code coverage
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.typescript.lcov.reportPaths=coverage/lcov.info
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"./*.js",
"./**/jest.config.ts",
"./ci/**/*.ts",
"./resources/notarize.ts",
luluiz marked this conversation as resolved.
Show resolved Hide resolved
"./package.json"
],
"compilerOptions": {
Expand Down
Loading