App builds from CI
Upload the build your pipeline just made and run the app's tests on it, in the same step.
Android and iOS#
# Android (Gradle)
./gradlew assembleDebug
node testsy-ai.mjs run --project p_your_project --build app/build/outputs/apk/debug/app-debug.apk --junit testsy-ai-junit.xml
# iOS: build for the Simulator, zip the .app
xcodebuild -scheme MyApp -sdk iphonesimulator -configuration Debug -derivedDataPath build
(cd build/Build/Products/Debug-iphonesimulator && zip -qry ../../../../MyApp.app.zip MyApp.app)
node testsy-ai.mjs run --project p_your_project --build MyApp.app.zip
# Upload only (prints the build id), list builds, run a chosen build
node testsy-ai.mjs build upload app-debug.apk --project p_your_project --label "$GITHUB_SHA"
node testsy-ai.mjs builds --project p_your_project
node testsy-ai.mjs run --test t_abc --build ab_123
# Skip work Testsy already has: upload only if this exact file is new; ask before building at all
node testsy-ai.mjs build ensure app-debug.apk --project p_your_project --fingerprint "$NATIVE_FINGERPRINT"
node testsy-ai.mjs build find --project p_your_project --fingerprint "$NATIVE_FINGERPRINT" # exit 0: found (prints its id), 1: build itrun --build uploads the file (or imports it from an https link), waits until it is checked, and runs the project's tests of that app on it. Each app test gets the build of its own app (by package name or bundle id), so one command can carry an Android and an iOS build. A file that is already uploaded (same sha256) is reused instead of uploaded again.
Skip the build your CI already made#
An iOS Simulator build can cost 30–60 minutes of macOS CI. Testsy keeps two identifiers per build so a pipeline can skip work it has already done:
- sha256 of the file, computed when the upload completes.
build ensurehashes the local file and uploads only when that exact file is not there (or, with--fingerprint, when that native build is not there);run --builddoes the same. - A fingerprint you store with the upload (
--fingerprint): a hash of the native inputs, for example@expo/fingerprintfor Expo and React Native, or your own hash of the native project. When the fingerprint has not changed, the native build is the same and need not be rebuilt:build find --fingerprintanswers before the build job runs.
On GitHub, give the action a fingerprint and no build: it only looks up and sets build-needed and build-id, and runs nothing. Build and upload only when needed, then run the tests with the id you have:
jobs:
lookup:
runs-on: ubuntu-latest
outputs:
fp: ${{ steps.fp.outputs.fp }}
needed: ${{ steps.testsy.outputs.build-needed }}
build: ${{ steps.testsy.outputs.build-id }}
steps:
- uses: actions/checkout@v4
- id: fp
run: echo "fp=$(npx @expo/fingerprint . --platform ios | jq -r .hash)" >> "$GITHUB_OUTPUT"
- id: testsy
uses: testsy-ai/testsy-action@v1
with:
api-key: ${{ secrets.TESTSY_AI_API_KEY }}
project: p_myproject
fingerprint: ${{ steps.fp.outputs.fp }}
build:
needs: lookup
if: needs.lookup.outputs.needed == 'true'
runs-on: macos-latest
outputs:
build: ${{ steps.testsy.outputs.build-id }}
steps:
- uses: actions/checkout@v4
- run: |
xcodebuild -scheme MyApp -sdk iphonesimulator -configuration Debug -derivedDataPath build
(cd build/Build/Products/Debug-iphonesimulator && zip -qry ../../../../MyApp.app.zip MyApp.app)
- id: testsy
env:
TESTSY_AI_API_KEY: ${{ secrets.TESTSY_AI_API_KEY }}
run: |
curl -fsSL https://app.testsy.dev/cli/testsy-ai.mjs -o testsy-ai.mjs
node testsy-ai.mjs build upload MyApp.app.zip --project p_myproject --fingerprint "${{ needs.lookup.outputs.fp }}"
test:
needs: [lookup, build]
if: always() && needs.lookup.result == 'success' && needs.build.result != 'failure'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: testsy-ai/testsy-action@v1
with:
api-key: ${{ secrets.TESTSY_AI_API_KEY }}
project: p_myproject
build: ${{ needs.build.outputs.build || needs.lookup.outputs.build }}On GitLab, .testsy-ai-lookup (in the same template) writes TESTSY_AI_BUILD_NEEDED and TESTSY_AI_BUILD_ID as a dotenv artifact; give the build job rules: - if: $TESTSY_AI_BUILD_NEEDED == "true" and pass TESTSY_AI_BUILD: $TESTSY_AI_BUILD_ID to the test job otherwise. With any CI, build find exits 0 when the build exists (printing its id) and 1 when it must be built; --dotenv file writes the same two variables.
Import from a link#
When the build already sits somewhere reachable — an Expo EAS artifact, a Bitrise or Buildkite artifact, an S3 or R2 object, a GitHub Actions artifact — give Testsy the link instead of uploading from the pipeline:
node testsy-ai.mjs run --project p_myproject --build https://expo.dev/artifacts/eas/….apk
node testsy-ai.mjs build import "https://…/MyApp.app.zip?X-Amz-Signature=…" --project p_myproject --header "Authorization: Bearer $STORE_TOKEN"Testsy fetches the file itself (https only, to a public host name, up to 3 redirects, up to the build size limit) and checks it like an upload. Headers given with --header (Authorization or X-… names, at most 5) are sent to the first host only, for a private store; a signed link needs none. The file name comes from the link or its Content-Disposition and must be an .apk or a zipped .app. Over the API or MCP: import_build.
What builds are accepted#
- Android: an
.apkwhose native code includes both arm64-v8a and x86_64 (our emulators are of both kinds): the build command for React Native, Expo, Flutter and Gradle. App Bundles (.aab) cannot be installed. - iOS: a build for the iOS Simulator, the
.appfolder zipped. The command-line tool also takes the.appfolder itself and zips it for you. - Up to 1 GB.
A build our devices cannot run is refused with the reason — written for your stack: an Expo, React Native, Flutter, Capacitor or native project each gets the command that produces an acceptable build — and the command exits 2. Accepted builds carry warnings worth reading: a release build cannot have its WebView contents or console inspected (a debug build gives more detail when a check needs it); a build whose resource names were collapsed by resource optimization leaves screen elements without ids, so checks can only use visible text.
Over the API#
Uploading is three calls: start (returns the part size and count), one call per part with the raw bytes, and complete with every part's etag. A key that can only run tests can upload builds; deleting one needs a key that can also create and edit tests.
The part endpoint also accepts JSON {contentBase64} with Content-Type: application/json. Use the returned partBytes (currently 16 MiB); only the final part may be shorter. After completion, pass the returned build.id as buildId when starting a test, or in buildIds when starting a project. These overrides are optional. Before uploading, find a build by sha256 or fingerprint; start accepts a fingerprint to store.
Signed upload links start an upload and return part and complete links that work without a key for a few hours: a machine that holds no key (an AI agent's shell, a build box) can send the bytes. testsy-ai build upload <file> --upload <link> uses them.
Through MCP#
An AI agent calls find_build to reuse a build that is already there, otherwise create_build_upload, and runs the returned command in its shell: it downloads the command-line tool and uploads the file to the signed links, with no API key involved. Then run_test {testId, buildId} or run_project {projectId, buildIds} selects the build. See the MCP upload flow.