Skip to content

feat: name component procedures by Miden paths carried in WIT @external-id #299

feat: name component procedures by Miden paths carried in WIT @external-id

feat: name component procedures by Miden paths carried in WIT @external-id #299

Workflow file for this run

name: Examples and contracts benchmark
permissions:
contents: read
pull-requests: write
on:
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
RUST_CACHE_KEY: rust-cache-20251212
jobs:
compare:
name: Compare example and contract metrics
runs-on: warp-ubuntu-latest-x64-8x
timeout-minutes: 60
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 0
persist-credentials: false
- uses: ./.github/actions/cleanup-runner
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
with:
shared-key: examples-benchmark
prefix-key: ${{ env.RUST_CACHE_KEY }}
cache-targets: false
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Install midenup
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
curl -fsSL https://github.com/0xMiden/midenup/releases/latest/download/installer.sh \
| bash -s -- --no-init
- name: Test benchmark report formatter
run: python3 -m unittest discover -s .github/scripts -p 'test_compare_example_benchmarks.py'
- name: Build candidate benchmark tools
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target/benchmark-candidate
run: |
cargo make cargo-miden
cargo build --release -p midenc-benchmark-runner --bin example-benchmarks
- name: Build next benchmark tools
# The baseline is benchmarked with its own runner: a VM upgrade in the
# candidate can leave its runner unable to read the package format
# that next's cargo-miden still produces.
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target/benchmark-next
run: |
git fetch --no-tags origin next:refs/remotes/origin/next
git worktree add --detach "${RUNNER_TEMP}/compiler-next" origin/next
pushd "${RUNNER_TEMP}/compiler-next"
cargo make cargo-miden
cargo build --release -p midenc-benchmark-runner --bin example-benchmarks
popd
- name: Install the Miden toolchain for next
id: midenup-next
env:
MIDENUP_HOME: ${{ github.workspace }}/.midenup-next
run: |
set -euo pipefail
pushd "${RUNNER_TEMP}/compiler-next"
if [ ! -f miden-toolchain.toml ]; then
midenup init && midenup install 0.17.0 --profile empty --component core --component protocol && midenup override 0.17.0
else
midenup init && midenup install
fi
sysroot=$(midenup show sysroot)
popd
echo "sysroot=$sysroot" >> "$GITHUB_OUTPUT"
echo "MIDEN_SYSROOT=$sysroot" >> "$GITHUB_ENV"
ls "${sysroot}/lib"
- name: Benchmark next
env:
MIDENUP_HOME: ${{ github.workspace }}/.midenup-next
run: |
target/benchmark-next/release/example-benchmarks \
--workspace-root "${RUNNER_TEMP}/compiler-next" \
--cargo-miden "${RUNNER_TEMP}/compiler-next/bin/cargo-miden" \
--output-dir target/example-benchmarks/baseline \
--build-dir target/example-benchmark-build/baseline
- name: Install the Miden toolchain for candidate
id: midenup-candidate
env:
MIDENUP_HOME: ${{ github.workspace }}/.midenup-candidate
run: |
set -euo pipefail
midenup init && midenup install
sysroot=$(midenup show sysroot)
echo "sysroot=$sysroot" >> "$GITHUB_OUTPUT"
echo "MIDEN_SYSROOT=$sysroot" >> "$GITHUB_ENV"
ls "${sysroot}/lib"
- name: Benchmark candidate
env:
MIDENUP_HOME: ${{ github.workspace }}/.midenup-candidate
run: |
target/benchmark-candidate/release/example-benchmarks \
--workspace-root "$GITHUB_WORKSPACE" \
--cargo-miden bin/cargo-miden \
--output-dir target/example-benchmarks/candidate \
--build-dir target/example-benchmark-build/candidate
- name: Generate comparison report
id: benchmark_report
run: |
python3 .github/scripts/compare_example_benchmarks.py \
target/example-benchmarks/candidate/results.json \
target/example-benchmarks/baseline/results.json \
--output target/example-benchmarks/report.md
- name: Comment on pull request
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository &&
steps.benchmark_report.outputs.has_changes == 'true'
uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5
with:
header: example-benchmarks
path: target/example-benchmarks/report.md
- name: Mark benchmark comment as failed
if: >-
failure() &&
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5
with:
header: example-benchmarks
message: |
## Miden examples benchmark
Benchmark generation failed for `${{ github.event.pull_request.head.sha }}`.
See the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
- name: Upload benchmark results
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: example-benchmark-results
path: target/example-benchmarks/
retention-days: 30
if-no-files-found: warn