Add benchmarks using library interface

This commit is contained in:
infogulch
2023-11-11 11:22:02 -06:00
committed by Joe Taber
parent 1656d9d7ad
commit 8570f119c0
12 changed files with 727 additions and 21 deletions

View File

@@ -48,7 +48,5 @@ runs:
# Must be placed after actions/cache so its post step runs first.
- uses: pyTooling/Actions/with-post-step@v0.4.6
with:
main: "true"
post: |
echo Post job cleanup: bash -c "cargo clean -p `cargo metadata --format-version 1 | jq -r '[.workspace_members[]|split(\" \")|.[0]]|join(\" \")'`"
bash -c "cargo clean -p `cargo metadata --format-version 1 | jq -r '[.workspace_members[]|split(\" \")|.[0]]|join(\" \")'`"
main: bash ./.github/actions/setup-rust/cleanup.sh
post: bash ./.github/actions/setup-rust/cleanup.sh

10
.github/actions/setup-rust/cleanup.sh vendored Executable file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
echo Cleanup workspace build artifacts and extra target output
# clean just the direct members of the current workspace, with cargo metadata should generalize to all rust projects
cargo clean -p `cargo metadata --format-version 1 | jq -r '[.workspace_members[]|split(" ")|.[0]]|join(" ")'`
# remove directories in /target/ that are not named `debug` or `release`
find ./target -maxdepth 1 -type d ! -name debug ! -name release ! -name target -exec rm -r {} \;

View File

@@ -139,6 +139,8 @@ jobs:
cache-context: report
- run: |
cargo install cargo2junit --force
cargo install iai-callgrind-runner --force --version `cargo metadata --format-version 1 | jq -r '.resolve.nodes[].id|split(" ")|select(.[0]=="iai-callgrind")|.[1]'`
sudo apt install valgrind -y
- name: Test and report
run: |
@@ -156,6 +158,22 @@ jobs:
fail_on: nothing
comment_mode: off
- run: cargo build --bench run_iai --release
- run: cargo bench --bench run_iai
- run: cargo bench --bench run_criterion
- name: Publish criterion benchmark results
uses: actions/upload-artifact@v3
with:
name: bench-criterion-results
path: target/criterion/**/*
- name: Publish iai benchmark results
uses: actions/upload-artifact@v3
with:
name: bench-iai-results
path: target/iai/scryer-prolog/run_iai/bench_group/*
# Publish binaries when building for a tag
release:
runs-on: ubuntu-20.04