From 6ffa521b11aed27e44962a2823baf29b2bb76771 Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 14 Sep 2023 19:09:34 +0200 Subject: [PATCH 1/2] Create bencher.yml --- .github/workflows/bencher.yml | 200 ++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 .github/workflows/bencher.yml diff --git a/.github/workflows/bencher.yml b/.github/workflows/bencher.yml new file mode 100644 index 000000000..4d8733e9c --- /dev/null +++ b/.github/workflows/bencher.yml @@ -0,0 +1,200 @@ +name: Bencher + +on: + workflow_run: + workflows: [Run and Cache Benchmarks] + types: + - completed + +jobs: + track_sv1_criterion_with_bencher: + name: Track sv1 criterion benchmarks with Bencher + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + env: + BENCHER_PROJECT: stratum + BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} + BENCHER_ADAPTER: rust_criterion + BENCHER_TESTBED: sv1 + steps: + - name: Download Benchmark Results + uses: actions/github-script@v6 + with: + script: | + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "criterion_sv1_benchmarks" + })[0]; + let download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + let fs = require('fs'); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/criterion_sv1_benchmarks.zip`, Buffer.from(download.data)); + + - name: Unzip Benchmark Results + run: unzip criterion_sv1_benchmarks.zip + + - name: Setup Bencher + #uses: bencherdev/bencher@main + uses: baptiste0928/cargo-install@v2 + with: + crate: bencher_cli + git: https://github.com/bencherdev/bencher + branch: devel + + - name: Track Benchmarks with Bencher + run: | + cat criterion_sv1_benchmarks.txt | bencher run \ + --err \ + --github-actions ${{ secrets.GITHUB_TOKEN }} + + track_sv2_criterion_with_bencher: + name: Track sv1 criterion benchmarks with Bencher + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + env: + BENCHER_PROJECT: stratum + BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} + BENCHER_ADAPTER: rust_criterion + BENCHER_TESTBED: sv2 + steps: + - name: Download Benchmark Results + uses: actions/github-script@v6 + with: + script: | + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "criterion_sv2_benchmarks" + })[0]; + let download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + let fs = require('fs'); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/criterion_sv2_benchmarks.zip`, Buffer.from(download.data)); + + - name: Unzip Benchmark Results + run: unzip criterion_sv2_benchmarks.zip + + - name: Setup Bencher + #uses: bencherdev/bencher@main + uses: baptiste0928/cargo-install@v2 + with: + crate: bencher_cli + git: https://github.com/bencherdev/bencher + branch: devel + + - name: Track Benchmarks with Bencher + run: | + cat criterion_sv2_benchmarks.txt | bencher run \ + --err \ + --github-actions ${{ secrets.GITHUB_TOKEN }} + + track_sv1_iai_with_bencher: + name: Track sv1 iai benchmarks with Bencher + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + env: + BENCHER_PROJECT: stratum + BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} + BENCHER_ADAPTER: rust_iai + BENCHER_TESTBED: sv1 + steps: + - name: Download Benchmark Results + uses: actions/github-script@v6 + with: + script: | + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "iai_sv1_benchmarks" + })[0]; + let download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + let fs = require('fs'); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/iai_sv1_benchmarks.zip`, Buffer.from(download.data)); + + - name: Unzip Benchmark Results + run: unzip iai_sv1_benchmarks.zip + + - name: Setup Bencher + #uses: bencherdev/bencher@main + uses: baptiste0928/cargo-install@v2 + with: + crate: bencher_cli + git: https://github.com/bencherdev/bencher + branch: devel + + - name: Track Benchmarks with Bencher + run: | + cat iai_sv1_benchmarks.txt | bencher run \ + --err \ + --github-actions ${{ secrets.GITHUB_TOKEN }} + + track_sv2_iai_with_bencher: + name: Track sv2 iai benchmarks with Bencher + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + env: + BENCHER_PROJECT: stratum + BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} + BENCHER_ADAPTER: rust_iai + BENCHER_TESTBED: sv2 + steps: + - name: Download Benchmark Results + uses: actions/github-script@v6 + with: + script: | + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "iai_sv2_benchmarks" + })[0]; + let download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + let fs = require('fs'); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/iai_sv2_benchmarks.zip`, Buffer.from(download.data)); + + - name: Unzip Benchmark Results + run: unzip iai_sv2_benchmarks.zip + + - name: Setup Bencher + #uses: bencherdev/bencher@main + uses: baptiste0928/cargo-install@v2 + with: + crate: bencher_cli + git: https://github.com/bencherdev/bencher + branch: devel + + - name: Track Benchmarks with Bencher + run: | + cat iai_sv2_benchmarks.txt | bencher run \ + --err \ + --github-actions ${{ secrets.GITHUB_TOKEN }} From 7572e5962aa0781a646a2e635fe2b18844a2acaa Mon Sep 17 00:00:00 2001 From: Gabriele Vernetti <62447440+GitGab19@users.noreply.github.com> Date: Thu, 14 Sep 2023 19:09:51 +0200 Subject: [PATCH 2/2] Delete .github/workflows/benchmark.yaml --- .github/workflows/benchmark.yaml | 128 ------------------------------- 1 file changed, 128 deletions(-) delete mode 100644 .github/workflows/benchmark.yaml diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml deleted file mode 100644 index 15546b259..000000000 --- a/.github/workflows/benchmark.yaml +++ /dev/null @@ -1,128 +0,0 @@ -name: Benchmark - -on: pull_request_target - -jobs: - benchmark_sv1_criterion_with_bencher: - name: Track sv1 criterion benchmarks with Bencher - runs-on: ubuntu-latest - env: - BENCHER_PROJECT: stratum - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_criterion - BENCHER_TESTBED: sv1 - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.70.0 - override: true - - - name: Checkout repository - uses: actions/checkout@v2 - - - uses: actions/checkout@v3 - - uses: bencherdev/bencher@v0.3.10 - - name: Benchmark with Bencher - run: | - 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 - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_criterion - BENCHER_TESTBED: sv2 - steps: - - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.70.0 - override: true - - - name: Checkout repository - uses: actions/checkout@v2 - - - uses: actions/checkout@v3 - - uses: bencherdev/bencher@v0.3.10 - - name: Benchmark with Bencher - run: | - 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 - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_iai - BENCHER_TESTBED: sv1 - steps: - - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.70.0 - override: true - - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install Valgrind - run: | - sudo apt-get update - sudo apt-get install -y valgrind=1:3.18.1-1ubuntu2 - - - uses: actions/checkout@v3 - - uses: bencherdev/bencher@v0.3.10 - - name: Benchmark with Bencher - run: | - 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 - BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} - BENCHER_ADAPTER: rust_iai - BENCHER_TESTBED: sv2 - steps: - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.70.0 - override: true - - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Install Valgrind - run: | - sudo apt-get update - sudo apt-get install -y valgrind=1:3.18.1-1ubuntu2 - - - uses: actions/checkout@v3 - - uses: bencherdev/bencher@v0.3.10 - - name: Benchmark with Bencher - run: | - cd benches - bencher run \ - --github-actions ${{ secrets.GITHUB_TOKEN }} \ - "cargo bench --bench iai_sv2_benchmark"