Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4154a50ed0 |
@@ -97,6 +97,40 @@ jobs:
|
||||
echo "cargo-audit not installed on this runner; skipping"
|
||||
fi
|
||||
|
||||
# Merge coverage from the unit tests AND the headless self-test (ci/coverage.sh)
|
||||
# so the committed badge reflects real coverage, not the tests-only number a
|
||||
# plain `cargo llvm-cov` reports. Best-effort: cargo-llvm-cov is fetched as a
|
||||
# prebuilt binary because the vendored .cargo/config blocks `cargo install`,
|
||||
# and the instrumented rebuild is slow, so a failure here never blocks a
|
||||
# release. Feeds steps.cov.outputs.pct to the badge refresh below. xvfb is
|
||||
# already installed by the self-test step above.
|
||||
- name: Coverage (best-effort)
|
||||
id: cov
|
||||
if: steps.ver.outputs.release == 'true'
|
||||
continue-on-error: true
|
||||
run: |
|
||||
rustup component add llvm-tools-preview >/dev/null 2>&1 || true
|
||||
if ! command -v cargo-llvm-cov >/dev/null 2>&1; then
|
||||
V=0.8.7
|
||||
URL="https://github.com/taiki-e/cargo-llvm-cov/releases/download/v${V}/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz"
|
||||
DEST="${CARGO_HOME:-$HOME/.cargo}/bin"
|
||||
mkdir -p "$DEST"
|
||||
curl -fsSL "$URL" | tar -xz -C "$DEST" && export PATH="$DEST:$PATH" \
|
||||
|| echo "cargo-llvm-cov download failed"
|
||||
fi
|
||||
if command -v cargo-llvm-cov >/dev/null 2>&1; then
|
||||
PCT=$(bash ci/coverage.sh --summary-only 2>/dev/null \
|
||||
| awk '/^TOTAL/{gsub(/%/,"",$10); print $10}')
|
||||
if [ -n "$PCT" ]; then
|
||||
echo "pct=${PCT}" >> "$GITHUB_OUTPUT"
|
||||
echo "line coverage (tests + self-test): ${PCT}%"
|
||||
else
|
||||
echo "coverage report produced no TOTAL line; badge left as committed"
|
||||
fi
|
||||
else
|
||||
echo "cargo-llvm-cov unavailable; coverage badge left as committed"
|
||||
fi
|
||||
|
||||
# Refresh the committed README badges from live metrics and push any change
|
||||
# back to main. Best-effort: a locked-down runner that can't push must not
|
||||
# fail the release. A badges-only push does not bump the version (see
|
||||
@@ -109,7 +143,12 @@ jobs:
|
||||
run: |
|
||||
PASS=$(cargo test -p alkane-gui --offline 2>&1 \
|
||||
| grep -hoE '[0-9]+ passed' | grep -oE '[0-9]+' | awk '{s+=$1} END{print s+0}')
|
||||
python3 ci/gen-badges.py --tests "${PASS:-0}" --bench "row-render + scan-parse"
|
||||
# Update the coverage badge only when the coverage step produced a number;
|
||||
# otherwise leave the committed coverage.svg untouched.
|
||||
COV="${{ steps.cov.outputs.pct }}"
|
||||
COV_ARG=""
|
||||
[ -n "$COV" ] && COV_ARG="--coverage $COV"
|
||||
python3 ci/gen-badges.py --tests "${PASS:-0}" $COV_ARG --bench "row-render + scan-parse"
|
||||
if [ -n "$(git status --porcelain badges)" ]; then
|
||||
git config user.name "alkane-ci"
|
||||
git config user.email "ci@bluefla.re"
|
||||
|
||||
+6
-2
@@ -12,18 +12,22 @@ set -euo pipefail
|
||||
|
||||
export WX_RS_WXCONFIG="${WX_RS_WXCONFIG:-$HOME/.cache/wx-3.3.3-linux/bin/wx-config}"
|
||||
|
||||
# The dependency tree is fully vendored, so the instrumented builds run offline by
|
||||
# default; override with CARGO_LLVM_COV_FLAGS if you need something else.
|
||||
read -ra CARGO_FLAGS <<<"${CARGO_LLVM_COV_FLAGS:---offline}"
|
||||
|
||||
# A display for the self-test's real widgets.
|
||||
need_xvfb() { command -v xvfb-run >/dev/null 2>&1; }
|
||||
|
||||
cargo llvm-cov clean --workspace
|
||||
|
||||
# 1. Unit tests.
|
||||
cargo llvm-cov --no-report -p alkane-gui --bin alkane-toolkit
|
||||
cargo llvm-cov --no-report "${CARGO_FLAGS[@]}" -p alkane-gui --bin alkane-toolkit
|
||||
|
||||
# 2. Headless UI self-test, under the same instrumentation, its coverage appended.
|
||||
if need_xvfb; then
|
||||
xvfb-run -a env GDK_BACKEND=x11 ALKANE_SELFTEST=1 \
|
||||
cargo llvm-cov run --no-report --bin alkane-toolkit
|
||||
cargo llvm-cov run --no-report "${CARGO_FLAGS[@]}" --bin alkane-toolkit
|
||||
else
|
||||
echo "coverage.sh: xvfb-run not found; skipping the self-test run (unit tests only)" >&2
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user