Files
chanora/.github/workflows/bench-advisory.yml
T
Edison Jwa 5c8c6df16b Make beta release artifacts reproducible on Linux and Android
Constraint: SRS-118 and SRS-119 require a Linux release package and an Android release AAB, and the current workspace also needs the sibling oboe-rs checkout for Cargo manifest loading.
Rejected: Keep release packaging as ad-hoc local knowledge | CI and contributors would still miss the required artifacts and hit the missing oboe-rs prerequisite.
Confidence: medium
Scope-risk: moderate
Directive: If the oboe-rs fork path changes or is vendored, update the helper scripts and workflow checkout steps together.
Tested: bash -n tools/build-linux-deb.sh tools/build-android-aab.sh; python3 YAML parse for .github/workflows/ci.yml, .github/workflows/bench-advisory.yml, .github/workflows/bench-baseline-update.yml; git diff --check
Not-tested: End-to-end flutter build linux --release; end-to-end flutter build appbundle --release; GitHub Actions runtime execution
2026-05-25 03:21:21 +09:00

102 lines
3.7 KiB
YAML

name: bench-advisory
# SDD-120 §6 / SRS-218 — advisory-only realtime-audio bench workflow.
# Runs the criterion bench harness on PR + push events, compares the
# current results against the SAD-089 baseline JSON resolved at the
# merge-base, and renders a markdown report posted (or updated) as a
# single sticky PR comment. The job status is ALWAYS success — this
# workflow never fails a check on regression (SRS-218 clause 4).
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [product/scaffold-v0]
permissions:
pull-requests: write
contents: read
jobs:
bench-advisory:
name: bench-advisory
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout oboe-rs fork
run: git clone --depth 1 https://github.com/edisonjwa/oboe-rs.git ../oboe-rs
- name: System deps (cpal / Opus)
run: |
sudo apt-get update
sudo apt-get install -y \
libasound2-dev libpulse-dev pkg-config \
libopus-dev
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Run benchmarks
run: |
cargo bench -p chanora_audio \
--bench realtime_capture \
--bench opus_codec \
--bench resampler
- name: Emit current baseline JSON
run: cargo run --example emit_baseline -p chanora_audio
- name: Resolve merge-base baseline
run: |
DEFAULT_BRANCH="${{ github.event.repository.default_branch }}"
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE_SHA="${{ github.event.pull_request.base.sha }}"
MERGE_BASE=$(git merge-base "$BASE_SHA" HEAD || true)
else
MERGE_BASE=$(git merge-base "origin/${DEFAULT_BRANCH}" HEAD || true)
fi
if [ -n "$MERGE_BASE" ] && git show "${MERGE_BASE}:crates/chanora_audio/benches/baselines/x86_64-unknown-linux-gnu.json" > baseline.json 2>/dev/null; then
echo "BASELINE_FOUND=1" >> "$GITHUB_ENV"
else
echo "BASELINE_FOUND=0" >> "$GITHUB_ENV"
echo "{}" > baseline.json
fi
- name: Compare against baseline
run: |
cargo run --example compare_baseline -p chanora_audio -- \
--current current.json \
--baseline baseline.json \
--output report.md
- name: Post PR comment
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const body = fs.readFileSync('report.md', 'utf8');
const marker = '<!-- chanora-bench-advisory -->';
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const existing = comments.find(c => c.body && c.body.startsWith(marker));
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body,
});
}
- name: Upload report artifact (push events)
if: github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: bench-report
path: report.md