Skip to content

Commit 6052324

Browse files
authored
Merge pull request #1570 from Adyen/node-cloud-workflow
Create SonarCloud workflow
2 parents c1fd79b + 2de8f71 commit 6052324

File tree

2 files changed

+49
-16
lines changed

2 files changed

+49
-16
lines changed

.github/workflows/node-ci.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,3 @@ jobs:
6161
run: npm install
6262
- name: Run tests with coverage
6363
run: npm run test:coverage
64-
65-
node-sonarqube:
66-
runs-on: ubuntu-latest
67-
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
68-
needs: node-test
69-
permissions:
70-
pull-requests: write
71-
72-
steps:
73-
- uses: actions/checkout@v4
74-
with:
75-
fetch-depth: 0
76-
- name: SonarQube Scan
77-
uses: SonarSource/sonarqube-scan-action@v6
78-
env:
79-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/sonarcloud.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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 tests with coverage
31+
run: npm run test:coverage
32+
33+
- name: Cache SonarCloud packages
34+
uses: actions/cache@v4
35+
with:
36+
path: ~/.sonar/cache
37+
key: ${{ runner.os }}-sonar
38+
restore-keys: ${{ runner.os }}-sonar
39+
40+
- name: Run SonarCloud Analysis
41+
env:
42+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
43+
run: |
44+
npx sonar-scanner \
45+
-Dsonar.projectKey=Adyen_adyen-node-api-library \
46+
-Dsonar.organization=adyen \
47+
-Dsonar.sources=. \
48+
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info \
49+
-Dsonar.host.url=https://sonarcloud.io

0 commit comments

Comments
 (0)