Skip to content

Commit 71607a3

Browse files
committed
ci: move sonar to own workflow and use official action
1 parent 1d6d12c commit 71607a3

File tree

2 files changed

+28
-30
lines changed

2 files changed

+28
-30
lines changed

.github/workflows/sonarqube.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
on:
2+
# Trigger analysis when pushing to your main branches, and when creating a pull request.
3+
push:
4+
branches:
5+
- main
6+
- master
7+
- develop
8+
- 'releases/**'
9+
pull_request:
10+
types: [opened, synchronize, reopened]
11+
12+
name: SonarQube Main Workflow
13+
jobs:
14+
sonarqube:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
# Disabling shallow clones is recommended for improving the relevancy of reporting
20+
fetch-depth: 0
21+
- name: Install
22+
run: npm ci
23+
- name: Test
24+
run: npm run test:unit --coverage
25+
- name: SonarQube Scan
26+
uses: SonarSource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9 # v7.0.0
27+
env:
28+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/test-and-lint.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,3 @@ jobs:
1717
run: npm ci
1818
- name: Test
1919
run: npm run test
20-
21-
unit-test-and-sonar:
22-
name: Unit tests and coverage for sonar
23-
runs-on: ubuntu-latest
24-
steps:
25-
- name: Checkout
26-
uses: actions/checkout@v3
27-
with:
28-
fetch-depth: 0
29-
- uses: actions/setup-java@v3
30-
with:
31-
distribution: 'temurin'
32-
java-version: '17'
33-
- name: Set up node
34-
uses: actions/setup-node@v3
35-
with:
36-
node-version: '24'
37-
- name: Install
38-
run: npm ci
39-
- name: Test
40-
run: npm run test:unit --coverage
41-
- name: Setup Sonar Scanner
42-
uses: warchant/setup-sonar-scanner@v8
43-
- name: Run sonarqube
44-
env:
45-
# to get access to secrets.SONAR_TOKEN, provide GITHUB_TOKEN
46-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
run: sonar-scanner
48-
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
49-
-Dsonar.host.url=https://sonarcloud.io/

0 commit comments

Comments
 (0)