16
16
17
17
jobs :
18
18
build :
19
+ if : github.event_name == 'push' || github.event.pull_request.head.repo.owner.login == 'dnsjava'
19
20
strategy :
20
21
fail-fast : false
21
22
matrix :
22
23
os : [ ubuntu-latest, windows-latest ]
23
24
java : [ '17' ]
24
25
arch : [ 'x64' ]
25
- include :
26
- - os : windows-latest
27
- java : ' 17'
28
- arch : x86
26
+ # include:
27
+ # - os: windows-latest
28
+ # java: '17'
29
+ # arch: x86
29
30
30
31
name : Java ${{ matrix.java }}/${{ matrix.arch }}/${{ matrix.os }}
31
32
runs-on : ${{ matrix.os }}
@@ -44,29 +45,55 @@ jobs:
44
45
distribution : temurin
45
46
cache : maven
46
47
47
- - name : Cache SonarCloud packages
48
- uses : actions/cache@v3
49
- with :
50
- path : ~/.sonar/cache
51
- key : ${{ runner.os }}-sonar
52
- restore-keys : ${{ runner.os }}-sonar
53
-
54
48
- name : Build with Maven
55
- if : ${{ !(matrix.arch == 'x64' && matrix.os == 'ubuntu-latest' && matrix.java == env.BUILD_JAVA_VERSION) }}
56
- run : mvn verify -B -"Dgpg.skip"
49
+ run : |
50
+ mvn verify -B -"Dgpg.skip" jacoco:report
51
+ cp target/jacoco.exec target/jacoco-${{ matrix.java }}-${{ matrix.arch }}-${{ matrix.os }}.exec
57
52
58
- - name : Build with Maven and run Sonar
59
- if : ${{ matrix.arch == 'x64' && matrix.os == 'ubuntu-latest' && matrix.java == env.BUILD_JAVA_VERSION }}
60
- env :
61
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
62
- SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
63
- run : mvn -B -"Dgpg.skip" test
64
- # jacoco:report org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
53
+ - name : Publish Test Report
54
+ if : always()
55
+ uses : mikepenz/action-junit-report@v3
56
+ with :
57
+ report_paths : target/surefire-reports/TEST-*.xml
58
+ require_tests : true
59
+ check_retries : true
60
+ detailed_summary : true
65
61
66
- - name : Upload Test Report
62
+ - name : Upload Coverage Report
67
63
uses : actions/upload-artifact@v3
68
64
if : always() # always run even if the previous step fails
69
65
with :
70
- name : junit-test-results -${{ matrix.java }}-${{ matrix.arch }}-${{ matrix.os }}
71
- path : ' target/surefire-reports/TEST-*.xml '
66
+ name : coverage-report -${{ matrix.java }}-${{ matrix.arch }}-${{ matrix.os }}
67
+ path : ' target/jacoco-${{ matrix.java }}-${{ matrix.arch }}-${{ matrix.os }}.exec '
72
68
retention-days : 1
69
+
70
+ analyze :
71
+ name : Analyze Code
72
+ runs-on : ubuntu-latest
73
+ needs : build
74
+ steps :
75
+ - name : Checkout
76
+ uses : actions/checkout@v3
77
+
78
+ - name : Get Artifacts
79
+ uses : actions/download-artifact@v3
80
+
81
+ - name : Set up JDK
82
+ uses : actions/setup-java@v3
83
+ with :
84
+ java-version : ${{ env.BUILD_JAVA_VERSION }}
85
+ distribution : temurin
86
+ cache : maven
87
+
88
+ - name : Cache SonarCloud packages
89
+ uses : actions/cache@v3
90
+ with :
91
+ path : ~/.sonar/cache
92
+ key : ${{ runner.os }}-sonar
93
+ restore-keys : ${{ runner.os }}-sonar
94
+
95
+ - name : Merge JaCoCo and run SonarQube
96
+ run : |
97
+ mkdir target/coverage-reports
98
+ mv coverage-report-*/target/*.exec target/
99
+ mvn -B jacoco:merge org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
0 commit comments