Skip to content

Commit c7a107a

Browse files
committed
AUT-1705: Adding SonarQube for react-client.
1 parent 1a58f06 commit c7a107a

1 file changed

Lines changed: 38 additions & 2 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Checkout code
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
2224

2325
- name: Set up nodejs
2426
uses: actions/setup-node@v2
@@ -33,7 +35,7 @@ jobs:
3335
run: npm run check
3436

3537
- name: npm Test
36-
run: npm run build && npm run test # tests require build to use JS SDK in localhost mode
38+
run: npm run build && npm run test -- --coverage # tests require build to use JS SDK in localhost mode
3739

3840
- name: npm Build
3941
run: BUILD_BRANCH=$(echo "${GITHUB_REF#refs/heads/}") BUILD_COMMIT=${{ github.sha }} npm run build
@@ -69,3 +71,37 @@ jobs:
6971
SOURCE_DIR: ./umd
7072
DEST_DIR: sdk
7173
ARGS: --acl public-read --follow-symlinks --cache-control max-age=31536000,public
74+
75+
76+
- name: SonarQube Scan (Push)
77+
if: github.event_name == 'push'
78+
uses: SonarSource/sonarcloud-github-action@v1.6
79+
env:
80+
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
81+
with:
82+
projectBaseDir: .
83+
args: >
84+
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
85+
-Dsonar.projectName=${{ github.event.repository.name }}
86+
-Dsonar.projectKey=${{ github.event.repository.name }}
87+
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
88+
-Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
89+
-Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
90+
91+
- name: SonarQube Scan (Pull Request)
92+
if: github.event_name == 'pull_request'
93+
uses: SonarSource/sonarcloud-github-action@v1.6
94+
env:
95+
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
96+
with:
97+
projectBaseDir: .
98+
args: >
99+
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
100+
-Dsonar.projectName=${{ github.event.repository.name }}
101+
-Dsonar.projectKey=${{ github.event.repository.name }}
102+
-Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
103+
-Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
104+
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
105+
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
106+
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
107+
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}

0 commit comments

Comments
 (0)