Skip to content
Open
Show file tree
Hide file tree
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
20 changes: 17 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,30 @@ jobs:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Free runner disk before build and tests
shell: bash
run: |
set -euo pipefail
df -h
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/share/boost "$AGENT_TOOLSDIRECTORY" || true
docker system prune -af || true
df -h
- name: Setup rust toolchain, cache and bins
uses: moonrepo/setup-rust@v1
with:
channel: nightly-2026-03-04
cache-base: main
- run: cargo build --all-targets --all-features --verbose
- run: cargo test --no-fail-fast --all-features --verbose --lib --tests --bins -- --nocapture
- name: Setup Noir
uses: noir-lang/noirup@v0.1.2
with:
toolchain: v1.0.0-beta.11
- name: Generate mobile benchmark Noir artifacts
run: bench-mobile/scripts/generate-fixtures.sh
- run: cargo build --all-targets --all-features
- run: cargo test --no-fail-fast --all-features --lib --tests --bins -- --nocapture
env:
RUST_BACKTRACE: 1
- run: cargo test --doc --all-features --verbose
- run: cargo test --doc --all-features

cargo_clippy:
name: Clippy
Expand Down
118 changes: 118 additions & 0 deletions .github/workflows/mobile-bench-pr-command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Mobile Bench PR Command

on:
issue_comment:
types: [created]

permissions:
contents: write
actions: write
pull-requests: write
issues: write

jobs:
resolve:
name: Parse /mobench and resolve context
if: >-
github.event_name == 'issue_comment' &&
github.event.action == 'created' &&
github.event.issue.pull_request &&
startsWith(github.event.comment.body, '/mobench')
runs-on: ubuntu-latest
outputs:
trusted: ${{ steps.trust.outputs.trusted }}
platform: ${{ steps.parse.outputs.platform }}
device_profile: ${{ steps.parse.outputs.device_profile }}
iterations: ${{ steps.parse.outputs.iterations }}
warmup: ${{ steps.parse.outputs.warmup }}
head_sha: ${{ steps.pr.outputs.head_sha }}
pr_number: ${{ github.event.issue.number }}
requested_by: ${{ github.event.comment.user.login }}
steps:
- name: Check trust
id: trust
env:
AUTHOR_ASSOCIATION: ${{ github.event.comment.author_association }}
run: |
if echo "OWNER,MEMBER,COLLABORATOR" | tr ',' '\n' | grep -qx "$AUTHOR_ASSOCIATION"; then
echo "trusted=true" >> "$GITHUB_OUTPUT"
else
echo "::warning::Untrusted author association: $AUTHOR_ASSOCIATION"
echo "trusted=false" >> "$GITHUB_OUTPUT"
fi

- name: Parse command
if: steps.trust.outputs.trusted == 'true'
id: parse
env:
COMMENT_BODY: ${{ github.event.comment.body }}
run: |
set -euo pipefail
line=$(echo "$COMMENT_BODY" | head -1)

extract_val() {
echo "$line" | sed -n "s/.*${1}=\([^ ]*\).*/\1/p"
}

platform=$(extract_val platform)
device_profile=$(extract_val device_profile)
iterations=$(extract_val iterations)
warmup=$(extract_val warmup)

case "${platform:-both}" in
android|ios|both) platform="${platform:-both}" ;;
*) echo "::warning::Invalid platform '${platform}', defaulting to 'both'"; platform="both" ;;
esac

case "${device_profile:-triad}" in
smoke|triad|worst) device_profile="${device_profile:-triad}" ;;
*) echo "::warning::Invalid device_profile '${device_profile}', defaulting to 'triad'"; device_profile="triad" ;;
esac

if ! [[ "${iterations:-2}" =~ ^[0-9]+$ ]]; then
echo "::warning::Invalid iterations '${iterations}', defaulting to '2'"
iterations="2"
else
iterations="${iterations:-2}"
fi

if ! [[ "${warmup:-1}" =~ ^[0-9]+$ ]]; then
echo "::warning::Invalid warmup '${warmup}', defaulting to '1'"
warmup="1"
else
warmup="${warmup:-1}"
fi

echo "platform=${platform}" >> "$GITHUB_OUTPUT"
echo "device_profile=${device_profile}" >> "$GITHUB_OUTPUT"
echo "iterations=${iterations}" >> "$GITHUB_OUTPUT"
echo "warmup=${warmup}" >> "$GITHUB_OUTPUT"

- name: Resolve PR refs
if: steps.trust.outputs.trusted == 'true'
id: pr
env:
GH_TOKEN: ${{ github.token }}
PR_URL: ${{ github.event.issue.pull_request.url }}
run: |
head_sha=$(gh api "$PR_URL" --jq '.head.sha')
echo "head_sha=${head_sha}" >> "$GITHUB_OUTPUT"

browserstack:
name: Run BrowserStack benchmarks
needs: resolve
if: needs.resolve.outputs.trusted == 'true'
uses: ./.github/workflows/mobile-bench-reusable.yml
secrets: inherit
with:
crate_path: ./bench-mobile
functions: '["bench_mobile::bench_passport_complete_age_check_prove","bench_mobile::bench_passport_fragmented_age_check_prove","bench_mobile::bench_oprf_prove"]'
functions_ios: '["bench_mobile::bench_passport_complete_age_check_prove","bench_mobile::bench_passport_fragmented_age_check_prove","bench_mobile::bench_oprf_prove"]'
functions_android: '["bench_mobile::bench_passport_fragmented_age_check_prove","bench_mobile::bench_oprf_prove","bench_mobile::bench_passport_complete_age_check_prove"]'
platform: ${{ needs.resolve.outputs.platform }}
device_profile: ${{ needs.resolve.outputs.device_profile }}
iterations: ${{ needs.resolve.outputs.iterations }}
warmup: ${{ needs.resolve.outputs.warmup }}
pr_number: ${{ needs.resolve.outputs.pr_number }}
requested_by: ${{ needs.resolve.outputs.requested_by }}
head_sha: ${{ needs.resolve.outputs.head_sha }}
Loading
Loading