Skip to content

Commit a95faf8

Browse files
committed
feat: sonar scan addition
1 parent 1ca2c55 commit a95faf8

2 files changed

Lines changed: 25 additions & 10 deletions

File tree

.github/workflows/unit-testing.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
name: Unit Testing
22
env:
33
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4-
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
55
on:
6+
push:
7+
branches:
8+
- main
69
pull_request:
7-
types: [opened, edited, synchronize, reopened]
10+
types: [opened, synchronize, reopened]
811

912
jobs:
10-
install-lint-and-test:
13+
install-lint-test-scan:
1114
runs-on: ubuntu-latest
1215
steps:
16+
# Checkout the repository
1317
- uses: actions/checkout@v3
1418
with:
1519
fetch-depth: 0
16-
20+
# Setup Node environment
1721
- name: Setup Node
1822
uses: actions/setup-node@v3
1923
with:
2024
node-version: 18.x
21-
25+
cache: 'yarn'
26+
# Load previous cache
2227
- name: ESLint Cache
2328
uses: actions/cache@v3
2429
with:
@@ -27,12 +32,12 @@ jobs:
2732

2833
- name: Install Dependencies
2934
run: yarn install --immutable
30-
35+
# Verify linting
3136
- name: Lint
3237
run: yarn lint
33-
38+
# Run unit tests with coverage
3439
- name: test
3540
run: yarn test:unit:coverage
36-
37-
# - name: SonarCloud Scan
38-
# uses: sonarsource/sonarcloud-github-action@master
41+
# Run Code Analysis Scan
42+
- name: SonarCloud Scan
43+
uses: SonarSource/sonarcloud-github-action@master

sonar-project.properties

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sonar.organization=vangalilea
2+
sonar.projectKey=vanGalilea_react-native-testing
3+
sonar.javascript.lcov.reportPaths=coverage/lcov.info
4+
sonar.sources=src/
5+
sonar.test.exclusions=**/__tests__/**
6+
sonar.coverage.exclusions=**/__tests__/**, **/__mocks__/**
7+
sonar.coverage.inclusions=**/src/**/**.ts|tsx
8+
sonar.exclusions=**/android/**, **/ios/**
9+
sonar.verbose=true
10+
sonar.host.url=https://sonarcloud.io

0 commit comments

Comments
 (0)