Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4154a50ed0 | ||
|
|
0ab822940e |
@@ -97,6 +97,40 @@ jobs:
|
|||||||
echo "cargo-audit not installed on this runner; skipping"
|
echo "cargo-audit not installed on this runner; skipping"
|
||||||
fi
|
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
|
# 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
|
# 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
|
# fail the release. A badges-only push does not bump the version (see
|
||||||
@@ -109,7 +143,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
PASS=$(cargo test -p alkane-gui --offline 2>&1 \
|
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}')
|
| 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
|
if [ -n "$(git status --porcelain badges)" ]; then
|
||||||
git config user.name "alkane-ci"
|
git config user.name "alkane-ci"
|
||||||
git config user.email "ci@bluefla.re"
|
git config user.email "ci@bluefla.re"
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ cargo test -p alkane-gui --release -- --ignored bench_ # microbenchmarks
|
|||||||
cargo clippy -p alkane-gui --no-deps --bins -- -D warnings # lint gate
|
cargo clippy -p alkane-gui --no-deps --bins -- -D warnings # lint gate
|
||||||
xvfb-run -a env ALKANE_SELFTEST=1 \
|
xvfb-run -a env ALKANE_SELFTEST=1 \
|
||||||
"$CARGO_TARGET_DIR/release/alkane-toolkit" # headless UI self-test
|
"$CARGO_TARGET_DIR/release/alkane-toolkit" # headless UI self-test
|
||||||
|
ci/coverage.sh --summary-only # coverage (tests + self-test)
|
||||||
```
|
```
|
||||||
|
|
||||||
CI mirrors these: `verify.yml` runs the lint, tests, benchmarks, self-test, and
|
CI mirrors these: `verify.yml` runs the lint, tests, benchmarks, self-test, and
|
||||||
|
|||||||
+5
-5
@@ -1,5 +1,5 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="95.5" height="20" role="img" aria-label="coverage: 35%">
|
<svg xmlns="http://www.w3.org/2000/svg" width="95.5" height="20" role="img" aria-label="coverage: 46%">
|
||||||
<title>coverage: 35%</title>
|
<title>coverage: 46%</title>
|
||||||
<linearGradient id="s" x2="0" y2="100%">
|
<linearGradient id="s" x2="0" y2="100%">
|
||||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||||
<stop offset="1" stop-opacity=".1"/>
|
<stop offset="1" stop-opacity=".1"/>
|
||||||
@@ -7,13 +7,13 @@
|
|||||||
<clipPath id="r"><rect width="95.5" height="20" rx="3" fill="#fff"/></clipPath>
|
<clipPath id="r"><rect width="95.5" height="20" rx="3" fill="#fff"/></clipPath>
|
||||||
<g clip-path="url(#r)">
|
<g clip-path="url(#r)">
|
||||||
<rect width="64.0" height="20" fill="#555"/>
|
<rect width="64.0" height="20" fill="#555"/>
|
||||||
<rect x="64.0" width="31.5" height="20" fill="#fe7d37"/>
|
<rect x="64.0" width="31.5" height="20" fill="#dfb317"/>
|
||||||
<rect width="95.5" height="20" fill="url(#s)"/>
|
<rect width="95.5" height="20" fill="url(#s)"/>
|
||||||
</g>
|
</g>
|
||||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
|
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
|
||||||
<text x="32.0" y="15" fill="#010101" fill-opacity=".3">coverage</text>
|
<text x="32.0" y="15" fill="#010101" fill-opacity=".3">coverage</text>
|
||||||
<text x="32.0" y="14">coverage</text>
|
<text x="32.0" y="14">coverage</text>
|
||||||
<text x="79.8" y="15" fill="#010101" fill-opacity=".3">35%</text>
|
<text x="79.8" y="15" fill="#010101" fill-opacity=".3">46%</text>
|
||||||
<text x="79.8" y="14">35%</text>
|
<text x="79.8" y="14">46%</text>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 919 B After Width: | Height: | Size: 919 B |
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Measure line coverage from BOTH the unit tests AND the headless UI self-test.
|
||||||
|
#
|
||||||
|
# The self-test (ALKANE_SELFTEST=1) builds the real wxWidgets table, renders every
|
||||||
|
# fixture through the real widgets, and checks each cell against the model -- it
|
||||||
|
# exercises most of ui.rs. Because it runs as a separate binary invocation, a plain
|
||||||
|
# `cargo llvm-cov` (which only runs the #[test]s) never counts it, so ui.rs shows
|
||||||
|
# ~4% even though it is integration-tested. This combines both runs' coverage.
|
||||||
|
#
|
||||||
|
# Usage: ci/coverage.sh [extra `cargo llvm-cov report` args, e.g. --summary-only]
|
||||||
|
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 "${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 "${CARGO_FLAGS[@]}" --bin alkane-toolkit
|
||||||
|
else
|
||||||
|
echo "coverage.sh: xvfb-run not found; skipping the self-test run (unit tests only)" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 3. Merged report, our source only (vendored asic-rs + the patched wx-rs bridge
|
||||||
|
# are out of scope).
|
||||||
|
cargo llvm-cov report --ignore-filename-regex '(thirdparty|vendor)/' "$@"
|
||||||
Reference in New Issue
Block a user