Skip to content

Commit b470e38

Browse files
author
Nico Piel
committed
Harden the coverage merge against missing data
- coverage-report.sh fails when the unit-test or smoke-test data or the distribution jars are missing, instead of publishing a partial report. - The coverage job no longer runs after a failed build. - run-configuration.sh removes an earlier run's data file, since the agent appends to it. Signed-off-by: Nico Piel <nico.piel@hotmail.de>
1 parent 4e91e07 commit b470e38

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

‎.github/workflows/build.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ jobs:
149149

150150
coverage:
151151
needs: [build, integration-test]
152-
if: (!cancelled()) && github.ref != 'refs/heads/main'
152+
if: (!cancelled()) && needs.build.result == 'success' && github.ref != 'refs/heads/main'
153153
runs-on: ubuntu-latest
154154

155155
steps:

‎ci/coverage-report.sh‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ tar xzf "$artifacts/openintegrationengine.tar.gz" -C "$tmp"
2323
dist="$tmp/openintegrationengine"
2424

2525
shopt -s nullglob
26-
java -jar "$cli" merge \
27-
"$artifacts"/coverage-unit/unit/*.exec \
28-
"$artifacts"/coverage-smoke-*/*.exec \
29-
--destfile "$output/merged.exec"
26+
unit=("$artifacts"/coverage-unit/unit/*.exec)
27+
smoke=("$artifacts"/coverage-smoke-*/*.exec)
28+
echo "Merging ${#unit[@]} unit-test and ${#smoke[@]} smoke-test data files"
29+
if [[ ${#unit[@]} -eq 0 || ${#smoke[@]} -eq 0 ]]; then
30+
echo "Missing unit-test or smoke-test coverage data" >&2
31+
exit 1
32+
fi
33+
java -jar "$cli" merge "${unit[@]}" "${smoke[@]}" --destfile "$output/merged.exec"
3034

3135
# Only our own jars: third-party jars would add their classes to the report,
3236
# and some of them hold originals of classes we patch in mirth-server.jar.
@@ -39,6 +43,10 @@ for jar in "$dist"/mirth-*-launcher.jar \
3943
"$dist"/extensions/*/*.jar; do
4044
classfiles+=(--classfiles "$jar")
4145
done
46+
if [[ ${#classfiles[@]} -eq 0 ]]; then
47+
echo "No jars found in the distribution" >&2
48+
exit 1
49+
fi
4250

4351
sourcefiles=()
4452
for dir in donkey server client command; do

‎ci/run-configuration.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ if [[ -n "${JACOCO_AGENT:-}" ]]; then
2929
mkdir -p "$WORKSPACE/ci/coverage"
3030
# The server runs as its own user, whose UID differs between the images.
3131
chmod 777 "$WORKSPACE/ci/coverage"
32+
# The agent appends, so start from a clean file.
33+
rm -f "$WORKSPACE/ci/coverage/$OIE_CONFIGURATION.exec"
3234
compose+=(-f ci/coverage.compose.yml)
3335
fi
3436
compose+=(-p "oie-ci-${OIE_CONFIGURATION//[^a-z0-9-]/-}-$$")

0 commit comments

Comments
 (0)