Skip to content
Merged
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
48 changes: 36 additions & 12 deletions .github/actions/expo-app/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@ description: >-
# scripts, so an edit to either rebuilds the app once on every job. The shape
# follows callstack/agent-device's test-app-build-cache. A repack that fails
# falls back to the native build, so a job is never left without an app.
#
# Caches saved from a pull request or a merge queue run are scoped to that
# ref; only a push to main saves one every later run can restore. mobile.yml
# runs this action with `cache-only` on main for that, without a device.

inputs:
platform:
description: ios or android. Names the fingerprint, the cache key, and the .build/<platform> directory.
required: true
build-command:
description: Shell that builds the app into .build/<platform>; runs from the working directory on a cache miss or a failed repack.
required: true
app-glob:
description: Name of the built app directly under .build/<platform>, as a `find -name` pattern (an iOS `*.app` bundle, an Android `.apk`).
required: true
gradle-cache-read-only:
description: Android only. Restores Gradle's user home cache without saving it, for a fork's pull request.
required: false
default: 'false'
cache-only:
description: Builds and saves the app on a miss, and stops there. A hit downloads nothing, and no app-path is set.
required: false
default: 'false'
working-directory:
description: The Expo project.
required: false
Expand All @@ -52,6 +54,11 @@ runs:
HASH="$(pnpm exec fingerprint fingerprint:generate --platform "$PLATFORM" | jq -r '.hash')"
test -n "$HASH"
echo "hash=$HASH" >> "$GITHUB_OUTPUT"
case "$PLATFORM" in
ios) echo "app-glob=*.app" >> "$GITHUB_OUTPUT" ;;
android) echo "app-glob=benchmark.apk" >> "$GITHUB_OUTPUT" ;;
*) echo "::error::unknown platform \"$PLATFORM\"" && exit 1 ;;
esac
# Restore and save are separate steps: an entry is immutable, and a hit
# whose app cannot be repacked is deleted below so the rebuilt app can be
# saved under the same key instead of every later run rebuilding it.
Expand All @@ -61,16 +68,17 @@ runs:
with:
path: ${{ inputs.working-directory }}/.build/${{ inputs.platform }}
key: mobile-benchmark-${{ inputs.platform }}-${{ steps.fingerprint.outputs.hash }}
lookup-only: ${{ inputs.cache-only }}
# A hit is current on the native side only; the embedded JS may be older
# than the checkout. Swap in a bundle built from this source.
- name: Refresh the JS bundle of the cached app
id: repack
if: steps.app-cache.outputs.cache-hit == 'true'
if: steps.app-cache.outputs.cache-hit == 'true' && inputs.cache-only != 'true'
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
PLATFORM: ${{ inputs.platform }}
APP_GLOB: ${{ inputs.app-glob }}
APP_GLOB: ${{ steps.fingerprint.outputs.app-glob }}
CACHE_KEY: mobile-benchmark-${{ inputs.platform }}-${{ steps.fingerprint.outputs.hash }}
GH_TOKEN: ${{ github.token }}
run: |
Expand All @@ -92,11 +100,26 @@ runs:
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
with:
cache-read-only: ${{ inputs.gradle-cache-read-only }}
- name: Build the app
if: steps.app-cache.outputs.cache-hit != 'true' || steps.repack.outputs.result == 'failed'
# `--device generic` builds for the simulator without booting one;
# Release embeds the bundle, so no Metro is needed at run time.
- name: Build the iOS app
if: inputs.platform == 'ios' && (steps.app-cache.outputs.cache-hit != 'true' || steps.repack.outputs.result == 'failed')
shell: bash
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.build-command }}
run: pnpm exec expo run:ios --configuration Release --device generic --no-bundler --output .build/ios
# The Release APK is signed with the debug keystore the template uses;
# repack-app ships the same keystore and signs the refreshed APK with it.
- name: Build the Android app
if: inputs.platform == 'android' && (steps.app-cache.outputs.cache-hit != 'true' || steps.repack.outputs.result == 'failed')
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
set -euo pipefail
pnpm exec expo prebuild --platform android --no-install
printf '\n%s\n' 'org.gradle.jvmargs=-Xmx4g' >> android/gradle.properties
(cd android && ./gradlew :app:assembleRelease)
mkdir -p .build/android
cp android/app/build/outputs/apk/release/app-release.apk .build/android/benchmark.apk
- name: Save the app
if: steps.app-cache.outputs.cache-hit != 'true' || steps.repack.outputs.result == 'failed'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
Expand All @@ -105,11 +128,12 @@ runs:
key: mobile-benchmark-${{ inputs.platform }}-${{ steps.fingerprint.outputs.hash }}
- name: Locate the app
id: app
if: inputs.cache-only != 'true'
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
PLATFORM: ${{ inputs.platform }}
APP_GLOB: ${{ inputs.app-glob }}
APP_GLOB: ${{ steps.fingerprint.outputs.app-glob }}
run: |
set -euo pipefail
APP="$(find ".build/$PLATFORM" -maxdepth 1 -name "$APP_GLOB" | head -1)"
Expand Down
20 changes: 15 additions & 5 deletions .github/filters.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# What a change has to touch before a benchmark suite can see it. Read by
# dorny/paths-filter in the `changes` job of benchmark.yml and mobile.yml,
# which skip their suites when nothing here changed. A skipped job satisfies
# the ruleset's required checks; a workflow-level `paths:` filter would leave
# them pending and block the merge.
# What a change has to touch before a suite can see it. Read by
# dorny/paths-filter in the `changes` job of benchmark.yml, mobile.yml, and
# docs.yml, which skip their suites when nothing here changed. Each workflow's
# `gate` job is the ruleset's required check and passes over a skipped job; a
# workflow-level `paths:` filter would leave the gate pending and block the
# merge.
#
# The suites run the built packages, so a runner change reaches both, an
# engine change one. A package's own tests never reach a benchmark: `dist` is
Expand Down Expand Up @@ -33,3 +34,12 @@ mobile:
- 'apps/mobile-benchmark/**'
- '.github/workflows/mobile.yml'
- '.github/actions/expo-app/**'

