Test new iai-callgrind #44
Workflow file for this run
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
name: Benchmark | |
on: | |
pull_request: | |
types: [labeled] | |
env: | |
CARGO_TERM_COLOR: always | |
IAI_CALLGRIND_COLOR: never | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
jobs: | |
bench: | |
if: contains(github.event.pull_request.labels.*.name, 'run benchmarks') | |
permissions: | |
pull-requests: write | |
env: | |
WORKSPACE: ${{ github.workspace }} | |
URL: ${{ github.event.pull_request.comments_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.base.ref }} | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: taiki-e/install-action@valgrind | |
- uses: taiki-e/install-action@cargo-binstall | |
- name: Install iai-callgrind-runner for base branch | |
run: | | |
version=$(cargo metadata --format-version=1 |\ | |
jq '.packages[] | select(.name == "iai-callgrind").version' |\ | |
tr -d '"' | |
) | |
cargo binstall --no-confirm --no-symlinks iai-callgrind-runner --version "${version}" | |
- name: Bench base branch | |
run: | | |
cargo update | |
cargo bench -q --bench bench > "${WORKSPACE}"/____old_results.txt | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
clean: false | |
- name: Install iai-callgrind-runner for head branch | |
run: | | |
version=$(cargo metadata --format-version=1 |\ | |
jq '.packages[] | select(.name == "iai-callgrind").version' |\ | |
tr -d '"' | |
) | |
cargo binstall --no-confirm --no-symlinks iai-callgrind-runner --version "${version}" | |
- name: Bench head branch | |
run: | | |
cargo update | |
cargo bench -q --bench bench > "${WORKSPACE}"/____results.txt | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.base.ref }} | |
clean: false | |
- name: Bench base branch no finalization | |
run: | | |
cargo clean | |
cargo update | |
cargo bench --no-default-features -F std,derive,auto-collect -q --bench bench > "${WORKSPACE}"/____old_results_no_finalization.txt | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
clean: false | |
- name: Bench head branch no finalization | |
run: | | |
cargo update | |
cargo bench --no-default-features -F std,derive,auto-collect -q --bench bench > "${WORKSPACE}"/____results_no_finalization.txt | |
- name: Write comment | |
run: | | |
{ | |
echo '<strong>Benchmark results:</strong>' | |
echo '' | |
echo '```txt' | |
cat "${WORKSPACE}"/____results.txt | |
echo '```' | |
echo '' | |
echo '<details><summary><strong>Old results:</strong></summary><p>' | |
echo '' | |
echo '```txt' | |
cat "${WORKSPACE}"/____old_results.txt | |
echo '```' | |
echo '</p></details>' | |
echo '' | |
echo '---' | |
echo '' | |
echo '<details><summary><strong>Results without finalization:</strong></summary><p>' | |
echo '' | |
echo '```txt' | |
cat "${WORKSPACE}"/____results_no_finalization.txt | |
echo '```' | |
echo '' | |
echo '<details><summary><strong>Old results without finalization:</strong></summary><p>' | |
echo '' | |
echo '```txt' | |
cat "${WORKSPACE}"/____old_results_no_finalization.txt | |
echo '```' | |
echo '</p></details></p></details>' | |
} > "${WORKSPACE}"/__result.txt | |
- uses: thollander/[email protected] | |
with: | |
filePath: '__result.txt' | |
mode: recreate | |
- name: Remove label | |
uses: actions-ecosystem/[email protected] | |
with: | |
labels: "run benchmarks" |