Skip to content

Commit a7e4b38

Browse files
authored
fix: tolerate missing compose coverage on legacy branches (#406)
1 parent 563e669 commit a7e4b38

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

.github/workflows/coverage-merge.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,22 @@ jobs:
107107
108108
mapfile -t ut_profiles < <(find "${artifact_dir}" -type f -name 'ut-coverage.out' | sort)
109109
mapfile -t bvt_profiles < <(find "${artifact_dir}" -type f -name 'bvt-*.out' | sort)
110-
if [ "${#ut_profiles[@]}" -ne 1 ] || [ "${#bvt_profiles[@]}" -ne 2 ]; then
111-
echo '::error::expected one UT profile and two BVT profiles'
110+
if [ "${#ut_profiles[@]}" -ne 1 ]; then
111+
echo '::error::expected exactly one UT profile'
112+
find "${artifact_dir}" -type f -print || true
113+
exit 1
114+
fi
115+
if [ '${{ github.base_ref }}' = 'main' ]; then
116+
if [ "${#bvt_profiles[@]}" -ne 2 ]; then
117+
echo '::error::expected two BVT profiles on main'
118+
find "${artifact_dir}" -type f -print || true
119+
exit 1
120+
fi
121+
elif [ "${#bvt_profiles[@]}" -eq 1 ] \
122+
&& [ "$(basename "${bvt_profiles[0]}")" = 'bvt-standalone.out' ]; then
123+
echo '::warning::merging coverage without the unsupported legacy Compose profile'
124+
elif [ "${#bvt_profiles[@]}" -ne 2 ]; then
125+
echo '::error::expected two BVT profiles, or the standalone profile alone on a legacy branch'
112126
find "${artifact_dir}" -type f -print || true
113127
exit 1
114128
fi

.github/workflows/e2e-compose-parallel.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,12 @@ jobs:
430430
set -uo pipefail
431431
coverage_dir="$GITHUB_WORKSPACE/coverage"
432432
coverage_profile="$RUNNER_TEMP/bvt-compose.out"
433+
compose_file="$GITHUB_WORKSPACE/etc/launch-tae-compose/compose.yaml"
434+
if ! grep -Eq 'GOCOVERDIR=/coverage' "${compose_file}" \
435+
|| ! grep -Eq 'coverage:/coverage' "${compose_file}"; then
436+
echo '::warning::Compose BVT coverage is unsupported by this legacy branch; keeping the successful BVT result'
437+
exit 0
438+
fi
433439
if go tool covdata textfmt -i="${coverage_dir}" -o "${coverage_profile}"; then
434440
test -s "${coverage_profile}"
435441
elif [ "${{ steps.bvt_on_pr_version.conclusion }}" = "success" ]; then

0 commit comments

Comments
 (0)