Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ jobs:
with:
channel: nightly-2026-03-04
cache-base: main
- name: Setup Noir
uses: noir-lang/noirup@v0.1.2
with:
toolchain: v1.0.0-beta.19
- name: Generate mobile benchmark Noir artifacts
env:
MOBENCH_CI_PREPARE: "1"
run: bench-mobile/scripts/generate-fixtures.sh
- name: Build
run: cargo build --all-targets --all-features --verbose
- name: Run tests
Expand Down
166 changes: 166 additions & 0 deletions .github/workflows/mobile-bench-pr-command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
name: Mobile Bench PR Command

on:
issue_comment:
types: [created]

permissions:
contents: read
actions: read
checks: write
pull-requests: 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
permissions:
contents: read
pull-requests: read
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: |
set -euo pipefail
head_sha=$(gh api "$PR_URL" --jq '.head.sha')
[[ "$head_sha" =~ ^[0-9a-f]{40}$ ]] || { echo "::error::Expected a full PR head SHA"; exit 1; }
echo "head_sha=$head_sha" >> "$GITHUB_OUTPUT"

resolve_devices:
needs: resolve
if: needs.resolve.outputs.trusted == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
ios_devices: ${{ steps.resolve.outputs.ios_devices }}
android_devices: ${{ steps.resolve.outputs.android_devices }}
steps:
- id: resolve
shell: bash
env:
DEVICE_PROFILE: ${{ needs.resolve.outputs.device_profile }}
run: |
set -euo pipefail
case "$DEVICE_PROFILE" in
smoke|worst)
ios_devices='[{"device":"iPhone SE 2022","os_version":"15"}]'
android_devices='[{"device":"Samsung Galaxy M32","os_version":"11.0"}]'
;;
triad)
ios_devices='[{"device":"iPhone SE 2022","os_version":"15"},{"device":"iPhone 14","os_version":"16"},{"device":"iPhone 16 Pro Max","os_version":"18"}]'
android_devices='[{"device":"Samsung Galaxy S24","os_version":"14.0"},{"device":"Google Pixel 7","os_version":"13.0"},{"device":"Samsung Galaxy M32","os_version":"11.0"}]'
;;
*) echo "::error::Unsupported device profile: $DEVICE_PROFILE"; exit 1 ;;
esac
echo "ios_devices=$ios_devices" >> "$GITHUB_OUTPUT"
echo "android_devices=$android_devices" >> "$GITHUB_OUTPUT"

browserstack:
name: Run BrowserStack benchmarks
needs: [resolve, resolve_devices]
if: needs.resolve.outputs.trusted == 'true'
permissions:
actions: read
checks: write
contents: read
pull-requests: write
uses: worldcoin/mobile-bench-rs/.github/workflows/reusable-bench.yml@8a2dfbb2ba941aa6a6582bf49dae482cc87779df
secrets:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
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"]'
prepare_script: bench-mobile/scripts/generate-fixtures.sh
platform: ${{ needs.resolve.outputs.platform }}
ios_devices: ${{ needs.resolve_devices.outputs.ios_devices }}
android_devices: ${{ needs.resolve_devices.outputs.android_devices }}
iterations: ${{ needs.resolve.outputs.iterations }}
warmup: ${{ needs.resolve.outputs.warmup }}
mobench_version: "0.1.47"
max_completion_timeout_secs: 7200
rust_toolchain: nightly-2026-03-04
ffi_backend: native-c-abi
pr_number: ${{ needs.resolve.outputs.pr_number }}
requested_by: ${{ needs.resolve.outputs.requested_by }}
head_sha: ${{ needs.resolve.outputs.head_sha }}
127 changes: 127 additions & 0 deletions .github/workflows/mobile-bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Mobile Benchmarks

