Skip to content

docs: comprehensive documentation beautification and formatting impro… #6

docs: comprehensive documentation beautification and formatting impro…

docs: comprehensive documentation beautification and formatting impro… #6

name: Performance Regression
on:
pull_request:
branches: [main]
push:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
benchmark:
name: Performance Regression Check
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-nextest
uses: taiki-e/install-action@cargo-nextest
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run benchmarks
run: |
cargo bench -- --save-baseline pr
- name: Checkout main
run: |
git stash
git checkout main
- name: Run main benchmarks
run: |
cargo bench -- --save-baseline main
- name: Compare benchmarks
run: |
echo "## Performance Comparison" > benchmark-results.md
echo "" >> benchmark-results.md
cargo bench -- --baseline main | tee -a benchmark-results.md
# Check for regressions
if grep -q "regressed" benchmark-results.md; then
echo "::error::Performance regression detected!"
cat benchmark-results.md
exit 1
fi
- name: Comment PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const results = fs.readFileSync('benchmark-results.md', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: results
});
- name: Upload results
if: always()
uses: actions/upload-artifact@v3
with:
name: benchmark-results
path: benchmark-results.md