diff --git a/.github/workflows/reusable-ci.yml b/.github/workflows/reusable-ci.yml index efbe3ca..bee2707 100644 --- a/.github/workflows/reusable-ci.yml +++ b/.github/workflows/reusable-ci.yml @@ -276,3 +276,47 @@ jobs: fail_ci_if_error: false token: ${{ secrets.CODECOV_TOKEN }} + benchmarks: + runs-on: ubuntu-latest + needs: ci + if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' + steps: + - uses: actions/checkout@v5 + + - name: Install Rust (stable) + uses: dtolnay/rust-toolchain@v1 + with: + toolchain: stable + + - name: Cache cargo + uses: Swatinem/rust-cache@v2 + with: + save-if: ${{ github.ref == 'refs/heads/main' }} + + - name: Run benchmarks + run: cargo bench --no-fail-fast --features benchmarks -- --save-baseline ci-baseline + + - name: Upload benchmark results + uses: actions/upload-artifact@v4 + with: + name: benchmark-results + path: target/criterion/ + retention-days: 30 + + - name: Download previous benchmark + uses: actions/download-artifact@v4 + continue-on-error: true + with: + name: benchmark-results + path: target/criterion-previous/ + + - name: Compare with baseline + continue-on-error: true + run: | + if [ -d "target/criterion-previous" ]; then + echo "Comparing with previous benchmark..." + cargo bench --features benchmarks -- --baseline ci-baseline --noplot + else + echo "No previous benchmark found, skipping comparison" + fi + diff --git a/README.md b/README.md index 4e3e272..25b437f 100644 --- a/README.md +++ b/README.md @@ -459,4 +459,3 @@ assert_eq!(problem.grpc.expect("grpc").name, "UNAUTHENTICATED"); MSRV: **1.90** · License: **MIT OR Apache-2.0** · No `unsafe` -