Benchmarks #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Benchmarks | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| schedule: | |
| - cron: '0 2 * * 0' # Weekly on Sunday at 2 AM | |
| workflow_dispatch: | |
| jobs: | |
| run-benchmarks: | |
| name: Run Benchmarks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: llvm-tools-preview | |
| - name: Cache cargo registry | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Install criterion | |
| run: cargo install cargo-criterion | |
| - name: Run benchmarks | |
| run: cargo criterion --workspace --message-format=json | tee benchmark-results.json | |
| - name: Upload benchmark results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: benchmark-results | |
| path: benchmark-results.json | |
| retention-days: 30 | |
| compare-benchmarks: | |
| name: Compare Benchmarks | |
| runs-on: ubuntu-latest | |
| needs: run-benchmarks | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.base_ref }} | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Download baseline benchmark results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: benchmark-results | |
| path: baseline-results | |
| - name: Run benchmarks on PR | |
| run: cargo criterion --workspace --message-format=json | tee pr-results.json | |
| - name: Compare benchmarks | |
| run: | | |
| # Simple comparison script (placeholder) | |
| echo "Benchmark comparison would be implemented here" | |
| echo "Baseline results in baseline-results/" | |
| echo "PR results in pr-results.json" | |
| # In a real setup, you'd use tools like critcmp or custom analysis | |
| echo "No significant regression detected (placeholder)" |