Skip to content

Commit

Permalink
Add Sonar Cloud analysis with getting Code Coverage (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
sievdokymov-virtru authored Jul 27, 2023
1 parent fb2f90b commit 0f02f27
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ jobs:
with:
name: opentdf-client-lib
path: ./lib/opentdf-client-*.tgz
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

web-app:
needs:
Expand Down
2 changes: 1 addition & 1 deletion lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"scripts": {
"build": "npm run clean && tsc && tsc --project tsconfig.commonjs.json && ../scripts/add-module-types.sh",
"clean": "rm -rf {build,coverage,dist}",
"coverage:merge": "for x in mocha wtr; do cp coverage/$x/coverage-final.json coverage/$x.json; done; nyc report --reporter text -t coverage --lines 75 --statements 75 --branches 70 --functions 65 --check-coverage >coverage/coverage.txt",
"coverage:merge": "for x in mocha wtr; do cp coverage/$x/coverage-final.json coverage/$x.json; done; nyc report --reporter text --reporter lcov -t coverage --lines 75 --statements 75 --branches 70 --functions 65 --check-coverage >coverage/coverage.txt",
"doc": "typedoc --out dist/docs src/index.ts",
"format": "prettier --write \"{src,tdf3,tests}/**/*.ts\"",
"license-check": "license-checker-rseidelsohn --production --onlyAllow 'Apache-2.0; BSD; CC-BY-4.0; ISC; MIT'",
Expand Down
20 changes: 20 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# must be unique in a given SonarQube instance
sonar.projectKey=opentdf_client-web

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=lib/src,lib/tdf3,web-app/src,web-app/public

sonar.host.url=https://sonarcloud.io
sonar.organization=opentdf

# code coverage
sonar.javascript.lcov.reportPaths=lib/coverage/lcov.info
# sonar.tests=tests

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8

# Ignore generated files during analysis
# Also, ignore healthz file since it is itself a test, and does not need testing.
# sonar.exclusions=public/js/*.js,public/css/*.css,lib/app/routes/healthz.js

0 comments on commit 0f02f27

Please sign in to comment.