From 5c60255e89fe7d13fea09d1433978b6e4b28d885 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti Date: Thu, 14 Nov 2024 17:28:03 +0100 Subject: [PATCH] update benchmarks workflows --- .../workflows/fork_pr_benchmark_closed.yaml | 19 ++++ .../run-and-track-benchmarks-on-main.yaml | 104 +++++++++--------- 2 files changed, 73 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/fork_pr_benchmark_closed.yaml diff --git a/.github/workflows/fork_pr_benchmark_closed.yaml b/.github/workflows/fork_pr_benchmark_closed.yaml new file mode 100644 index 0000000000..940a2786f1 --- /dev/null +++ b/.github/workflows/fork_pr_benchmark_closed.yaml @@ -0,0 +1,19 @@ +on: + pull_request_target: + types: [closed] + +jobs: + archive_fork_pr_branch: + name: Archive closed fork PR branch with Bencher + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: bencherdev/bencher@0.4.26 + - name: Archive closed fork PR branch with Bencher + run: | + bencher archive \ + --project save-walter-white-1234abcd \ + --token '${{ secrets.BENCHER_API_TOKEN }}' \ + --branch "$GITHUB_HEAD_REF" \ No newline at end of file diff --git a/.github/workflows/run-and-track-benchmarks-on-main.yaml b/.github/workflows/run-and-track-benchmarks-on-main.yaml index 33be08bc56..1c3ee116de 100644 --- a/.github/workflows/run-and-track-benchmarks-on-main.yaml +++ b/.github/workflows/run-and-track-benchmarks-on-main.yaml @@ -5,15 +5,18 @@ on: branches: - main +permissions: + checks: write + jobs: benchmark_sv1_criterion_with_bencher: name: Track sv1 criterion benchmarks with Bencher runs-on: ubuntu-latest env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_criterion - BENCHER_TESTBED: sv1 + BENCHER_PROJECT: stratum-v2-sri + BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} + BENCHER_ADAPTER: rust_criterion + BENCHER_TESTBED: sv1 steps: - name: Set up Rust uses: actions-rs/toolchain@v1 @@ -21,26 +24,26 @@ jobs: profile: minimal toolchain: 1.75.0 override: true + - name: Checkout repository - uses: actions/checkout@v2 - - - uses: actions/checkout@v4 + uses: actions/checkout@v4 + - uses: bencherdev/bencher@main - name: Benchmark with Bencher run: | - cd benches - bencher run \ - --github-actions ${{ secrets.GITHUB_TOKEN }} \ - "cargo bench --bench criterion_sv1_benchmark" + cd benches + bencher run \ + --github-actions ${{ secrets.GITHUB_TOKEN }} \ + "cargo bench --bench criterion_sv1_benchmark" benchmark_sv2_criterion_with_bencher: name: Track sv2 criterion benchmarks with Bencher runs-on: ubuntu-latest env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_criterion - BENCHER_TESTBED: sv2 + BENCHER_PROJECT: stratum-v2-sri + BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} + BENCHER_ADAPTER: rust_criterion + BENCHER_TESTBED: sv2 steps: - name: Set up Rust uses: actions-rs/toolchain@v1 @@ -48,26 +51,26 @@ jobs: profile: minimal toolchain: 1.75.0 override: true + - name: Checkout repository - uses: actions/checkout@v2 - - - uses: actions/checkout@v4 + uses: actions/checkout@v4 + - uses: bencherdev/bencher@main - name: Benchmark with Bencher run: | - cd benches - bencher run \ - --github-actions ${{ secrets.GITHUB_TOKEN }} \ - "cargo bench --bench criterion_sv2_benchmark" - + cd benches + bencher run \ + --github-actions ${{ secrets.GITHUB_TOKEN }} \ + "cargo bench --bench criterion_sv2_benchmark" + benchmark_sv1_iai_with_bencher: name: Track sv1 iai benchmarks with Bencher runs-on: ubuntu-latest env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_iai - BENCHER_TESTBED: sv1 + BENCHER_PROJECT: stratum-v2-sri + BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} + BENCHER_ADAPTER: rust_iai + BENCHER_TESTBED: sv1 steps: - name: Set up Rust uses: actions-rs/toolchain@v1 @@ -75,30 +78,31 @@ jobs: profile: minimal toolchain: 1.75.0 override: true + - name: Checkout repository uses: actions/checkout@v4 + - name: Install Valgrind run: | - sudo apt-get update - sudo apt-get install -y valgrind=1:3.18.1-1ubuntu2 - - - uses: actions/checkout@v4 + sudo apt-get update + sudo apt-get install -y valgrind=1:3.18.1-1ubuntu2 + - uses: bencherdev/bencher@main - name: Benchmark with Bencher run: | - cd benches - bencher run \ - --github-actions ${{ secrets.GITHUB_TOKEN }} \ - "cargo bench --bench iai_sv1_benchmark" - + cd benches + bencher run \ + --github-actions ${{ secrets.GITHUB_TOKEN }} \ + "cargo bench --bench iai_sv1_benchmark" + benchmark_sv2_iai_with_bencher: name: Track sv2 iai benchmarks with Bencher runs-on: ubuntu-latest env: - BENCHER_PROJECT: stratum-v2-sri - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_iai - BENCHER_TESTBED: sv2 + BENCHER_PROJECT: stratum-v2-sri + BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} + BENCHER_ADAPTER: rust_iai + BENCHER_TESTBED: sv2 steps: - name: Set up Rust uses: actions-rs/toolchain@v1 @@ -106,19 +110,19 @@ jobs: profile: minimal toolchain: 1.75.0 override: true + - name: Checkout repository - uses: actions/checkout@v2 - + uses: actions/checkout@v4 + - name: Install Valgrind run: | - sudo apt-get update - sudo apt-get install -y valgrind=1:3.18.1-1ubuntu2 - - - uses: actions/checkout@v4 + sudo apt-get update + sudo apt-get install -y valgrind=1:3.18.1-1ubuntu2 + - uses: bencherdev/bencher@main - name: Benchmark with Bencher run: | - cd benches - bencher run \ - --github-actions ${{ secrets.GITHUB_TOKEN }} \ - "cargo bench --bench iai_sv2_benchmark" \ No newline at end of file + cd benches + bencher run \ + --github-actions ${{ secrets.GITHUB_TOKEN }} \ + "cargo bench --bench iai_sv2_benchmark"