6
6
pull_request :
7
7
8
8
jobs :
9
+
10
+ # ========================================================
11
+ # Build and unit test code.
12
+ # ========================================================
9
13
Build :
10
14
runs-on : ubuntu-latest
11
15
permissions :
@@ -68,11 +72,56 @@ jobs:
68
72
name : build-artifacts
69
73
path : |
70
74
checksum.txt
75
+ build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.csv
76
+ build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
71
77
build/distributions/wres-*.zip
72
78
wres-*/build/distributions/wres-*-*.zip
73
79
systests/build/distributions/systests-*.zip
74
80
scripts/build/distributions/wres-admin-scripts-*.zip
75
81
82
+ # ========================================================
83
+ # Generate the code coverage reports.
84
+ # ========================================================
85
+ codeCoverageReport :
86
+ needs : Build
87
+ runs-on : ubuntu-latest
88
+
89
+ # pull-requests write permission needed for Jacoco report in PR comment.
90
+ permissions :
91
+ contents : read
92
+ pull-requests : write
93
+
94
+ steps :
95
+
96
+ # Download and unpackage artifacts from previous step
97
+ - name : Download Artifacts
98
+ uses : actions/download-artifact@v4
99
+ with :
100
+ github-token : ${{ github.token }}
101
+
102
+ # Add a Jacoco report to the action output using badging tool.
103
+ # The badges can be added readily; see a comment in #419.
104
+ # However, we have no way to view them in the README.md.
105
+ - name : Generate Jacoco coverage report in Action
106
+ uses : cicirello/jacoco-badge-generator@v2
107
+ with :
108
+ jacoco-csv-file : build-artifacts/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.csv
109
+
110
+ # Add coverage report to the pull request as comment.
111
+ # Basic coverage checks are implemented. The 1.7.1 needs
112
+ # to be fully specified; v1 does not work (as of 3/18/25).
113
+ - name : Add Jacoco coverage report in PR comment
114
+ id : jacoco
115
+ uses : madrapps/jacoco-report@v1.7.1
116
+ with :
117
+ paths : build-artifacts/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
118
+ token : ${{ secrets.GITHUB_TOKEN }}
119
+ min-coverage-overall : 50
120
+ min-coverage-changed-files : 60
121
+
122
+ # ========================================================
123
+ # Execute scaled down system tests.
124
+ # ========================================================
76
125
systests :
77
126
needs : Build
78
127
runs-on : ubuntu-latest
@@ -112,10 +161,10 @@ jobs:
112
161
113
162
# Run systests
114
163
- name : System tests in memory zero externalization
115
- run : |
164
+ run : |
116
165
echo "Starting the system tests in memory zero externalization..."
117
166
118
- # Configure the parameters sent to the test JVM in the settings file (avoids some quoting/escaping issues).
167
+ # Configure the parameters sent to the test JVM in the settings file (avoids some quoting/escaping issues).
119
168
# TODO: replace with -P gradle property overrides in the test command once the quoting/escaping issues can be worked out
120
169
sed -i "s/testJvmSystemProperties =.*/testJvmSystemProperties = -Dwres.useSSL=false -Dwres.useDatabase=false -Djava.awt.headless=true -Dwres.dataDirectory=. -Djava.io.tmpdir=.. -Ducar.unidata.io.http.maxReadCacheSize=200000 -Ducar.unidata.io.http.httpBufferSize=200000 -Dwres.attemptToMigrate=false -Duser.timezone=UTC -Dwres.externalGraphics=false -Dwres.externalNumerics=false -Dwres.startBroker=false -Dwres.eventsBrokerAddress=localhost -Dwres.eventsBrokerPort=5673/g" $systests_dir/gradle.properties
121
170
sed -i "s/testJvmSystemPropertiesGraphics =.*/testJvmSystemPropertiesGraphics = -Djava.io.tmpdir=. -Dwres.startBroker=true -Dwres.eventsBrokerAddress=localhost -Dwres.eventsBrokerPort=5673/g" $systests_dir/gradle.properties
@@ -130,20 +179,20 @@ jobs:
130
179
mv wres_evaluation_* outputs
131
180
mv outputs zero_external_test_results
132
181
mv systests-*/build/reports/tests/test/* zero_external_test_results
133
- mv systests-*/build/*.log zero_external_test_results
182
+ mv systests-*/build/*.log zero_external_test_results
134
183
135
184
# Run systests
136
185
- name : System tests with external graphics and numerics writing
137
- run : |
186
+ run : |
138
187
echo "Starting the system tests with external graphics and numerics writing..."
139
188
140
- # Configure the parameters sent to the test JVM in the settings file (avoids some quoting/escaping issues).
189
+ # Configure the parameters sent to the test JVM in the settings file (avoids some quoting/escaping issues).
141
190
# TODO: replace with -P gradle property overrides in the test command once the quoting/escaping issues can be worked out
142
191
sed -i "s/testJvmSystemProperties =.*/testJvmSystemProperties = -Dwres.useSSL=false -Dwres.useDatabase=true -Dwres.databaseJdbcUrl=jdbc:h2:mem:test;MODE=REGULAR;TRACE_LEVEL_FILE=4;DB_CLOSE_DELAY=-1;INIT=create schema if not exists wres\\; -Djava.awt.headless=true -Dwres.dataDirectory=. -Djava.io.tmpdir=.. -Ducar.unidata.io.http.maxReadCacheSize=200000 -Ducar.unidata.io.http.httpBufferSize=200000 -Dwres.attemptToMigrate=true -Duser.timezone=UTC -Dwres.externalGraphics=true -Dwres.externalNumerics=true -Dwres.startBroker=false -Dwres.eventsBrokerAddress=localhost -Dwres.eventsBrokerPort=5673/g" $systests_dir/gradle.properties
143
192
sed -i "s/testJvmSystemPropertiesGraphics =.*/testJvmSystemPropertiesGraphics = -Djava.io.tmpdir=. -Dwres.startBroker=true -Dwres.eventsBrokerAddress=localhost -Dwres.eventsBrokerPort=5673/g" $systests_dir/gradle.properties
144
193
sed -i "s/testJvmSystemPropertiesWriting =.*/testJvmSystemPropertiesWriting = -Djava.io.tmpdir=. -Dwres.startBroker=false -Dwres.eventsBrokerAddress=localhost -Dwres.eventsBrokerPort=5673/g" $systests_dir/gradle.properties
145
194
146
- # Run the tests using a separate graphics and writing process
195
+ # Run the tests using a separate graphics and writing process
147
196
$systests_dir/gradlew -p $systests_dir cleanTest test -PwresZipDirectory=../build-artifacts/build/distributions/ -PwresGraphicsZipDirectory=../build-artifacts/wres-vis/build/distributions/ -PwresWritingZipDirectory=../build-artifacts/wres-writing/build/distributions/ -PversionToTest=$wres_version -PgraphicsVersionToTest=$wres_vis -PwritingVersionToTest=$wres_writing --tests=Scenario052 --tests=Scenario053 --tests=Scenario1000 --tests=Scenario1001 --tests=Scenario500 --tests=Scenario501 --tests=Scenario502 --tests=Scenario504 --tests=Scenario505 --tests=Scenario506 --tests=Scenario507 --tests=Scenario508 --tests=Scenario509 --tests=Scenario510 --tests=Scenario511 --tests=Scenario512 --tests=Scenario513 --tests=Scenario514 --tests=Scenario720 --tests=Scenario721
148
197
149
198
# Save the test results
@@ -156,16 +205,16 @@ jobs:
156
205
157
206
# Run systests
158
207
- name : System tests with an H2 in-memory database
159
- run : |
208
+ run : |
160
209
echo "Starting the system tests with an H2 in-memory database..."
161
-
162
- # Configure the parameters sent to the test JVM in the settings file (avoids some quoting/escaping issues).
210
+
211
+ # Configure the parameters sent to the test JVM in the settings file (avoids some quoting/escaping issues).
163
212
# TODO: replace with -P gradle property overrides in the test command once the quoting/escaping issues can be worked out
164
213
sed -i "s/testJvmSystemProperties =.*/testJvmSystemProperties = -Dwres.useSSL=false -Dwres.databaseJdbcUrl=jdbc:h2:mem:test;MODE=REGULAR;TRACE_LEVEL_FILE=4;DB_CLOSE_DELAY=-1;INIT=create schema if not exists wres\\; -Djava.awt.headless=true -Dwres.dataDirectory=. -Djava.io.tmpdir=.. -Ducar.unidata.io.http.maxReadCacheSize=200000 -Ducar.unidata.io.http.httpBufferSize=200000 -Dwres.attemptToMigrate=true -Duser.timezone=UTC -Dwres.externalGraphics=false -Dwres.externalNumerics=false/g" $systests_dir/gradle.properties
165
-
214
+
166
215
# Run the tests again using a self-contained graphics/eventsbroker process
167
216
$systests_dir/gradlew -p $systests_dir cleanTest test -PwresZipDirectory=../build-artifacts/build/distributions/ -PwresGraphicsZipDirectory=../build-artifacts/wres-vis/build/distributions/ -PwresWritingZipDirectory=../build-artifacts/wres-writing/build/distributions/ -PversionToTest=$wres_version -PgraphicsVersionToTest=$wres_vis -PwritingVersionToTest=$wres_writing --tests=Scenario052 --tests=Scenario053 --tests=Scenario1000 --tests=Scenario1001 --tests=Scenario500 --tests=Scenario501 --tests=Scenario502 --tests=Scenario504 --tests=Scenario505 --tests=Scenario506 --tests=Scenario507 --tests=Scenario508 --tests=Scenario509 --tests=Scenario510 --tests=Scenario511 --tests=Scenario512 --tests=Scenario513 --tests=Scenario514 --tests=Scenario720 --tests=Scenario721
168
-
217
+
169
218
# Save the test results
170
219
mkdir -p h2_in_memory_test_results
171
220
mkdir -p outputs
@@ -175,16 +224,16 @@ jobs:
175
224
176
225
# Run systests
177
226
- name : System tests with the legacy XML evaluation language
178
- run : |
227
+ run : |
179
228
echo "Starting the system tests with the legacy XML evaluation language..."
180
229
181
- # Configure the parameters sent to the test JVM in the settings file (avoids some quoting/escaping issues).
230
+ # Configure the parameters sent to the test JVM in the settings file (avoids some quoting/escaping issues).
182
231
# TODO: replace with -P gradle property overrides in the test command once the quoting/escaping issues can be worked out
183
232
sed -i "s/testJvmSystemProperties =.*/testJvmSystemProperties = -Dwres.useSSL=false -Dwres.databaseJdbcUrl=jdbc:h2:mem:test;MODE=REGULAR;TRACE_LEVEL_FILE=4;DB_CLOSE_DELAY=-1;INIT=create schema if not exists wres\\; -Djava.awt.headless=true -Dwres.dataDirectory=. -Djava.io.tmpdir=.. -Ducar.unidata.io.http.maxReadCacheSize=200000 -Ducar.unidata.io.http.httpBufferSize=200000 -Dwres.attemptToMigrate=true -Duser.timezone=UTC -Dwres.externalGraphics=false -Dwres.externalNumerics=false -Dwres.xml=true/g" $systests_dir/gradle.properties
184
-
233
+
185
234
# Run the tests again using a self-contained graphics/eventsbroker process
186
235
$systests_dir/gradlew -p $systests_dir cleanTest test -PwresZipDirectory=../build-artifacts/build/distributions/ -PwresGraphicsZipDirectory=../build-artifacts/wres-vis/build/distributions/ -PwresWritingZipDirectory=../build-artifacts/wres-writing/build/distributions/ -PversionToTest=$wres_version -PgraphicsVersionToTest=$wres_vis -PwritingVersionToTest=$wres_writing --tests=Scenario052 --tests=Scenario053 --tests=Scenario1000 --tests=Scenario1001 --tests=Scenario500 --tests=Scenario501 --tests=Scenario502 --tests=Scenario504 --tests=Scenario505 --tests=Scenario506 --tests=Scenario507 --tests=Scenario508 --tests=Scenario509 --tests=Scenario510 --tests=Scenario511 --tests=Scenario512 --tests=Scenario720 --tests=Scenario721
187
-
236
+
188
237
# Save the test results
189
238
mkdir -p legacy_xml_results
190
239
mkdir -p outputs
0 commit comments