docs:
- 'docs/**'
- 'skills/e2e/**'
- 'scripts/check-docs-*.ts'
- 'package.json'
- 'pnpm-lock.yaml'
Comment thread
okwasniewski marked this conversation as resolved.
Resolved
- '.github/filters.yml'
- '.github/workflows/docs.yml'
51 changes: 35 additions & 16 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
name: benchmark

# The web benchmark is where the runner meets deliberately hard surfaces, so
# its suites gate every pull request that can reach them (the `changes` job
# says which). Each suite posts one comment through @e2e-dev/github (hence
# its suites gate every pull request and merge queue entry that can reach them
# (the `changes` job says which). The ruleset requires `benchmark gate` alone.
# Each suite posts one comment through @e2e-dev/github (hence
# pull-requests: write) and edits it on rerun. The mobile benchmark has its
# own workflow, mobile.yml.
#
# A pull request from a fork runs with no secrets and a read-only token, as
# GitHub grants on `pull_request`. The deterministic suite needs neither and
# runs for everyone; its reporter then writes the job summary and says why it
# did not comment. The agentic suite needs the model key, so it runs only for
# branches of this repository, where only people with push access can put it
# to work. Never switch this workflow to `pull_request_target` to get the key
# did not comment. The agentic suite needs the model key, so on a pull request
# it runs only for branches of this repository, where only people with push
# access can put it to work, and not for Dependabot's, whose runs get no
# secrets either. The merge queue runs with this repository's secrets, so it
# runs the agentic suite for every pull request. Never switch this workflow to `pull_request_target` to get the key
# onto fork branches: that hands the secret to untrusted code.
on:
pull_request:
merge_group:
push:
branches: [main]
workflow_dispatch:
Expand All @@ -34,18 +38,17 @@ concurrency:
jobs:
# Skips the suites when the change reaches neither the runner, the engine,
# nor the benchmark app (.github/filters.yml says what does, and why a skip
# rather than a workflow-level `paths:` filter). The gate fails toward
# running: a manual dispatch runs the suites, and so does a run whose
# detection failed.
# rather than a workflow-level `paths:` filter). A manual dispatch runs them.
changes:
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 5
outputs:
web: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.web == 'true' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# A pull request's files come from the API; a push to main is diffed
# against the commit before it, which the action fetches itself.
# A pull request's files come from the API; a merge queue entry is
# diffed against its base, and a push to main against the commit
# before it, which the action fetches itself.
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
if: ${{ github.event_name != 'workflow_dispatch' }}
Expand All @@ -55,7 +58,7 @@ jobs:

