mirror of
https://github.com/rosenpass/rosenpass.git
synced 2025-12-12 07:40:30 -08:00
104 lines
3.1 KiB
YAML
104 lines
3.1 KiB
YAML
name: rosenpass-ciphers - primitives - benchmark
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
prim-benchmark:
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
system: ["x86_64-linux", "i686-linux"]
|
|
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# Install nix
|
|
|
|
- name: Install Nix
|
|
uses: cachix/install-nix-action@v27 # A popular action for installing Nix
|
|
with:
|
|
extra_nix_config: |
|
|
experimental-features = nix-command flakes
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# Set up environment
|
|
|
|
- name: 🛠️ Prepare Benchmark Path
|
|
env:
|
|
EVENT_NAME: ${{ github.event_name }}
|
|
BRANCH_NAME: ${{ github.ref_name }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
run: |
|
|
case "$EVENT_NAME" in
|
|
"push")
|
|
echo "BENCH_PATH=branch/$BRANCH_NAME" >> $GITHUB_ENV
|
|
;;
|
|
"pull_request")
|
|
echo "BENCH_PATH=pull/$PR_NUMBER" >> $GITHUB_ENV
|
|
;;
|
|
*)
|
|
echo "don't know benchmark path for event of type $EVENT_NAME, aborting"
|
|
exit 1
|
|
esac
|
|
|
|
# Benchmarks ...
|
|
|
|
- name: 🏃🏻♀️ Benchmarks (using Nix as shell)
|
|
working-directory: ciphers
|
|
run: nix develop ".#devShells.${{ matrix.system }}.benchmarks" --command cargo bench -F bench --bench primitives --verbose -- --output-format bencher | tee ../bench-primitives.txt
|
|
|
|
- name: Extract benchmarks
|
|
uses: cryspen/benchmark-data-extract-transform@v2
|
|
with:
|
|
name: rosenpass-ciphers primitives benchmarks
|
|
tool: "cargo"
|
|
os: ${{ matrix.system }}
|
|
output-file-path: bench-primitives.txt
|
|
data-out-path: bench-primitives-os.json
|
|
|
|
- name: Fix up 'os' label in benchmark data
|
|
run: jq 'map(with_entries(.key |= if . == "os" then "operating system" else . end))' <bench-primitives-os.json >bench-primitives.json
|
|
|
|
- name: Upload benchmarks
|
|
uses: cryspen/benchmark-upload-and-plot-action@v3
|
|
with:
|
|
name: Crypto Primitives Benchmarks
|
|
group-by: "operating system,primitive,algorithm"
|
|
schema: "operating system,primitive,algorithm,implementation,operation,length"
|
|
input-data-path: bench-primitives.json
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
# NOTE: pushes to current repository
|
|
gh-repository: github.com/${{ github.repository }}
|
|
auto-push: true
|
|
fail-on-alert: true
|
|
base-path: benchmarks/
|
|
|
|
ciphers-primitives-bench-status:
|
|
if: ${{ always() }}
|
|
needs: [prim-benchmark]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Successful
|
|
if: ${{ !(contains(needs.*.result, 'failure')) }}
|
|
run: exit 0
|
|
- name: Failing
|
|
if: ${{ (contains(needs.*.result, 'failure')) }}
|
|
run: exit 1
|