|
1 | | -name: Calculate test coverage & update GH badges |
| 1 | +name: Test coverage |
2 | 2 | on:
|
3 | 3 | workflow_dispatch:
|
4 | 4 |
|
|
7 | 7 | runs-on: ubuntu-latest
|
8 | 8 |
|
9 | 9 | steps:
|
10 | | - - uses: actions/checkout@v4 |
11 | | - |
12 | | - - name: Set up JDK 21 |
13 | | - uses: actions/setup-java@v4 |
14 | | - with: |
15 | | - distribution: temurin |
16 | | - java-version: 21 |
17 | | - cache: gradle |
18 | | - |
19 | | - - name: Build with Gradle |
20 | | - run: ./gradlew githubWorkflowTest --no-daemon -i |
21 | | - |
22 | | - - name: Run Test Coverage |
23 | | - run: ./gradlew jacocoTestReport -i -PexecutionData='/home/runner/work/java-interview-coding/java-interview-coding/build/jacoco/jacocoTest.exec' |
24 | | - |
25 | | - - name: Generate JaCoCo Badge |
26 | | - uses: cicirello/jacoco-badge-generator@v2 |
27 | | - with: |
28 | | - generate-branches-badge: true |
29 | | - jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv |
30 | | - |
31 | | - - name: Commit the badge (if it changed) |
32 | | - run: | |
33 | | - if [[ `git status --porcelain` ]]; then |
34 | | - git config --global user.name 'Github workflow' |
35 | | - git config --global user.email 'nowhere@gmail.com' |
36 | | - git add -A |
37 | | - git commit -m "Autogenerated JaCoCo coverage badge" |
38 | | - git push |
39 | | - fi |
40 | | - |
41 | | - - name: Upload JaCoCo coverage report |
42 | | - uses: actions/upload-artifact@v4 |
43 | | - with: |
44 | | - name: jacoco-report |
45 | | - path: build/jacocoHtml/ |
| 10 | + - name: Checkout sources |
| 11 | + uses: actions/checkout@v4 |
| 12 | + |
| 13 | + - name: Set up JDK 21 |
| 14 | + uses: actions/setup-java@v4 |
| 15 | + with: |
| 16 | + distribution: temurin |
| 17 | + java-version: 21 |
| 18 | + cache: gradle |
| 19 | + |
| 20 | + - name: Build with Gradle Wrapper |
| 21 | + run: ./gradlew githubWorkflowTest --no-daemon -i |
| 22 | + |
| 23 | + - name: Run Test Coverage |
| 24 | + run: ./gradlew jacocoTestReport -i -PexecutionData='/home/runner/work/java-interview-coding/java-interview-coding/build/jacoco/jacocoTest.exec' |
| 25 | + |
| 26 | + - name: Generate JaCoCo Badge |
| 27 | + uses: cicirello/jacoco-badge-generator@v2 |
| 28 | + with: |
| 29 | + generate-branches-badge: true |
| 30 | + jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv |
| 31 | + |
| 32 | + - name: Commit the badge (if it changed) |
| 33 | + run: | |
| 34 | + if [[ `git status --porcelain` ]]; then |
| 35 | + git config --global user.name 'Github workflow' |
| 36 | + git config --global user.email 'nowhere@gmail.com' |
| 37 | + git add -A |
| 38 | + git commit -m "Autogenerated JaCoCo coverage badge" |
| 39 | + git push |
| 40 | + fi |
| 41 | + |
| 42 | + - name: Upload JaCoCo coverage report |
| 43 | + uses: actions/upload-artifact@v4 |
| 44 | + with: |
| 45 | + name: jacoco-report |
| 46 | + path: build/jacocoHtml/ |
0 commit comments