Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add before cmd option #114

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ inputs:
description: "Enable the default features of a crate while running the benchmark, usually the default features are enabled"
required: false
default: true
before:
description: "Run this command before every benchmark"
required: false
default: ""
runs:
using: "node16"
main: "dist/index.js"
4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ async function main() {
package: core.getInput("package"),
features: core.getInput("features"),
defaultFeatures: core.getInput("defaultFeatures"),
before: core.getInput("before"),
};
core.debug(`Inputs: ${inspect(inputs)}`);

Expand Down Expand Up @@ -45,6 +46,10 @@ async function main() {
core.debug("### Install Critcmp ###");
await exec.exec("cargo", ["install", "critcmp"]);

if (inputs.before) {
await exec.exec(inputs.before);
}

core.debug("### Benchmark starting ###");
await exec.exec(
"cargo",
Expand All @@ -58,6 +63,9 @@ async function main() {
core.getInput("branchName") || github.base_ref,
]);
core.debug("Checked out to base branch");
if (inputs.before) {
await exec.exec(inputs.before);
}
await exec.exec(
"cargo",
benchCmd.concat(["--", "--save-baseline", "base"]),
Expand Down