From b885aa6159734051f18c2cb095aebce5247368cd Mon Sep 17 00:00:00 2001 From: Arthur Pastel Date: Wed, 12 Mar 2025 10:42:32 +0100 Subject: [PATCH 1/3] tests: add an env variable bench for testing --- .github/workflows/ci.yml | 4 ++++ crates/divan_compat/examples/Cargo.toml | 4 ++++ crates/divan_compat/examples/benches/env.rs | 9 +++++++++ 3 files changed, 17 insertions(+) create mode 100644 crates/divan_compat/examples/benches/env.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db1b1e52..8e49f8b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,6 +67,8 @@ jobs: - name: Run the benchmarks uses: CodSpeedHQ/action@main + env: + MY_ENV_VAR: "YES" with: run: cargo codspeed run token: ${{ secrets.CODSPEED_TOKEN }} @@ -89,6 +91,8 @@ jobs: - name: Run the benchmarks uses: CodSpeedHQ/action@main + env: + MY_ENV_VAR: "YES" with: run: cargo codspeed run token: ${{ secrets.CODSPEED_TOKEN }} diff --git a/crates/divan_compat/examples/Cargo.toml b/crates/divan_compat/examples/Cargo.toml index 30f830ca..188a5c0c 100644 --- a/crates/divan_compat/examples/Cargo.toml +++ b/crates/divan_compat/examples/Cargo.toml @@ -33,6 +33,10 @@ harness = false name = "time_scale" harness = false +[[bench]] +name = "env" +harness = false + [[bench]] name = "the_algorithms" harness = false diff --git a/crates/divan_compat/examples/benches/env.rs b/crates/divan_compat/examples/benches/env.rs new file mode 100644 index 00000000..ecb47d70 --- /dev/null +++ b/crates/divan_compat/examples/benches/env.rs @@ -0,0 +1,9 @@ +fn main() { + divan::main(); +} + +#[divan::bench] +fn print_env_hello() { + let env_var = std::env::var("MY_ENV_VAR").unwrap_or("not set".to_string()); + println!("MY_ENV_VAR is {}", env_var); +} From f9c8de216447fb28a589402d7d174f0e68ce0ad6 Mon Sep 17 00:00:00 2001 From: Arthur Pastel Date: Wed, 12 Mar 2025 10:48:25 +0100 Subject: [PATCH 2/3] ci: use sharded upload --- .github/workflows/ci.yml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e49f8b1..70682b4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,14 @@ jobs: compat-integration-test-instrumentation: runs-on: ubuntu-latest + strategy: + matrix: + build-args: + - "-p codspeed" + - "-p codspeed-bencher-compat" + - "--features async_futures -p codspeed-criterion-compat" + - "-p codspeed-divan-compat" + - "-p codspeed-divan-compat-examples" steps: - uses: actions/checkout@v4 with: @@ -58,12 +66,7 @@ jobs: - run: cargo install --path crates/cargo-codspeed --locked - - run: cargo codspeed build -p codspeed - - run: cargo codspeed build -p codspeed-bencher-compat - - run: cargo codspeed build --features async_futures -p codspeed-criterion-compat - - - run: cargo codspeed build -p codspeed-divan-compat - - run: cargo codspeed build -p codspeed-divan-compat-examples + - run: cargo codspeed build ${{ matrix.build-args }} - name: Run the benchmarks uses: CodSpeedHQ/action@main @@ -75,6 +78,12 @@ jobs: compat-integration-test-walltime: runs-on: codspeed-macro + strategy: + matrix: + package: + - codspeed-divan-compat + - codspeed-divan-compat-examples + - codspeed-criterion-compat steps: - uses: actions/checkout@v4 with: @@ -85,9 +94,7 @@ jobs: - run: cargo install --path crates/cargo-codspeed --locked - - run: cargo codspeed build -p codspeed-divan-compat - - run: cargo codspeed build -p codspeed-divan-compat-examples - - run: cargo codspeed build -p codspeed-criterion-compat + - run: cargo codspeed build -p ${{ matrix.package }} - name: Run the benchmarks uses: CodSpeedHQ/action@main From 1b8f549d4bc325701a2287d2d2916085509b4db8 Mon Sep 17 00:00:00 2001 From: Arthur Pastel Date: Mon, 7 Apr 2025 09:35:51 +0200 Subject: [PATCH 3/3] chore(ci): use all-greens for the matrix jobs --- .github/workflows/ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70682b4b..f41079e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,3 +103,17 @@ jobs: with: run: cargo codspeed run token: ${{ secrets.CODSPEED_TOKEN }} + + check: + runs-on: ubuntu-latest + if: always() + needs: + - lint + - msrv-check + - tests + - compat-integration-test-instrumentation + - compat-integration-test-walltime + steps: + - uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJson( needs ) }}