diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index fc9330fb7d..9e448c132e 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -23,6 +23,17 @@ jobs: - name: Build run: cargo build + bench: + runs-on: self-hosted + steps: + - uses: actions/checkout@master + - uses: actions-rs/toolchain@v1.0.6 + with: + toolchain: nightly + override: true + - name: Cargo Bench + run: cargo +nightly bench | tee output.txt + build: needs: quick-tests runs-on: ubuntu-latest @@ -48,7 +59,7 @@ jobs: steps: - name: Checkout to repository uses: actions/checkout@v2 - - name: Setup Rust toolchain + - name: Setup Rust toolchain uses: actions-rs/toolchain@v1.0.7 with: toolchain: stable @@ -57,7 +68,7 @@ jobs: run: cargo install cargo-bump --force - name: Modify version with tag run: cargo bump ${{ github.ref_name }} - - name: Automatic commit for crate version upgrade + - name: Automatic commit for crate version upgrade uses: stefanzweifel/git-auto-commit-action@v4 with: branch: master diff --git a/benches/bench.rs b/benches/bench.rs new file mode 100644 index 0000000000..8f552f8d25 --- /dev/null +++ b/benches/bench.rs @@ -0,0 +1,41 @@ +#![feature(test)] + +extern crate test; + + +use test::Bencher; + + +use navigator_rs::Navigator; +// use std::thread::sleep; +// use std::time::Duration; + +// fn main() { +// println!("Creating your navigator module!"); +// let mut nav = Navigator::new(); + +// println!("Setting up your navigator, ahoy!"); +// nav.init(); + +// loop { +// nav.set_pwm_channel_value(PwmChannel::All, 0); +// println!("{:#?}", nav.fmt_debug()); +// sleep(Duration::from_millis(1000)); +// } +// } + + +#[bench] +fn init(b: &mut Bencher) { + b.iter(|| { + let mut nav = Navigator::new(); + let _ = nav.init(); + }); +} + +// #[bench] +// fn bench_fib_20(b: &mut Bencher) { +// b.iter(|| { +// let _ = fib(20); +// }); +// }