From 93000a42d72252cadbbe05c54123bf70310b8e36 Mon Sep 17 00:00:00 2001 From: alankritdabral <95607957+alankritdabral@users.noreply.github.com> Date: Mon, 8 Apr 2024 17:55:18 +0530 Subject: [PATCH 1/3] Update benchmark.yml --- .github/workflows/benchmark.yml | 59 ++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 2aba2d2397..e64286eee0 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -69,8 +69,8 @@ jobs: name: body path: ci-benchmark/body.md - Cache_Benchmarks: - name: Cache Micro Benchmarks result + Track_and_Cache_Benchmarks: + name: Track and Cache Micro Benchmarks if: (github.event_name == 'push' && github.ref == 'refs/heads/main') permissions: pull-requests: write @@ -83,17 +83,24 @@ jobs: - name: Install Rust uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Run Benchmarks + - name: Install Bencher CLI + uses: bencherdev/bencher@main + + - name: Run and track Benchmarks run: | - cargo install cargo-criterion rust-script - cargo criterion --message-format=json > benches/main_benchmarks.json - ./scripts/json_to_md.rs benches/main_benchmarks.json > benches/main_benchmarks.md - cat benches/main_benchmarks.md + cargo bench > benches/base.txt + bencher run \ + --project tailcall-2192953494 \ + --branch main \ + --testbed benchmarking-runner \ + --token "${{ secrets.BENCHER_API_TOKEN }}" \ + --adapter rust_criterion \ + --file benches/base.txt - name: Cache Criterion Benchmarks Json uses: actions/cache@v4 with: - path: benches/main_benchmarks.json + path: benches/base.txt key: criterion_benchmarks_${{ github.sha }} Criterion_Compare: @@ -114,22 +121,36 @@ jobs: - name: Run Criterion Benchmarks run: | - cargo install cargo-criterion rust-script - cargo criterion --message-format=json > benches/benchmarks.json - ./scripts/json_to_md.rs benches/benchmarks.json > benches/change_benchmarks.md - - - name: Print Criterion Benchmarks - run: cat benches/change_benchmarks.md + cargo bench > benches/change.txt - name: Restore file uses: actions/cache@v4 with: - path: benches/main_benchmarks.json + path: benches/base.txt key: criterion_benchmarks_${{ github.event.pull_request.base.sha }} fail-on-cache-miss: true - - name: Print Benchmark Comparision - run: ./scripts/criterion_compare.rs benches/main_benchmarks.json benches/benchmarks.json table + - name: Install Bencher CLI + uses: bencherdev/bencher@main - - name: Check Degradation - run: ./scripts/criterion_compare.rs benches/main_benchmarks.json benches/benchmarks.json check + - name: Create PR threshold + run: | + bencher threshold create \ + --project tailcall-2192953494 \ + --branch '${{ github.ref }}' \ + --testbed benchmarking-runner \ + --adapter rust_criterion \ + --measure latency \ + --test t \ + --upper-boundary 0.90 \ + --token "${{ secrets.BENCHER_API_TOKEN }}" + + - name: Track PR Benchmarks + run: | + bencher run \ + --branch '${{ github.ref }}' \ + --token "${{ secrets.BENCHER_API_TOKEN }}" \ + --ci-number '${{ github.event.pull_request.number }}' \ + --github-actions "${{ secrets.GITHUB_TOKEN }}" \ + --err \ + --file benches/change.txt From 4a4fc17588697daf2515a808fd9c6c1a1838c0d8 Mon Sep 17 00:00:00 2001 From: alankritdabral <95607957+alankritdabral@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:04:00 +0530 Subject: [PATCH 2/3] Update benchmark.yml --- .github/workflows/benchmark.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index e64286eee0..c859a9bb6b 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -75,7 +75,7 @@ jobs: permissions: pull-requests: write contents: write - runs-on: benchmarking-runner + runs-on: ubuntu-latest steps: - name: Check out code uses: actions/checkout@v4 @@ -106,7 +106,7 @@ jobs: Criterion_Compare: name: Comparing Micro Benchmarks if: "contains(github.event.pull_request.labels.*.name, 'ci: benchmark')" - runs-on: benchmarking-runner + runs-on: ubuntu-latest permissions: pull-requests: write contents: write From 64fba6fc902556cddf5a309118b164d23f422764 Mon Sep 17 00:00:00 2001 From: alankritdabral <95607957+alankritdabral@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:16:30 +0530 Subject: [PATCH 3/3] Update benchmark.yml --- .github/workflows/benchmark.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index c859a9bb6b..61a20f11e3 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -137,7 +137,7 @@ jobs: run: | bencher threshold create \ --project tailcall-2192953494 \ - --branch '${{ github.ref }}' \ + --branch '${{ github.head_ref }}' \ --testbed benchmarking-runner \ --adapter rust_criterion \ --measure latency \ @@ -148,7 +148,7 @@ jobs: - name: Track PR Benchmarks run: | bencher run \ - --branch '${{ github.ref }}' \ + --branch '${{ github.head_ref }}' \ --token "${{ secrets.BENCHER_API_TOKEN }}" \ --ci-number '${{ github.event.pull_request.number }}' \ --github-actions "${{ secrets.GITHUB_TOKEN }}" \