|
23 | 23 | steps: |
24 | 24 | - name: Checkout code |
25 | 25 | uses: actions/checkout@v3 |
| 26 | + with: |
| 27 | + fetch-depth: 0 |
26 | 28 |
|
27 | | - - name: Setup Node.js |
| 29 | + - name: Set up nodejs |
28 | 30 | uses: actions/setup-node@v3 |
29 | 31 | with: |
30 | 32 | node-version: '16.16.0' |
|
36 | 38 | - name: npm check |
37 | 39 | run: npm run check |
38 | 40 |
|
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 |
43 | 43 |
|
44 | 44 | - name: npm build |
45 | 45 | run: BUILD_BRANCH=$(echo "${GITHUB_REF#refs/heads/}") BUILD_COMMIT=${{ github.sha }} npm run build |
@@ -137,3 +137,36 @@ jobs: |
137 | 137 | SOURCE_DIR: ./umd |
138 | 138 | DEST_DIR: sdk |
139 | 139 | 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