Skip to content

Commit

Permalink
[TU-13733] Add SonarCloud configuration (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
vrybas authored Aug 14, 2024
1 parent 7e94e41 commit 4c9aea1
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
node_version:
- 18 # end of life 2025-04-30
- 20 # end of life 2026-04-30
- 22 # end of life 2027-04-03
- 22 # end of life 2027-04-03 # please update SonarCloud below when there is new latest node version
name: build-lint-test - node ${{ matrix.node_version }}
steps:
- name: Check out Git repository
Expand All @@ -39,7 +39,21 @@ jobs:

- run: yarn build
- run: yarn lint
- run: yarn test
- run: yarn test:coverage

- name: Verify coverage file ready
run: find . | grep coverage

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v2
if: ${{ matrix.node_version == '22' }}
with:
args: >
-Dsonar.projectVersion=${{ github.run_id }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }}

functional:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"build": "yarn lerna run build",
"lint": "yarn lerna run lint && yarn docs-prettier-check",
"test": "yarn lerna run test",
"test:coverage": "yarn lerna run test:coverage",
"test:functional": "yarn lerna run test:functional",
"test:visual": "yarn lerna run test:visual",
"release": "sh ./scripts/release.sh",
Expand Down
2 changes: 1 addition & 1 deletion packages/embed-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"demo-nextjs": "cd ../demo-nextjs && yarn start",
"demo": "yarn concurrently 'yarn dev' 'yarn demo-nextjs'",
"test": "jest",
"coverage": "jest --coverage",
"test:coverage": "jest --coverage",
"lint": "eslint src --ext .js,.ts,.jsx,.tsx --max-warnings=0",
"release": "npm config set @typeform:registry https://registry.npmjs.org/ && yarn semantic-release",
"post-release": "yarn release:github",
Expand Down
2 changes: 1 addition & 1 deletion packages/embed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"prettier-check": "prettier --check . --ignore-path .eslintignore",
"prettier": "prettier --write . --ignore-path .eslintignore",
"test": "jest",
"coverage": "jest --coverage",
"test:coverage": "jest --coverage",
"cy:open": "yarn cypress open",
"cy:open:vrt": "yarn cypress open --env testType=visual",
"cy:open:func": "yarn cy:open -c e2e.specPattern=./e2e/spec/functional/",
Expand Down
12 changes: 12 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
sonar.projectKey=Typeform_embed
sonar.organization=typeform
sonar.projectVersion=dev

sonar.sources=packages

sonar.inclusions=packages/*/src/**/*.ts,src/**/*.js
sonar.exclusions=node_modules/**,dist/**,**/*.spec.ts,**/*.test.ts

sonar.test.exclusions=node_modules/**,dist/**

sonar.javascript.lcov.reportPaths=packages/**/coverage/lcov.info

0 comments on commit 4c9aea1

Please sign in to comment.