Skip to content

Commit 8b8480e

Browse files
Merge pull request #459 from NOAA-OWP/github419_updated_workflow
Updated to include Jacoco reports in action and PR; #419
2 parents e7d30f8 + 3b7ad5a commit 8b8480e

File tree

1 file changed

+64
-15
lines changed

1 file changed

+64
-15
lines changed

.github/workflows/commitChecks.yml

+64-15
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
pull_request:
77

88
jobs:
9+
10+
# ========================================================
11+
# Build and unit test code.
12+
# ========================================================
913
Build:
1014
runs-on: ubuntu-latest
1115
permissions:
@@ -68,11 +72,56 @@ jobs:
6872
name: build-artifacts
6973
path: |
7074
checksum.txt
75+
build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.csv
76+
build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
7177
build/distributions/wres-*.zip
7278
wres-*/build/distributions/wres-*-*.zip
7379
systests/build/distributions/systests-*.zip
7480
scripts/build/distributions/wres-admin-scripts-*.zip
7581
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+
# ========================================================
76125
systests:
77126
needs: Build
78127
runs-on: ubuntu-latest
@@ -112,10 +161,10 @@ jobs:
112161
113162
# Run systests
114163
- name: System tests in memory zero externalization
115-
run: |
164+
run: |
116165
echo "Starting the system tests in memory zero externalization..."
117166
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).
119168
# TODO: replace with -P gradle property overrides in the test command once the quoting/escaping issues can be worked out
120169
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
121170
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:
130179
mv wres_evaluation_* outputs
131180
mv outputs zero_external_test_results
132181
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
134183
135184
# Run systests
136185
- name: System tests with external graphics and numerics writing
137-
run: |
186+
run: |
138187
echo "Starting the system tests with external graphics and numerics writing..."
139188
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).
141190
# TODO: replace with -P gradle property overrides in the test command once the quoting/escaping issues can be worked out
142191
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
143192
sed -i "s/testJvmSystemPropertiesGraphics =.*/testJvmSystemPropertiesGraphics = -Djava.io.tmpdir=. -Dwres.startBroker=true -Dwres.eventsBrokerAddress=localhost -Dwres.eventsBrokerPort=5673/g" $systests_dir/gradle.properties
144193
sed -i "s/testJvmSystemPropertiesWriting =.*/testJvmSystemPropertiesWriting = -Djava.io.tmpdir=. -Dwres.startBroker=false -Dwres.eventsBrokerAddress=localhost -Dwres.eventsBrokerPort=5673/g" $systests_dir/gradle.properties
145194
146-
# Run the tests using a separate graphics and writing process
195+
# Run the tests using a separate graphics and writing process
147196
$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
148197
149198
# Save the test results
@@ -156,16 +205,16 @@ jobs:
156205
157206
# Run systests
158207
- name: System tests with an H2 in-memory database
159-
run: |
208+
run: |
160209
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).
163212
# TODO: replace with -P gradle property overrides in the test command once the quoting/escaping issues can be worked out
164213
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+
166215
# Run the tests again using a self-contained graphics/eventsbroker process
167216
$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+
169218
# Save the test results
170219
mkdir -p h2_in_memory_test_results
171220
mkdir -p outputs
@@ -175,16 +224,16 @@ jobs:
175224
176225
# Run systests
177226
- name: System tests with the legacy XML evaluation language
178-
run: |
227+
run: |
179228
echo "Starting the system tests with the legacy XML evaluation language..."
180229
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).
182231
# TODO: replace with -P gradle property overrides in the test command once the quoting/escaping issues can be worked out
183232
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+
185234
# Run the tests again using a self-contained graphics/eventsbroker process
186235
$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+
188237
# Save the test results
189238
mkdir -p legacy_xml_results
190239
mkdir -p outputs

0 commit comments

Comments
 (0)