Skip to content

Commit

Permalink
[Misc] Enable sonar coverage (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhprasad-sap authored Jun 28, 2024
1 parent 7057d3d commit 46f1d3a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
29 changes: 26 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,35 @@ jobs:
matrix:
node-version: [20.x, 18.x]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm i -g @sap/cds-dk
- run: npm i
- run: cds v
- run: npm run test
- run: npm run test

analysis:
name: Analyze with Sonar Cloud
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out code for Sonar Analysis
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- name: run coverage tests
run: |
npm i -g @sap/cds-dk
npm i
npm run test-coverage-lcov
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
runs-on: ubuntu-latest
environment: npm
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
Expand Down
8 changes: 8 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sonar.projectKey=cap-js_cap-operator-plugin
sonar.organization=cap-js

sonar.language=js

sonar.sources=lib,bin
sonar.exclusions=**/node_modules/**,**/files/**,**/hack/**,cds-plugin.js,**/test/**
sonar.tests=test

0 comments on commit 46f1d3a

Please sign in to comment.