web:
needs: changes
if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.web == 'true') }}
if: ${{ needs.changes.outputs.web == 'true' }}
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
steps:
Expand Down Expand Up @@ -101,14 +104,14 @@ jobs:

# The agentic suite runs from the recordings committed under
# apps/web-benchmark/.e2e/cache (AGENTS.md, "Committed recordings") and
# needs the key for a step with none: a fork's pull request has no key, so
# it is skipped rather than failed.
# needs the key for a step with none: a fork's or Dependabot's pull request
# has no key, so it is skipped rather than failed.
web-agent:
needs: changes
if: >-
${{ !cancelled()
&& (needs.changes.result != 'success' || needs.changes.outputs.web == 'true')
&& (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
${{ needs.changes.outputs.web == 'true'
&& (github.event_name != 'pull_request'
|| (github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) }}
Comment thread
okwasniewski marked this conversation as resolved.
Resolved
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
name: web agent
Expand Down Expand Up @@ -154,3 +157,19 @@ jobs:
apps/web-benchmark/.e2e/results
if-no-files-found: warn
retention-days: 7

# The one check the ruleset requires from this workflow. A skipped job
# passes (the change cannot reach it); a failed or cancelled one fails it.
gate:
name: benchmark gate
needs: [changes, web, web-agent]
if: ${{ always() }}
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 5
steps:
- name: Require every job to pass or skip
env:
RESULTS: ${{ toJSON(needs) }}
run: |
failed="$(jq -r '[to_entries[] | select(.value.result != "success" and .value.result != "skipped") | "\(.key) \(.value.result)"] | join(", ")' <<< "$RESULTS")"
[ -z "$failed" ] || { echo "::error::$failed"; exit 1; }
59 changes: 42 additions & 17 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
name: docs

# Mintlify builds and hosts the site from main through its GitHub app, so
# this workflow is only the check, on pull requests and merge queue entries
# that touch the docs (the `changes` job says which); a manual dispatch
# always runs it. The ruleset requires `docs gate` alone.
on:
pull_request:
paths:
- 'docs/**'
- 'skills/e2e/**'
- 'scripts/check-docs-*.ts'
- 'pnpm-lock.yaml'
- '.github/workflows/docs.yml'
push:
branches: [main]
paths:
- 'docs/**'
- 'skills/e2e/**'
- 'scripts/check-docs-*.ts'
- 'pnpm-lock.yaml'
- '.github/workflows/docs.yml'
merge_group:
workflow_dispatch:

permissions:
contents: read
# The `changes` job reads the pull request's files.
pull-requests: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
changes:
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 5
outputs:
docs: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.docs == 'true' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
if: ${{ github.event_name != 'workflow_dispatch' }}
with:
filters: .github/filters.yml
predicate-quantifier: some-with-excludes

build:
needs: changes
if: ${{ needs.changes.outputs.docs == 'true' }}
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 10
steps:
Expand All @@ -36,8 +46,23 @@ jobs:
node-version: 26
cache: pnpm
- run: pnpm install --frozen-lockfile
# Mintlify builds and hosts the site from main through its GitHub app.
# This job is the check: it fails on an invalid page, a broken link, or a
# docs or skill code block that drifted from docs/examples.
# Fails on an invalid page, a broken link, or a docs or skill code
# block that drifted from docs/examples.
- name: Check docs
run: pnpm run docs:check

# The one check the ruleset requires from this workflow. A skipped job
# passes (the change cannot reach it); a failed or cancelled one fails it.
gate:
name: docs gate
needs: [changes, build]
if: ${{ always() }}
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 5
steps:
- name: Require every job to pass or skip
env:
RESULTS: ${{ toJSON(needs) }}
run: |
failed="$(jq -r '[to_entries[] | select(.value.result != "success" and .value.result != "skipped") | "\(.key) \(.value.result)"] | join(", ")' <<< "$RESULTS")"
[ -z "$failed" ] || { echo "::error::$failed"; exit 1; }
Loading
Loading