From 19cc48771056c15ce3ffeb0260b9501b388148ad Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Fri, 9 Feb 2024 09:23:08 +0200 Subject: [PATCH 1/4] ci: Add benchmark run --- .github/workflows/bench.yml | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/bench.yml diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml new file mode 100644 index 0000000000..aa5662d2bd --- /dev/null +++ b/.github/workflows/bench.yml @@ -0,0 +1,49 @@ +name: Bench +on: + workflow_run: + workflows: ["CI"] + types: [completed] + push: + branches: ["main"] + paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"] + pull_request: + branches: ["main"] + paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"] +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + +jobs: + on-success: + name: Benchmark + runs-on: self-hosted + + steps: + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + # components: rustfmt, clippy, llvm-tools-preview + + - name: Use sccache + uses: mozilla-actions/sccache-action@v0.0.4 + + - name: Enable sscache + run: | + echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" + echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV" + + - name: Install dependencies (Linux) + env: + DEBIAN_FRONTEND: noninteractive + run: | + sudo apt-get install -y --no-install-recommends gyp mercurial ninja-build lld + echo "RUSTFLAGS=-C link-arg=-fuse-ld=lld" >> "$GITHUB_ENV" + + - name: Checkout + uses: actions/checkout@v4 + + - name: Build + run: | + cargo bench --features ci,bench + From 2d46c8f135a0abbfb3f75c9644148caf755a4e53 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Fri, 9 Feb 2024 09:47:54 +0200 Subject: [PATCH 2/4] Only run when CI succeeded --- .github/workflows/bench.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index aa5662d2bd..d171791105 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -3,12 +3,12 @@ on: workflow_run: workflows: ["CI"] types: [completed] - push: - branches: ["main"] - paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"] - pull_request: - branches: ["main"] - paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"] + # push: + # branches: ["main"] + # paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"] + # pull_request: + # branches: ["main"] + # paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"] env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 From e35b1b80794110e54ed3f8e576959ff675321e36 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Fri, 9 Feb 2024 09:48:06 +0200 Subject: [PATCH 3/4] Generate debug info for bench builds --- Cargo.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index eb6a0b7207..3da82dab90 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,3 +21,8 @@ license = "MIT OR Apache-2.0" # Don't increase beyond what Firefox is currently using: # https://firefox-source-docs.mozilla.org/writing-rust-code/update-policy.html#schedule rust-version = "1.74.0" + +[profile.bench] +# Inherits from the "release" profile, so just provide overrides here: +# https://doc.rust-lang.org/cargo/reference/profiles.html#release +debug = true From debda1d8557406aa513864e25cc734fb5b3301d7 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Fri, 9 Feb 2024 10:14:45 +0200 Subject: [PATCH 4/4] Try and fix the condition --- .github/workflows/bench.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index d171791105..a1a8020699 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -3,21 +3,15 @@ on: workflow_run: workflows: ["CI"] types: [completed] - # push: - # branches: ["main"] - # paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"] - # pull_request: - # branches: ["main"] - # paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"] env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 jobs: - on-success: + bench: name: Benchmark runs-on: self-hosted - + if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Install Rust uses: dtolnay/rust-toolchain@master