Skip to content

Commit 37aebf1

Browse files
authored
Add SonarCloud CI workflow configuration
This workflow runs SonarCloud analysis daily and on demand, including tests with coverage.
1 parent c1fd79b commit 37aebf1

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/sonarcloud.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Sonarcloud CI
2+
3+
on:
4+
schedule:
5+
# Every day at midnight
6+
- cron: '0 0 * * *'
7+
workflow_dispatch: {}
8+
9+
permissions:
10+
contents: read
11+
pull-requests: read
12+
13+
jobs:
14+
node-sonarqube:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Run lint
31+
run: npm run lint --if-present
32+
33+
- name: Run tests with coverage
34+
run: npm run test:coverage
35+
36+
- name: Cache SonarCloud packages
37+
uses: actions/cache@v4
38+
with:
39+
path: ~/.sonar/cache
40+
key: ${{ runner.os }}-sonar
41+
restore-keys: ${{ runner.os }}-sonar
42+
43+
- name: Run SonarCloud Analysis
44+
env:
45+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
46+
run: |
47+
npx sonar-scanner \
48+
-Dsonar.projectKey=Adyen_adyen-node-api-library \
49+
-Dsonar.organization=adyen \
50+
-Dsonar.sources=. \
51+
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info \
52+
-Dsonar.host.url=https://sonarcloud.io

0 commit comments

Comments
 (0)