Docs / CI
CI integration
One command runs your Beryl tests from any pipeline, streams progress into the job log, and exits 0 when no counted test failed. A quarantined test's failure is reported without failing the run. Nothing to install: the browsers run in Beryl's cloud.
Open your project's Schedules and CI page in the web app and find its CI section. Create a CI token there (it is shown once, so store it in your CI provider's secrets as BERYL_CI_TOKEN), then save a workflow with the environment and groups you want. Each saved workflow gets a ready script with the ids already filled in, which you copy straight into your pipeline.
A CI token (beryl_ci_...) is scoped to one project. It can upload app builds, trigger, follow and cancel runs, read a run's report, artifacts and failure explanations, list tests, and create tests from a prompt or a document (start, follow, retry, clone and cancel jobs), putting them in groups. It can't read secrets or test account passwords, or change settings, accounts or existing tests, so it is safe to hand to a pipeline. Revoking it in Schedules and CI cuts off every pipeline using it at once. The CLI reads it from either BERYL_TOKEN or BERYL_API_KEY.
GitHub Action and Expo EAS
On GitHub Actions, the Beryl action does it in one step: it uploads the build (when you pass one), triggers the run, follows it in the job log, and fails the job when the run fails. It needs only the CI token:
- name: Build the APK
working-directory: android
run: ./gradlew assembleRelease
- name: Beryl tests
id: beryl
uses: beryl-so/beryl-action@v1
with:
token: ${{ secrets.BERYL_CI_TOKEN }}
workspace: <workspace-id>
project: <project-id>
env: <environment-id>
build: android/app/build/outputs/apk/release/app-release.apk
group: Smoke
- run: echo "Beryl run: ${{ steps.beryl.outputs.run-url }}"
if: always()token: the project CI token, from a secret (required)workspace: the workspace id Schedules and CI shows (required)project: the project id Schedules and CI shows (required)build: an.apkor.aab, an iOS simulator.appfolder, or its.zipor EAS.tar.gz. Omit it for a web project, or to run the newest build already uploadedenv: the environment to upload to and run againstgroup: run only these groups, one per line (a name may contain a comma), or comma-separated on a single line. Omit to run every active testtimeout: minutes to wait before failing the job
Its outputs are run-id and run-url, for a later step such as a pull request comment.
On Expo EAS Workflows, add a job after your build jobs. EAS's own eas/download_build step fetches each build (it unpacks the iOS simulator .tar.gz to the .app), so there is nothing else to script. Store the CI token as a secret EAS environment variable named BERYL_CI_TOKEN in the environment the job names. The iOS profile needs "ios": { "simulator": true }:
name: Beryl tests
on:
push:
branches: [main]
jobs:
build_android:
type: build
params:
platform: android
profile: preview
build_ios:
type: build
params:
platform: ios
profile: simulator
beryl:
needs: [build_android, build_ios]
environment: production
env:
BERYL_TOKEN: ${{ env.BERYL_CI_TOKEN }}
BERYL_SCOPE: --workspace <workspace-id> --project <project-id> --env <environment-id>
steps:
- uses: eas/download_build
id: android
with:
build_id: ${{ needs.build_android.outputs.build_id }}
- uses: eas/download_build
id: ios
with:
build_id: ${{ needs.build_ios.outputs.build_id }}
extensions: [app]
- run: npx --yes @beryl-so/cli@latest config files upload "${{ steps.android.outputs.artifact_path }}" $BERYL_SCOPE
- run: npx --yes @beryl-so/cli@latest config files upload "${{ steps.ios.outputs.artifact_path }}" $BERYL_SCOPE
- run: npx --yes @beryl-so/cli@latest runs trigger $BERYL_SCOPE --watchThe last step exits non-zero when the run fails, which fails the workflow. The CLI needs Node 20.19 or newer, which images for Expo SDK 52 and older lack: set defaults.tools.node in the workflow, or pick a newer image. For any other CI, use the script below.
The script
This is what Schedules and CI generates. It runs anywhere a shell can run Node 20+, so write it by hand if you would rather not use the app:
BERYL_TOKEN=$BERYL_CI_TOKEN npx --yes @beryl-so/cli@latest runs trigger \
--workspace <workspace-id> \
--project <project-id> \
--env <environment-id> \
--group "Smoke" \
--watch--env: which environment to run against (required)--watch: follow progress and exit non-zero on failure. Without it the command prints the run id and returns immediately--timeout: with--watch, stop waiting after this many minutes and exit 1; the run keeps going in Beryl. No limit by default--group: run only these groups, repeatable. Omit to run every active test--url-override: run against a preview deploy instead of the environment's URL--header: sendKEY=VALUEon every navigation, to get past a protected preview such asx-vercel-protection-bypass--fail-fast: exit at the first failing test instead of waiting for the rest
The step exits with:
0no counted test failed (quarantined failures are reported, not counted)1a test failed, or the wait timed out2usage error3auth error4plan limit reached: run minutes or AI credits used up, or the active-test limit hit. Nothing ran or was created, so it never counts as a pass
Examples
GitHub Actions (any other CI is the same one-liner):
- name: Beryl tests
env:
BERYL_TOKEN: ${{ secrets.BERYL_CI_TOKEN }}
run: |
npx --yes @beryl-so/cli@latest runs trigger \
--workspace <workspace-id> --project <project-id> \
--env <environment-id> --watchA protected preview deploy, stopping at the first failure:
npx --yes @beryl-so/cli@latest runs trigger \
--workspace <workspace-id> --project <project-id> --env <environment-id> \
--url-override https://preview-123.example.com \
--header x-vercel-protection-bypass=$VERCEL_BYPASS \
--watch --timeout 30 --fail-fastEach test prints a line as it settles. On GitHub Actions every failing test also becomes a workflow annotation, and the job summary gets a results table with a link to the run.
Create tests from CI
The same CI token can ask Beryl's cloud agent for new tests, from a prompt, a document such as a PRD, or both. Start the job, then check on it with the job id it prints:
BERYL_TOKEN=$BERYL_CI_TOKEN npx --yes @beryl-so/cli@latest jobs create "Cover the brief" \
--file ./prd.md --group smoke --ci \
--workspace <workspace-id> --project <project-id>
BERYL_TOKEN=$BERYL_CI_TOKEN npx --yes @beryl-so/cli@latest jobs get <job-id> \
--workspace <workspace-id> --project <project-id>A CI job never pauses for input. It signs in as the environment's default test account, and any test behind a login it can't pass is skipped, with the reason shown in beryl jobs get. New tests join the groups --group names (repeatable; each group must already exist), so a later runs trigger --group smoke runs them. Without --group they get no groups.
Upload the build, then run
For an Android or iOS app, upload the build the pipeline just made, then trigger the run. A run installs the newest ready build for its environment, so the run tests what you just built. The upload waits until the build is ready (an .aab is converted first), so don't pass --no-wait here.
The CI token uploads the build too, so one secret covers the whole pipeline.
On GitHub Actions or Expo EAS Workflows, the Beryl action and EAS job do this in one step. By hand, on GitHub Actions, building a universal APK:
- name: Build the APK
working-directory: android
run: ./gradlew assembleRelease
- name: Upload the build to Beryl
env:
BERYL_TOKEN: ${{ secrets.BERYL_CI_TOKEN }}
run: |
npx --yes @beryl-so/cli@latest config files upload \
android/app/build/outputs/apk/release/app-release.apk \
--workspace <workspace-id> --project <project-id> --env <environment-id>
- name: Beryl tests
env:
BERYL_TOKEN: ${{ secrets.BERYL_CI_TOKEN }}
run: |
npx --yes @beryl-so/cli@latest runs trigger \
--workspace <workspace-id> --project <project-id> \
--env <environment-id> --watchExpo EAS by hand, building on the runner with --local. The Android profile needs "buildType": "apk" (or upload the .aab it builds by default), and the iOS profile needs "ios": { "simulator": true }, and its .tar.gz uploads as is:
eas build --platform android --profile preview --local --output app.apk
eas build --platform ios --profile simulator --local --output app.tar.gz
BERYL_TOKEN=$BERYL_CI_TOKEN npx --yes @beryl-so/cli@latest config files upload app.apk \
--workspace <workspace-id> --project <project-id> --env <environment-id>
BERYL_TOKEN=$BERYL_CI_TOKEN npx --yes @beryl-so/cli@latest config files upload app.tar.gz \
--kind ios_build \
--workspace <workspace-id> --project <project-id> --env <environment-id>
BERYL_TOKEN=$BERYL_CI_TOKEN npx --yes @beryl-so/cli@latest runs trigger \
--workspace <workspace-id> --project <project-id> --env <environment-id> --watchA build that already sits in EAS, Firebase App Distribution or a bucket uploads from its link with --url, so the runner never downloads it. Beryl fetches it, checks it like an uploaded file, and the command waits until it is ready. With an EAS cloud build:
BUILD_URL=$(eas build --platform android --profile preview --non-interactive --json \
| jq -r '.[0].artifacts.buildUrl')
BERYL_TOKEN=$BERYL_CI_TOKEN npx --yes @beryl-so/cli@latest config files upload \
--url "$BUILD_URL" \
--workspace <workspace-id> --project <project-id> --env <environment-id>What each platform accepts and what an upload refusal means are in Mobile apps and builds.
After the run
The run lands in the project's history labeled CI. A connected Slack channel gets every finished CI run; the completion email stays quiet unless a new regression appeared. The same CI token reads the report (failures grouped by cause) and pulls the screenshots and video back into the pipeline, to post on the pull request. beryl runs cancel <run-id> stops a run a newer push replaced:
BERYL_TOKEN=$BERYL_CI_TOKEN npx --yes @beryl-so/cli@latest runs report <run-id> \
--workspace <workspace-id> --project <project-id>
BERYL_TOKEN=$BERYL_CI_TOKEN npx --yes @beryl-so/cli@latest runs download <run-id> \
--workspace <workspace-id> --project <project-id> --dir ./beryl-run