|
14 | 14 |
|
15 | 15 | jobs:
|
16 | 16 | build:
|
17 |
| - if: github.event_name != 'release' && endsWith(github.ref, '/master') == true |
| 17 | + if: github.event_name != 'release' |
18 | 18 | runs-on: ubuntu-latest
|
19 | 19 | steps:
|
20 | 20 | - uses: actions/checkout@v2
|
| 21 | + with: |
| 22 | + fetch-depth: 0 |
21 | 23 | - name: Set up JDK 11
|
22 | 24 | uses: actions/setup-java@v1
|
23 | 25 | with:
|
24 | 26 | java-version: 11
|
25 | 27 | - name: Grant execute permission for gradlew
|
26 | 28 | run: chmod +x gradlew
|
27 |
| - - name: Execute build test and jacocoTestReport |
| 29 | + - name: Execute build test jacocoTestReport and sonar analysis |
| 30 | + if: endsWith(github.REF, '/master') == true |
28 | 31 | env:
|
29 | 32 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
30 | 33 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
31 |
| - run: ./gradlew build test jacocoTestReport sonarqube --refresh-dependencies --no-daemon --continue |
32 |
| - build_pull_request: |
33 |
| - if: github.event_name != 'release' && endsWith(github.REF, '/merge') == true |
34 |
| - runs-on: ubuntu-latest |
35 |
| - steps: |
36 |
| - - uses: actions/checkout@v2 |
37 |
| - with: |
38 |
| - fetch-depth: 0 |
39 |
| - - name: Set up JDK 11 |
40 |
| - uses: actions/setup-java@v1 |
41 |
| - with: |
42 |
| - java-version: 11 |
43 |
| - - name: Grant execute permission for gradlew |
44 |
| - run: chmod +x gradlew |
45 |
| - - name: Execute build test and jacocoTestReport |
| 34 | + run: ./gradlew build test jacocoTestReport sonarqube --refresh-dependencies --no-daemon --continue --stacktrace |
| 35 | + - name: Execute build test jacocoTestReport and sonar analysis for pull request |
| 36 | + if: endsWith(github.REF, '/merge') == true |
46 | 37 | env:
|
47 | 38 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
48 | 39 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
52 | 43 | -Dsonar.pullrequest.base=${{ github.BASE_REF }}
|
53 | 44 | -Dsonar.pullrequest.github.repository=${{ github.repository }}
|
54 | 45 | --refresh-dependencies --no-daemon --continue --stacktrace
|
55 |
| -# run: ./gradlew test jacocoTestReport && cp build/reports/jacoco/report.xml jacoco.xml || echo "Code coverage failed" |
56 |
| -# - name: Push codeCoverage to Codecov |
57 |
| -# run: bash <(curl -s https://codecov.io/bash) |
58 | 46 |
|
59 | 47 | release:
|
60 | 48 | if: github.event_name == 'release'
|
|
0 commit comments