Skip to content

chore(release): bump Termy and CLI to 0.2.41 #43

chore(release): bump Termy and CLI to 0.2.41

chore(release): bump Termy and CLI to 0.2.41 #43

name: Tmon vs Alacritty Benchmark
on:
push:
branches: [main]
paths:
- "Cargo.lock"
- "Cargo.toml"
- "crates/core/**"
- "crates/tmon/**"
- "crates/xtask/**"
- "tools/tmon-revision-gate/**"
- ".github/workflows/tmon-benchmark.yml"
workflow_dispatch:
inputs:
target_mib:
description: "MiB per engine/sample (target × samples × 4 ≤ 2048; target ≤ 128)"
required: false
default: "32"
samples:
description: "Samples per engine/workload (target × samples × 4 must be ≤ 2048)"
required: false
default: "8"
snapshots:
description: "Minimum full-frame calls per sample"
required: false
default: "250"
permissions:
contents: read
jobs:
benchmark:
name: Headless parser, grid, snapshot, and scroll-cache comparison
runs-on: ubuntu-24.04
timeout-minutes: 15
env:
TMON_BENCH_TARGET_MIB: ${{ github.event_name == 'workflow_dispatch' && inputs.target_mib || '32' }}
TMON_BENCH_SAMPLES: ${{ github.event_name == 'workflow_dispatch' && inputs.samples || '8' }}
TMON_BENCH_SNAPSHOTS: ${{ github.event_name == 'workflow_dispatch' && inputs.snapshots || '250' }}
TMON_BENCH_ENFORCE_TARGETS: "1"
TMON_BENCH_REPORT_NAME: tmon-alacritty-benchmark.txt
steps:
- name: Initialize report
id: initialize_report
shell: bash
run: |
set -euo pipefail
: > "$RUNNER_TEMP/$TMON_BENCH_REPORT_NAME"
- name: Checkout
id: checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Setup Rust
id: setup_rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: 1.97.1
- name: Cache Rust
id: cache_rust
uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Run comparison
id: comparison
shell: bash
env:
TERMY_CORE_TEST_BACKEND: alacritty
run: |
set -euo pipefail
report="$RUNNER_TEMP/$TMON_BENCH_REPORT_NAME"
{
echo "Git commit: $GITHUB_SHA"
echo "Runner: $RUNNER_OS/$RUNNER_ARCH"
echo "Runner image: ${ImageOS:-unknown}/${ImageVersion:-unknown}"
echo "Kernel: $(uname -srvm)"
if [[ -r /proc/cpuinfo ]]; then
awk -F: '/model name/{sub(/^[[:space:]]+/, "", $2); print "CPU: " $2; exit}' /proc/cpuinfo
fi
rustc --version
echo "Cargo.lock SHA-256: $(sha256sum Cargo.lock | awk '{print $1}')"
echo
cargo run --locked --quiet -p xtask --release --example engine_compare
} 2>&1 | tee -a "$report"
- name: Checkout immutable snapshot baseline
id: snapshot_baseline_checkout
if: ${{ always() && steps.checkout.outcome == 'success' }}
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: 03d7ca5c5420ca141afe56f725341faadb71af18
path: .tmon-snapshot-reference
persist-credentials: false
- name: Enforce immutable snapshot baseline
id: snapshot_regression_gate
if: ${{ always() && steps.checkout.outcome == 'success' && steps.snapshot_baseline_checkout.outcome == 'success' && steps.setup_rust.outcome == 'success' }}
shell: bash
run: |
set -euo pipefail
report="$RUNNER_TEMP/$TMON_BENCH_REPORT_NAME"
source_config="$RUNNER_TEMP/tmon-baseline-source.toml"
printf '%s\n' \
'[source.https-baseline]' \
'git = "https://github.com/lassejlv/termy"' \
'rev = "03d7ca5c5420ca141afe56f725341faadb71af18"' \
'replace-with = "local-baseline"' \
'' \
'[source.local-baseline]' \
"git = \"file://$GITHUB_WORKSPACE/.tmon-snapshot-reference\"" \
'rev = "03d7ca5c5420ca141afe56f725341faadb71af18"' \
'' \
'[net]' \
'git-fetch-with-cli = true' > "$source_config"
{
echo
cargo run --locked --quiet --release \
--manifest-path tools/tmon-revision-gate/Cargo.toml \
--config "$source_config"
} 2>&1 | tee -a "$report"
- name: Run allocation accounting
id: allocation_accounting
if: ${{ always() && steps.checkout.outcome == 'success' && steps.setup_rust.outcome == 'success' }}
shell: bash
env:
TERMY_CORE_TEST_BACKEND: alacritty
TMON_BENCH_ALLOCATIONS_ONLY: "1"
run: |
set -euo pipefail
report="$RUNNER_TEMP/$TMON_BENCH_REPORT_NAME"
{
echo
cargo run --locked --quiet -p xtask --release --example engine_compare --features benchmark-allocations
} 2>&1 | tee -a "$report"
- name: Finalize report
id: finalize_report
if: ${{ always() }}
shell: bash
env:
INITIALIZE_OUTCOME: ${{ steps.initialize_report.outcome }}
CHECKOUT_OUTCOME: ${{ steps.checkout.outcome }}
SNAPSHOT_BASELINE_CHECKOUT_OUTCOME: ${{ steps.snapshot_baseline_checkout.outcome }}
SETUP_RUST_OUTCOME: ${{ steps.setup_rust.outcome }}
CACHE_RUST_OUTCOME: ${{ steps.cache_rust.outcome }}
COMPARISON_OUTCOME: ${{ steps.comparison.outcome }}
SNAPSHOT_GATE_OUTCOME: ${{ steps.snapshot_regression_gate.outcome }}
ALLOCATION_OUTCOME: ${{ steps.allocation_accounting.outcome }}
run: |
set -euo pipefail
report="$RUNNER_TEMP/$TMON_BENCH_REPORT_NAME"
: >> "$report"
{
echo
echo "Workflow step outcomes"
echo "======================"
printf 'Initialize report: %s\n' "${INITIALIZE_OUTCOME:-unknown}"
printf 'Checkout: %s\n' "${CHECKOUT_OUTCOME:-unknown}"
printf 'Baseline checkout: %s\n' "${SNAPSHOT_BASELINE_CHECKOUT_OUTCOME:-unknown}"
printf 'Setup Rust: %s\n' "${SETUP_RUST_OUTCOME:-unknown}"
printf 'Cache Rust: %s\n' "${CACHE_RUST_OUTCOME:-unknown}"
printf 'Run comparison: %s\n' "${COMPARISON_OUTCOME:-unknown}"
printf 'Snapshot gate: %s\n' "${SNAPSHOT_GATE_OUTCOME:-unknown}"
printf 'Allocation report: %s\n' "${ALLOCATION_OUTCOME:-unknown}"
} >> "$report"
- name: Add report to job summary
id: summarize_report
if: ${{ always() }}
shell: bash
run: |
set -euo pipefail
report="$RUNNER_TEMP/$TMON_BENCH_REPORT_NAME"
if [[ ! -f "$report" ]]; then
echo "Benchmark report was not created; the runner survived long enough to summarize this failure." >> "$report"
fi
{
echo '## Tmon vs Alacritty'
echo '```text'
cat "$report"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload text report
id: upload_report
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: tmon-alacritty-benchmark-${{ github.sha }}
path: ${{ runner.temp }}/tmon-alacritty-benchmark.txt
if-no-files-found: error
retention-days: 30