-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added benchmarks with the library [divan](https://crates.io/crates/divan) - Added more steps to the required tests ## Summary - **New Features** - Introduced benchmarking for input/output handling and logging to improve performance insights. - **Chores** - Added `divan` dependency for benchmarking. - Updated build workflow to include new benchmark steps.
- Loading branch information
Showing
4 changed files
with
337 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use actions_github::core::{get_input, set_output}; | ||
use actions_github::logger::{debug_log, error_log, info, is_debug, notice_log, warn_log}; | ||
|
||
fn main() { | ||
// Run registered benchmarks. | ||
divan::main(); | ||
} | ||
|
||
#[divan::bench(args = ["test", "value", "very long string"])] | ||
fn set_output_benchmark(value: &str) { | ||
match set_output("name", value) { | ||
Ok(_) => {} | ||
Err(err) => panic!("{:#?}", err), | ||
} | ||
} | ||
|
||
#[divan::bench(args = ["name", "place", "owner"])] | ||
fn get_input_benchmark(value: &str) { | ||
match get_input(value) { | ||
Ok(_) => panic!("{} should not be available", value), | ||
Err(_) => {} | ||
} | ||
} | ||
|
||
#[divan::bench] | ||
fn get_debug_benchmark() { | ||
if !is_debug() { | ||
panic!("It should be debug") | ||
} | ||
} | ||
|
||
#[divan::bench(args = ["hi", "example", "long words here"])] | ||
fn log_benchmark(msg: &str) { | ||
debug_log(msg); | ||
info(msg); | ||
warn_log(msg); | ||
error_log(msg); | ||
notice_log(msg); | ||
} |