on:
workflow_dispatch:
inputs:
functions_ios:
description: "Optional iOS-specific benchmark functions"
required: false
type: string
default: '["bench_mobile::bench_passport_complete_age_check_prove","bench_mobile::bench_passport_fragmented_age_check_prove","bench_mobile::bench_oprf_prove"]'
functions_android:
description: "Optional Android-specific benchmark functions"
required: false
type: string
default: '["bench_mobile::bench_passport_complete_age_check_prove","bench_mobile::bench_passport_fragmented_age_check_prove","bench_mobile::bench_oprf_prove"]'
platform:
description: "android | ios | both"
required: false
type: choice
default: both
options: [android, ios, both]
device_profile:
description: "Device profile to run"
required: false
type: choice
default: triad
options: [smoke, triad, worst]
device_profile_ios:
description: "Optional iOS-specific device profile"
required: false
type: string
default: ""
device_profile_android:
description: "Optional Android-specific device profile"
required: false
type: string
default: ""
iterations:
description: "Number of benchmark iterations"
required: false
type: string
default: "2"
warmup:
description: "Number of warmup iterations"
required: false
type: string
default: "1"
pr_number:
description: "PR number for reporting"
required: true
type: string
head_sha:
description: "Exact commit SHA to benchmark"
required: true
type: string

permissions:
contents: read
actions: read
checks: write
pull-requests: write

concurrency:
group: mobench-${{ inputs.pr_number }}
cancel-in-progress: false

jobs:
resolve_devices:
name: Resolve device profiles
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
ios_devices: ${{ steps.resolve.outputs.ios_devices }}
android_devices: ${{ steps.resolve.outputs.android_devices }}
steps:
- id: resolve
shell: bash
env:
IOS_PROFILE: ${{ inputs.device_profile_ios != '' && inputs.device_profile_ios || inputs.device_profile }}
ANDROID_PROFILE: ${{ inputs.device_profile_android != '' && inputs.device_profile_android || inputs.device_profile }}
run: |
set -euo pipefail
case "$IOS_PROFILE" in
smoke|worst) ios_devices='[{"device":"iPhone SE 2022","os_version":"15"}]' ;;
triad) ios_devices='[{"device":"iPhone SE 2022","os_version":"15"},{"device":"iPhone 14","os_version":"16"},{"device":"iPhone 16 Pro Max","os_version":"18"}]' ;;
*) echo "::error::Unsupported iOS device profile: $IOS_PROFILE"; exit 1 ;;
esac
case "$ANDROID_PROFILE" in
smoke|worst) android_devices='[{"device":"Samsung Galaxy M32","os_version":"11.0"}]' ;;
triad) android_devices='[{"device":"Samsung Galaxy S24","os_version":"14.0"},{"device":"Google Pixel 7","os_version":"13.0"},{"device":"Samsung Galaxy M32","os_version":"11.0"}]' ;;
*) echo "::error::Unsupported Android device profile: $ANDROID_PROFILE"; exit 1 ;;
esac
echo "ios_devices=$ios_devices" >> "$GITHUB_OUTPUT"
echo "android_devices=$android_devices" >> "$GITHUB_OUTPUT"

browserstack:
name: BrowserStack benchmarks
needs: resolve_devices
permissions:
actions: read
checks: write
contents: read
pull-requests: write
uses: worldcoin/mobile-bench-rs/.github/workflows/reusable-bench.yml@8a2dfbb2ba941aa6a6582bf49dae482cc87779df
secrets:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
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: ${{ inputs.functions_ios }}
functions_android: ${{ inputs.functions_android }}
prepare_script: bench-mobile/scripts/generate-fixtures.sh
platform: ${{ inputs.platform }}
ios_devices: ${{ needs.resolve_devices.outputs.ios_devices }}
android_devices: ${{ needs.resolve_devices.outputs.android_devices }}
iterations: ${{ inputs.iterations }}
warmup: ${{ inputs.warmup }}
mobench_version: "0.1.47"
max_completion_timeout_secs: 7200
rust_toolchain: nightly-2026-03-04
ffi_backend: native-c-abi
pr_number: ${{ inputs.pr_number }}
allow_non_pr: false
head_sha: ${{ inputs.head_sha }}
requested_by: ${{ github.actor }}
53 changes: 53 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading