Skip to content

Commit 36c7e61

Browse files
Merge pull request #118 from splitio/enhancement/AUT-1705
AUT-1705: Adding SonarQube for react-client.
2 parents acd9988 + dfe5192 commit 36c7e61

1 file changed

Lines changed: 38 additions & 5 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ jobs:
2323
steps:
2424
- name: Checkout code
2525
uses: actions/checkout@v3
26+
with:
27+
fetch-depth: 0
2628

27-
- name: Setup Node.js
29+
- name: Set up nodejs
2830
uses: actions/setup-node@v3
2931
with:
3032
node-version: '16.16.0'
@@ -36,10 +38,8 @@ jobs:
3638
- name: npm check
3739
run: npm run check
3840

39-
- name: npm build and test
40-
run: |
41-
npm run build
42-
npm run test
41+
- name: npm test
42+
run: npm run test -- --coverage
4343

4444
- name: npm build
4545
run: BUILD_BRANCH=$(echo "${GITHUB_REF#refs/heads/}") BUILD_COMMIT=${{ github.sha }} npm run build
@@ -137,3 +137,36 @@ jobs:
137137
SOURCE_DIR: ./umd
138138
DEST_DIR: sdk
139139
ARGS: --acl public-read --follow-symlinks --cache-control max-age=31536000,public
140+
141+
- name: SonarQube Scan (Push)
142+
if: github.event_name == 'push'
143+
uses: SonarSource/sonarcloud-github-action@v1.8
144+
env:
145+
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
146+
with:
147+
projectBaseDir: .
148+
args: >
149+
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
150+
-Dsonar.projectName=${{ github.event.repository.name }}
151+
-Dsonar.projectKey=${{ github.event.repository.name }}
152+
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
153+
-Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
154+
-Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
155+
156+
- name: SonarQube Scan (Pull Request)
157+
if: github.event_name == 'pull_request'
158+
uses: SonarSource/sonarcloud-github-action@v1.8
159+
env:
160+
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
161+
with:
162+
projectBaseDir: .
163+
args: >
164+
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
165+
-Dsonar.projectName=${{ github.event.repository.name }}
166+
-Dsonar.projectKey=${{ github.event.repository.name }}
167+
-Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
168+
-Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
169+
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
170+
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
171+
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
172+
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}

0 commit comments

Comments
 (0)