Skip to content

Commit 76f29e9

Browse files
authored
Fixing merge issue (#1406)
The merge of the `Cargo.toml` file from #1287 went bananas 🤷 Another fix (not unexpected, this was my inexperience with GH Actions) make the perf commands fail when trigger by push.
1 parent f0ae53b commit 76f29e9

File tree

7 files changed

+49
-31
lines changed

7 files changed

+49
-31
lines changed

.github/workflows/benchmark_cargo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ on:
1414
bencherProject:
1515
description: "Bencher project:"
1616
type: "string"
17-
default: "slang-dashboard-cargo"
1817

1918
# Run on pushes to 'main' branch:
2019
push:
@@ -43,6 +42,7 @@ jobs:
4342
- name: "Set bencher project"
4443
run: |
4544
echo "SLANG_BENCHER_PROJECT=${{ inputs.bencherProject }}" >> $GITHUB_ENV
45+
if: "${{ inputs.bencherProject }}"
4646

4747
- name: "infra setup"
4848
run: "./scripts/bin/infra setup"

.github/workflows/benchmark_npm.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ on:
1414
bencherProject:
1515
description: "Bencher project:"
1616
type: "string"
17-
default: "slang-dashboard-npm"
1817

1918
# Run on pushes to 'main' branch:
2019
push:
@@ -42,7 +41,8 @@ jobs:
4241

4342
- name: "Set bencher project"
4443
run: |
45-
echo "SLANG_BENCHER_PROJECT=${{ inputs.bencherProject }}" >> $GITHUB_ENV
44+
echo "SLANG_BENCHER_PROJECT=${{ inputs.bencherProject || 'slang-dashboard-npm' }}" >> $GITHUB_ENV
45+
if: "${{ inputs.bencherProject }}"
4646

4747
- name: "infra setup"
4848
run: "./scripts/bin/infra setup"

Cargo.lock

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ members = [
3535
"crates/solidity/outputs/npm/package",
3636
"crates/solidity/outputs/spec",
3737
"crates/solidity/testing/perf",
38+
"crates/solidity/testing/perf/npm",
3839
"crates/solidity/testing/snapshots",
3940
"crates/solidity/testing/solc",
4041
"crates/solidity/testing/sourcify",
@@ -64,23 +65,18 @@ metaslang_bindings = { path = "crates/metaslang/bindings", version = "1.2.1" }
6465
metaslang_graph_builder = { path = "crates/metaslang/graph_builder", version = "1.2.1" }
6566
metaslang_cst = { path = "crates/metaslang/cst", version = "1.2.1" }
6667

67-
slang_solidity = { path = "crates/solidity/outputs/cargo/crate", version = "1.2.0" }
68-
slang_solidity_cli = { path = "crates/solidity/outputs/cargo/cli", version = "1.2.0" }
69-
solidity_cargo_tests = { path = "crates/solidity/outputs/cargo/tests", version = "1.2.0" }
70-
solidity_cargo_wasm = { path = "crates/solidity/outputs/cargo/wasm", version = "1.2.0" }
71-
solidity_language = { path = "crates/solidity/inputs/language", version = "1.2.0" }
72-
solidity_npm_package = { path = "crates/solidity/outputs/npm/package", version = "1.2.0" }
73-
solidity_spec = { path = "crates/solidity/outputs/spec", version = "1.2.0" }
74-
solidity_testing_perf = { path = "crates/solidity/testing/perf", version = "1.2.0" }
75-
solidity_testing_snapshots = { path = "crates/solidity/testing/snapshots", version = "1.2.0" }
76-
solidity_testing_solc = { path = "crates/solidity/testing/solc", version = "1.2.0" }
77-
solidity_testing_sourcify = { path = "crates/solidity/testing/sourcify", version = "1.2.0" }
78-
79-
slang_testlang = { path = "crates/testlang/outputs/cargo/crate", version = "1.2.0" }
80-
testlang_cargo_tests = { path = "crates/testlang/outputs/cargo/tests", version = "1.2.0" }
81-
testlang_cargo_wasm = { path = "crates/testlang/outputs/cargo/wasm", version = "1.2.0" }
82-
testlang_language = { path = "crates/testlang/inputs/language", version = "1.2.0" }
83-
testlang_npm_package = { path = "crates/testlang/outputs/npm/package", version = "1.2.0" }
68+
slang_solidity = { path = "crates/solidity/outputs/cargo/crate", version = "1.2.1" }
69+
slang_solidity_cli = { path = "crates/solidity/outputs/cargo/cli", version = "1.2.1" }
70+
solidity_cargo_tests = { path = "crates/solidity/outputs/cargo/tests", version = "1.2.1" }
71+
solidity_cargo_wasm = { path = "crates/solidity/outputs/cargo/wasm", version = "1.2.1" }
72+
solidity_language = { path = "crates/solidity/inputs/language", version = "1.2.1" }
73+
solidity_npm_package = { path = "crates/solidity/outputs/npm/package", version = "1.2.1" }
74+
solidity_spec = { path = "crates/solidity/outputs/spec", version = "1.2.1" }
75+
solidity_testing_perf = { path = "crates/solidity/testing/perf", version = "1.2.1" }
76+
solidity_testing_perf_npm = { path = "crates/solidity/testing/perf/npm", version = "1.2.1" }
77+
solidity_testing_snapshots = { path = "crates/solidity/testing/snapshots", version = "1.2.1" }
78+
solidity_testing_solc = { path = "crates/solidity/testing/solc", version = "1.2.1" }
79+
solidity_testing_sourcify = { path = "crates/solidity/testing/sourcify", version = "1.2.1" }
8480

8581
#
8682
# External

crates/infra/cli/src/commands/perf/cargo/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ use infra_utils::paths::PathExtensions;
1010
use crate::toolchains::bencher::run_bench;
1111
use crate::utils::DryRun;
1212

13+
const DEFAULT_BENCHER_PROJECT: &str = "slang-dashboard-cargo";
14+
1315
#[derive(Clone, Debug, Parser)]
1416
pub struct CargoController {
1517
#[command(flatten)]
@@ -70,7 +72,12 @@ impl CargoController {
7072
fn run_iai_bench(&self, package_name: &str, bench_name: &str) {
7173
let test_runner = format!("cargo bench --package {package_name} --bench {bench_name}");
7274

73-
run_bench(self.dry_run.get(), "rust_iai_callgrind", &test_runner);
75+
run_bench(
76+
self.dry_run.get(),
77+
DEFAULT_BENCHER_PROJECT,
78+
"rust_iai_callgrind",
79+
&test_runner,
80+
);
7481

7582
let reports_dir = Path::repo_path("target/iai")
7683
.join(package_name)

crates/infra/cli/src/commands/perf/npm/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use infra_utils::cargo::CargoWorkspace;
55
use crate::toolchains::bencher::run_bench;
66
use crate::utils::DryRun;
77

8+
const DEFAULT_BENCHER_PROJECT: &str = "slang-dashboard-npm";
9+
810
#[derive(Clone, Debug, Parser)]
911
pub struct NpmController {
1012
#[arg(short, long, default_value_t = String::from(".*"))]
@@ -38,7 +40,12 @@ impl NpmController {
3840
hot = &self.hot,
3941
);
4042

41-
run_bench(self.dry_run.get(), "json", &test_runner);
43+
run_bench(
44+
self.dry_run.get(),
45+
DEFAULT_BENCHER_PROJECT,
46+
"json",
47+
&test_runner,
48+
);
4249
}
4350

4451
#[allow(clippy::unnecessary_wraps)]

crates/infra/cli/src/toolchains/bencher/mod.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,7 @@ use infra_utils::github::GitHub;
66
// Source: https://github.com/bencherdev/bencher/blob/aa31a002842cfb0da9d6c60569396fc5261f5111/tasks/test_api/src/task/test/smoke_test.rs#L20
77
const BENCHER_TEST_TOKEN: &str = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhcGlfa2V5IiwiZXhwIjo1OTkzNjQyMTU2LCJpYXQiOjE2OTg2NzQ4NjEsImlzcyI6Imh0dHBzOi8vZGV2ZWwtLWJlbmNoZXIubmV0bGlmeS5hcHAvIiwic3ViIjoibXVyaWVsLmJhZ2dlQG5vd2hlcmUuY29tIiwib3JnIjpudWxsfQ.9z7jmM53TcVzc1inDxTeX9_OR0PQPpZAsKsCE7lWHfo";
88

9-
// Default bencher project. Can be overriden with the env var SLANG_BENCHER_PROJECT
10-
const BENCHER_PROJECT: &str = "slang-extended-dashboard";
11-
12-
fn get_bencher_project() -> String {
13-
std::env::var("SLANG_BENCHER_PROJECT").unwrap_or(String::from(BENCHER_PROJECT))
14-
}
15-
16-
pub(crate) fn run_bench(dry_run: bool, adapter: &str, test_runner: &str) {
9+
pub(crate) fn run_bench(dry_run: bool, project: &str, adapter: &str, test_runner: &str) {
1710
let token = if dry_run {
1811
BENCHER_TEST_TOKEN.to_string()
1912
} else {
@@ -28,7 +21,7 @@ pub(crate) fn run_bench(dry_run: bool, adapter: &str, test_runner: &str) {
2821
"dev"
2922
};
3023

31-
let project = get_bencher_project();
24+
let project = std::env::var("SLANG_BENCHER_PROJECT").unwrap_or(project.to_owned());
3225

3326
let mut command = Command::new("bencher")
3427
.arg("run")

0 commit comments

Comments
 (0)