build-test-release / release (push) Successful in 5m47s
Ran the code-review-harness (four parallel reviewers: correctness, reliability, performance, test-coverage) over the GUI crate and fixed every Critical/High finding, plus grew the test + microbenchmark suite that gates the pipeline. Correctness / reliability fixes: - IP column sorted lexically, not numerically. The default view is IP-ascending but Column::Ip fell through to the generic lowercase-string sort key, so 10.255.1.10 sorted before 10.255.1.2 on every launch. Add a numeric IP sort key (u32, exact in f64) and switch view() to decorate-sort-undecorate so a sort key is computed once per row, not twice per comparison. - Scans had no cancellation. Stop/Apply/Play only dropped the receiver, leaving the background thread probing dead hosts (each waits out an asic-rs timeout), and Play could spawn a second concurrent scan + tokio runtime. Add a ScanHandle with an Arc<AtomicBool> cancel flag the loop checks each iteration, a begin_scan() helper that stops the in-flight scan before starting a new one, and Stop now signals cancellation. - Native column drag never rebuilt the control: column_reordered mutated view.order but skipped rebuild_table(), so the store's creation order diverged from display_columns() and cells rendered under the wrong headers on the next scan tick. Rebuild after applying the reorder. - format_si rounding rolled a mantissa up to "1000" without advancing the SI prefix (999.9 W -> "1000 W", a 4-digit result). Round first, then roll over; [99.95,100) drops its decimal. - start_scan used .expect() on thread spawn, which would panic across the wx FFI boundary; it now sends ScanMsg::Failed and returns the handle. Tests / benchmarks (the pipeline's regression gate): - Unit tests 24 -> 41: format_si/format_uptime boundaries, numeric IP sort, upsert-new-IP, Light three-state + pool-slot-out-of-range cells, filter AND/OR, reorder non-permutation guard; scan.rs parse_cidr/prefix_mask, single-host /32, empty/whitespace, short-range single/reversed, parse_targets aggregate cap + error propagation, validate_ranges, targets_to_cidrs non-contiguous, auto-rescan-secs round-trip. - Microbenchmarks 2 -> 9: view default-sort, sort-by-each-column, filtered view, upsert cold-start, parse_line near MAX_ADDRS, parse_targets many ranges, targets_to_cidrs large range. Floors are 5-10x above local numbers. - New ci/test-compute-version.sh: 9 cases for the X.Y.Z logic (first release, pre-bumped X, backend/UI bumps, docs-only no-op, major-wins-over-UI, backend-wins-over-UI, nested ci/ and thirdparty/wx-rs paths). Wired in as a fast-fail CI step. CI: install libssl-dev + pkg-config (openssl-sys); add xauth so the headless self-test actually launches under xvfb (was aborting on "xauth not found"). Deferred (documented in code-review-report.md, guarded by benches): Cow cells, an ip->index map for upsert. Local: 41 tests + 9 benches + 9 shell tests green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
128 lines
5.0 KiB
YAML
128 lines
5.0 KiB
YAML
name: build-test-release
|
|
|
|
# Runs on every merge/push to main: build the GUI, run tests + a microbenchmark,
|
|
# and (when the change warrants it) cut an X.Y.Z release with the binary attached.
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: alkane-ci
|
|
env:
|
|
WX_PREFIX: /root/.cache/wx-3.3.3-linux
|
|
steps:
|
|
- name: Checkout (full history for tags)
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Compute version
|
|
id: ver
|
|
run: bash ci/compute-version.sh | tee -a "$GITHUB_OUTPUT"
|
|
|
|
- name: Test version logic
|
|
if: steps.ver.outputs.release == 'true'
|
|
run: bash ci/test-compute-version.sh
|
|
|
|
- name: Install build dependencies
|
|
if: steps.ver.outputs.release == 'true'
|
|
run: |
|
|
apt-get update -qq
|
|
apt-get install -y -qq --no-install-recommends \
|
|
libssl-dev pkg-config ca-certificates >/dev/null
|
|
echo "libssl-dev + pkg-config installed (openssl-sys needs them)"
|
|
|
|
- name: Cache vendored wxWidgets build
|
|
if: steps.ver.outputs.release == 'true'
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: /root/.cache/wx-3.3.3-linux
|
|
key: wx-3.3.3-${{ runner.os }}-${{ hashFiles('thirdparty/wx-rs/VERSION') }}
|
|
|
|
- name: Build wxWidgets (once, then cached)
|
|
if: steps.ver.outputs.release == 'true'
|
|
run: |
|
|
if [ ! -x "$WX_PREFIX/bin/wx-config" ]; then
|
|
bash scripts/build-wx-linux.sh
|
|
else
|
|
echo "wx prefix restored from cache"
|
|
fi
|
|
|
|
- name: Set crate version to ${{ steps.ver.outputs.version }}
|
|
if: steps.ver.outputs.release == 'true'
|
|
run: |
|
|
sed -i "0,/^version = \".*\"/s//version = \"${{ steps.ver.outputs.version }}\"/" Cargo.toml
|
|
grep -m1 '^version' Cargo.toml
|
|
|
|
- name: Build release
|
|
if: steps.ver.outputs.release == 'true'
|
|
run: |
|
|
export WX_RS_WXCONFIG="$WX_PREFIX/bin/wx-config"
|
|
cargo build --release -p alkane-gui --offline
|
|
|
|
- name: Unit tests
|
|
if: steps.ver.outputs.release == 'true'
|
|
run: |
|
|
export WX_RS_WXCONFIG="$WX_PREFIX/bin/wx-config"
|
|
cargo test -p alkane-gui --offline
|
|
|
|
- name: Microbenchmarks
|
|
if: steps.ver.outputs.release == 'true'
|
|
run: |
|
|
export WX_RS_WXCONFIG="$WX_PREFIX/bin/wx-config"
|
|
cargo test -p alkane-gui --release --offline -- --ignored --nocapture bench_
|
|
|
|
- name: Headless UI self-test
|
|
if: steps.ver.outputs.release == 'true'
|
|
continue-on-error: true
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq --no-install-recommends \
|
|
xvfb xauth dbus-x11 fonts-dejavu-core >/dev/null
|
|
BIN=target/release/alkane-toolkit
|
|
xvfb-run -a env GDK_BACKEND=x11 ALKANE_SELFTEST=1 "$BIN"
|
|
|
|
- name: Package artifact
|
|
if: steps.ver.outputs.release == 'true'
|
|
id: pkg
|
|
run: |
|
|
V="${{ steps.ver.outputs.version }}"
|
|
NAME="alkane-toolkit-v${V}-linux-x86_64"
|
|
mkdir -p "dist/$NAME"
|
|
cp target/release/alkane-toolkit "dist/$NAME/"
|
|
cat > "dist/$NAME/README.txt" <<EOF
|
|
alkane-toolkit v${V} (linux x86_64)
|
|
Bump type: ${{ steps.ver.outputs.bump }}
|
|
Commit: ${GITHUB_SHA}
|
|
|
|
Run: ./alkane-toolkit
|
|
Requires GTK 3 at runtime: sudo apt install libgtk-3-0
|
|
Offline demo: ALKANE_FAKE_SCAN=1 ./alkane-toolkit
|
|
EOF
|
|
tar -C dist -czf "dist/${NAME}.tar.gz" "$NAME"
|
|
echo "asset=dist/${NAME}.tar.gz" >> "$GITHUB_OUTPUT"
|
|
echo "assetname=${NAME}.tar.gz" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Create Gitea release + upload artifact
|
|
if: steps.ver.outputs.release == 'true'
|
|
env:
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
TAG="${{ steps.ver.outputs.tag }}"
|
|
API="${GITHUB_API_URL:-https://gitea.bluefla.re/api/v1}"
|
|
REPO="${GITHUB_REPOSITORY}"
|
|
body="Automated ${{ steps.ver.outputs.bump }} release from ${GITHUB_SHA}."
|
|
rel=$(curl -sS -X POST -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" \
|
|
"${API}/repos/${REPO}/releases" \
|
|
-d "{\"tag_name\":\"${TAG}\",\"target_commitish\":\"${GITHUB_SHA}\",\"name\":\"${TAG}\",\"body\":\"${body}\"}")
|
|
id=$(echo "$rel" | grep -oE '"id":[0-9]+' | head -1 | cut -d: -f2)
|
|
if [ -z "$id" ]; then echo "release create failed: $rel"; exit 1; fi
|
|
curl -sS -X POST -H "Authorization: token ${TOKEN}" -H "Content-Type: application/gzip" \
|
|
"${API}/repos/${REPO}/releases/${id}/assets?name=${{ steps.pkg.outputs.assetname }}" \
|
|
--data-binary @"${{ steps.pkg.outputs.asset }}" | grep -oE '"browser_download_url":"[^"]+"' || true
|
|
echo "Released ${TAG}"
|
|
|
|
- name: No release needed
|
|
if: steps.ver.outputs.release != 'true'
|
|
run: echo "No backend/UI change since ${{ steps.ver.outputs.last_tag }} - skipping release."
|