Skip to content

Commit 6678929

Browse files
committed
chore: add sonarqube integration
1 parent c394dff commit 6678929

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

.github/workflows/build.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [ opened, synchronize, reopened ]
9+
10+
jobs:
11+
test:
12+
timeout-minutes: 10
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Install node
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 18
25+
26+
- name: Install pnpm
27+
uses: pnpm/action-setup@v2
28+
with:
29+
version: latest
30+
run_install: false
31+
32+
- name: Get pnpm store directory
33+
id: pnpm-cache
34+
shell: bash
35+
run: |
36+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
37+
38+
- uses: actions/cache@v3
39+
name: Setup pnpm cache
40+
with:
41+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
42+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
43+
restore-keys: |
44+
${{ runner.os }}-pnpm-store-
45+
46+
- name: Check dependency cache
47+
uses: actions/cache@v3
48+
id: cache-dependencies
49+
with:
50+
path: node_modules
51+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
52+
53+
- name: Install dependencies
54+
if: steps.cache-dependencies.outputs.cache-hit != 'true'
55+
run: pnpm install --frozen-lockfile --ignore-scripts
56+
57+
- name: Run tests
58+
run: pnpm coverage
59+
60+
- name: SonarCloud Scan
61+
uses: SonarSource/sonarcloud-github-action@master
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/.idea
22
/.husky
33
/coverage
4+
/.github
45
/lib
56
.eslintrc.yml
67
.gitignore

sonar-project.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sonar.projectKey=r2don_nest-http-interface
2+
sonar.organization=r2don
3+
sonar.javascript.lcov.reportPaths=coverage/lcov.info

0 commit comments

Comments
 (0)