Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelburnham committed Jan 30, 2024
1 parent 96e7889 commit 2b729b4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/bench-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: cargo install cargo-criterion
- name: Copy old benchmarks locally for comparison
run: |
mkdir -p target gh-pages/benchmarks/criterion
mkdir -p target gh-pages/benchmarks/criterion history
cp -r gh-pages/benchmarks/criterion target
- name: Set env vars
run: |
Expand All @@ -49,22 +49,22 @@ jobs:
run: |
echo $LABELS > labels.md
tar -cvzf fibonacci-${{ env.SHORT_SHA }}.tar.gz Cargo.lock fibonacci-${{ env.SHORT_SHA }}.json labels.md
working-directory: ${{ github.workspace }}
# Outputs plots to `./history`
- name: Generate historical performance plot
run: |
cargo run
- name: Copy benchmark json to history
run: cp *.png fibonacci-${{ env.SHORT_SHA }}.tar.gz history/
- name: Deploy latest benchmark report
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/criterion
destination_dir: benchmarks/criterion
# Outputs plots to `./history`
- name: Generate historical performance plot
run: cargo run
- name: Copy benchmark json to history
run: cp fibonacci-${{ env.SHORT_SHA }}.tar.gz history/
- name: Deploy benchmark history
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: history/
publish_dir: history
destination_dir: benchmarks/history
keep_files: true
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::plot::{generate_plots, prepare_plots};

// TODO: Switch to camino
fn get_paths() -> std::io::Result<Vec<std::path::PathBuf>> {
let entries = std::fs::read_dir("./benches")?
let entries = std::fs::read_dir(".")?
.flatten()
.filter_map(|e| {
let ext = e.path();
Expand Down
6 changes: 2 additions & 4 deletions src/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::data::BenchData;

pub fn generate_plots(data: &Plots) -> Result<(), Box<dyn Error>> {
for plot in data.iter() {
let out_file_name = format!("history/{}.png", plot.0);
let out_file_name = format!("./{}.png", plot.0);
let root = BitMapBackend::new(&out_file_name, (1024, 768)).into_drawing_area();
root.fill(&WHITE)?;

Expand Down Expand Up @@ -64,9 +64,7 @@ pub fn generate_plots(data: &Plots) -> Result<(), Box<dyn Error>> {
}

// To avoid the IO failure being ignored silently, we manually call the present function
root.present().expect(
"Unable to write result to file, please make sure 'history' dir exists under current dir",
);
root.present().expect("Unable to write result to file");
println!("Result has been saved to {}", out_file_name);
}

Expand Down

0 comments on commit 2b729b4

Please sign in to comment.