|
3 | 3 | # Tests are executed and coverage reports are emitted as to the action summary |
4 | 4 | # A dependent workflow which uses workflow_run as a trigger reads the archived outputs and emits comments to the PR triggering this build |
5 | 5 |
|
6 | | -name: Build pr |
| 6 | +name: Build and Test |
7 | 7 |
|
8 | 8 | on: |
| 9 | + push: |
| 10 | + branches: [main, release/**, next/**] |
9 | 11 | pull_request: |
10 | 12 | branches: [main, release/**, next/**] |
11 | 13 |
|
@@ -35,18 +37,19 @@ jobs: |
35 | 37 | - run: yarn build |
36 | 38 | - run: yarn lint |
37 | 39 | - run: yarn test |
| 40 | + |
38 | 41 | - name: Archive test results |
39 | 42 | uses: actions/upload-artifact@v2 # upload test results |
40 | 43 | if: always() # run this step even if previous step failed |
41 | 44 | with: |
42 | 45 | name: test-results |
43 | 46 | path: testResults/junit.xml |
44 | | - - name: Archive coverage report |
45 | | - uses: actions/upload-artifact@v2 # upload coverage report |
| 47 | + - name: Archive coverage artifacts |
| 48 | + uses: actions/upload-artifact@v3 # upload coverage rartifacts |
46 | 49 | if: always() # run this step even if previous step failed |
47 | 50 | with: |
48 | 51 | name: coverage |
49 | | - path: coverage/cobertura-coverage.xml |
| 52 | + path: coverage/ |
50 | 53 |
|
51 | 54 | - name: Code Coverage Summary Report |
52 | 55 | |
|
72 | 75 | - name: One or more build matrix options failed |
73 | 76 | if: ${{ contains(needs.*.result, 'failure') }} |
74 | 77 | run: exit 1 |
| 78 | + |
| 79 | + sonarcloud: |
| 80 | + name: SonarCloud Analysis |
| 81 | + runs-on: ubuntu-latest |
| 82 | + needs: build |
| 83 | + steps: |
| 84 | + - uses: actions/checkout@v3 |
| 85 | + |
| 86 | + - uses: actions/download-artifact@v3 |
| 87 | + with: |
| 88 | + name: coverage |
| 89 | + path: coverage/ |
| 90 | + |
| 91 | + - name: Run sonar cloud analysis |
| 92 | + uses: SonarSource/sonarcloud-github-action@master |
| 93 | + env: |
| 94 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any |
| 95 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
0 commit comments