-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a composite action for the actual benchmarking
- Loading branch information
Showing
5 changed files
with
56 additions
and
25 deletions.
There are no files selected for viewing
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: 'Benchmarker' | ||
inputs: | ||
deploy-key: | ||
description: 'Deploy key to use for pushing to the benchmark data repo (ed25519 secret key)' | ||
required: true | ||
bench-repo: | ||
description: 'The benchmarking data repo (ssh clone url)' | ||
required: true | ||
metric-key: | ||
description: 'Unique key for this set of metrics' | ||
required: true | ||
benchmarks: | ||
description: 'The benchmarks to run as a json file' | ||
required: true | ||
outputs: | ||
random-number: | ||
description: "Random number" | ||
value: ${{ steps.random-number-generator.outputs.random-number }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Fetch previous benchmark results | ||
shell: bash | ||
run: | | ||
mkdir -p ~/.ssh | ||
echo "${{ inputs.deploy-key }}" > ~/.ssh/id_ed25519 | ||
chmod 600 ~/.ssh/id_ed25519 | ||
chmod 700 ~/.ssh | ||
git clone --depth 1 "${{ inputs.bench-repo }}" bench_data | ||
- name: Benchmark | ||
shell: bash | ||
run: | | ||
cd "${{ github.action_path }}" && cargo build --release | ||
"${{ github.action_path }}/target/release/benchmarker" "${{ inputs.benchmarks }}" "bench_data/metrics-${{ inputs.metric-key }}.json" > bench_results.json | ||
- name: Upload benchmark results to artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: "benchmark-results-${{ inputs.metric-key }}" | ||
path: bench_results.json | ||
- name: Upload benchmark results to bench repo | ||
if: github.event_name == 'push' | ||
shell: bash | ||
run: | | ||
cd bench_data | ||
git pull # ensure we have the latest state when another job pushed changes while benchmarking | ||
cat ../bench_results.json >> "metrics-${{ inputs.metric-key }}.json" | ||
git add . | ||
git -c user.name="Perf bot" -c [email protected] commit --message 📈 | ||
# git pull --rebase in case of a race condition with another job | ||
git push origin main || (git -c user.name="Perf bot" -c [email protected] pull --rebase && git push origin main) |
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,30 +48,10 @@ jobs: | |
RUSTFLAGS="-Ctarget-cpu=native -Cllvm-args=-enable-dfa-jump-thread" cargo build --target ${{matrix.target}} -p test-libz-rs-sys --release --examples | ||
cp target/${{matrix.target}}/release/examples/blogpost-compress . | ||
cp target/${{matrix.target}}/release/examples/blogpost-uncompress . | ||
- name: Fetch previous benchmark results | ||
run: | | ||
mkdir -p ~/.ssh | ||
echo "${{ secrets.BENCH_DATA_DEPLOY_KEY }}" > ~/.ssh/id_ed25519 | ||
chmod 600 ~/.ssh/id_ed25519 | ||
chmod 700 ~/.ssh | ||
git clone --depth 1 [email protected]:trifectatechfoundation/zlib-rs-bench.git | ||
- name: Benchmark | ||
run: | | ||
cd benchmarker && cargo build --release | ||
benchmarker/target/release/benchmarker zlib_benchmarks.json zlib-rs-bench/metrics-${{matrix.name}}.json > bench_results.json | ||
- name: Upload benchmark results to artifacts | ||
uses: actions/upload-artifact@v4 | ||
uses: ./.github/actions/benchmarker | ||
with: | ||
name: "benchmark-results-${{matrix.name}}" | ||
path: bench_results.json | ||
- name: Upload benchmark results to bench repo | ||
if: github.event_name == 'push' | ||
run: | | ||
cd zlib-rs-bench | ||
git pull # ensure we have the latest state when another job pushed changes while benchmarking | ||
cat ../bench_results.json >> metrics-${{matrix.name}}.json | ||
git add . | ||
git -c user.name="Perf bot" -c [email protected] commit --message 📈 | ||
# git pull --rebase in case of a race condition with another job | ||
git push origin main || (git -c user.name="Perf bot" -c [email protected] pull --rebase && git push origin main) | ||
deploy-key: "${{ secrets.BENCH_DATA_DEPLOY_KEY }}" | ||
bench-repo: "[email protected]:trifectatechfoundation/zlib-rs-bench.git" | ||
metric-key: "${{ matrix.name }}" | ||
benchmarks: "zlib_benchmarks.json" |