Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Improve CI benchmark speed #85

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 40 additions & 11 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Test all targets

on: [push, pull_request]
on:
push:
pull_request:
workflow_dispatch:

permissions:
contents: write
Expand Down Expand Up @@ -55,18 +58,42 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./pages

bench:
needs: build
cross-compile-bench:
needs: build
if: ${{ github.repository_owner == 'bluerobotics' }}
runs-on: ubuntu-latest
strategy:
matrix:
TARGET: [armv7-unknown-linux-gnueabihf]
steps:
- uses: actions/checkout@master
- name: Cross-compile benchmark
uses: houseabsolute/[email protected]
with:
command: bench
target: ${{ matrix.TARGET }}
args: "--no-run"
- name: Upload benchmark binary
uses: actions/[email protected]
with:
name: benchmark-binary
path: target/${{ matrix.TARGET }}/release/deps/bench-*
retention-days: 1

run-bench:
needs: cross-compile-bench
if: ${{ github.repository_owner == 'bluerobotics' }}
runs-on: raspbian-armv7-kernel-5.10.33
steps:
- uses: actions/checkout@master
- uses: dtolnay/rust-toolchain@stable
- name: Rust | Cache
uses: Swatinem/rust-cache@v2
- name: Download benchmark binary
uses: actions/[email protected]
with:
prefix-key: "rust-cache"
shared-key: "benchmark"
name: benchmark-binary
path: ./bench-binary
- name: Make benchmark executable
run: |
chmod +x ./bench-binary/*
- name: Get previous benchmark data
run: |
echo "Fetching gh-pages branch"
Expand All @@ -83,10 +110,12 @@ jobs:
echo "Copying data file from gh-pages to cache"
cp dev/cache/benchmark-data.json cache/benchmark-data.json || { echo "Failed to copy data file" ; exit 1; }

echo "Checking out current preivous branch"
echo "Checking out current previous branch"
git checkout -
- name: Cargo Bench
run: cargo bench --jobs 1 --bench bench -- --output-format bencher | tee output.txt || { echo "Benchmark failed"; exit 1; }
- name: Run benchmark
run: |
BENCH_BINARY=$(find ./bench-binary -type f -executable -name "bench-*" -not -name "*.d" | head -n 1)
"$BENCH_BINARY" --bench --output-format bencher | tee output.txt || { echo "Basic benchmark failed"; exit 1; }
- name: Compare results & store cached results
uses: benchmark-action/[email protected]
with:
Expand Down