Skip to content

Task 8.2a: createReport JS API, native methods stubbed #94

Task 8.2a: createReport JS API, native methods stubbed

Task 8.2a: createReport JS API, native methods stubbed #94

Workflow file for this run

name: ci
on:
push:
branches: [main]
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
# Never a real token. The example reads credentials at runtime; CI only
# builds, so a well-formed placeholder is enough and nothing secret is
# needed to prove the native plumbing compiles and links.
BUGSEE_TOKEN_IOS: 00000000-0000-4000-8000-000000000000
BUGSEE_TOKEN_ANDROID: 00000000-0000-4000-8000-000000000000
jobs:
js:
name: lint, typecheck, unit, mutation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22.18'
- run: corepack enable
- run: yarn install --immutable
- run: yarn lint
- run: yarn typecheck
- run: yarn test
# Fails the build under the threshold in stryker.config.json. The point
# is not the number: tests that assert nothing still pass, and this is
# what notices.
- run: yarn mutate
compat:
name: rn compat (${{ matrix.react-native }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
react-native: ['0.81', '0.83', '0.86', '0.87']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22.18'
# Codegen and typecheck against each supported React Native, which is
# the surface that is actually ours. The example app cannot stand in for
# this: its android/ and ios/ projects come from one version's template,
# and swapping the npm dependency does not swap the project.
- run: ./scripts/check-rn-compat.sh ${{ matrix.react-native }}
android:
name: android
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Fails fast, before spending a single minute on setup or a Gradle
# download: native-versions.json can pin a SNAPSHOT built from a
# private clone (Task 3.P1), which only exists in one developer's
# ~/.m2 and which CI has no way to reproduce. Left unchecked this
# surfaces many minutes later as an opaque dependency-resolution
# failure instead of a named reason. This step stays in place after
# Task 3.P3 flips the pin back to a release, where it simply passes.
- name: Refuse a local SNAPSHOT pin
run: |
sdk=$(jq -r '.android.sdk' native-versions.json)
if [[ "$sdk" == *-SNAPSHOT ]]; then
echo "::error title=Local SNAPSHOT pin::native-versions.json pins Android ${sdk}, built from a private clone; CI cannot resolve it. Expected red until Task 3.P3 flips to 7.3.0."
exit 1
fi
- uses: actions/setup-node@v4
with:
node-version: '22.18'
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- run: corepack enable
- run: yarn install --immutable
- run: yarn workspace bugsee-example-bare credentials
# The library's own unit tests, from the root build.
- run: ./gradlew :bugsee-android-bridge:testDebugUnitTest
# The example carries its own wrapper and settings; the root build knows
# nothing about it, so it is built from its own directory. The
# example-only bugsee-e2e-native module (Task 7.6a) is only reachable
# through the example's autolinking, so its JVM tests run here too.
- name: Assemble the example
working-directory: examples/bare/android
run: ./gradlew assembleDebug :bugsee-e2e-native:testDebugUnitTest
ios-unit:
name: ios unit (BugseeRNSupport)
runs-on: macos-15
steps:
- uses: actions/checkout@v4
# The only ObjC tests in the repo, and they used to run nowhere. They
# cover the marshalling helpers and the main-thread hop -- removing the
# hop is otherwise undetectable, since the device e2e passes without it.
#
# xcodebuild, not `swift test`: SwiftPM builds this for macOS and the
# xcframework has no macOS slice.
# Selected by UDID rather than by name+OS: `OS=latest` resolves to the
# newest runtime installed, which need not have the named device, and
# xcodebuild then fails listing every destination it will not use.
#
# Filtered to an iPhone on an iOS runtime. A GitHub Xcode image installs
# watchOS, tvOS and visionOS runtimes too, and simctl returns them in the
# same map -- locally 65 of the 100 entries are non-iOS, the first at
# index 22. Taking [0] of the flattened list trusts JSON key ordering to
# put iOS first, which nothing guarantees.
- name: Test the Support package
working-directory: packages/react-native/ios/Support
run: |
UDID="$(xcrun simctl list devices available -j | jq -r '[.devices | to_entries[] | select(.key | test("SimRuntime\\.iOS-")) | .value[] | select(.name | startswith("iPhone"))][0].udid')"
test -n "$UDID" && test "$UDID" != null
xcodebuild test -scheme BugseeRNSupport -destination "id=$UDID"
ios-e2e:
name: ios e2e (simulator)
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22.18'
- run: corepack enable
- run: yarn install --immutable
# Unlike every other job, this one needs a REAL app token: with the
# placeholder the SDK accepts launch(), fails to bring capture up, and
# settles into Stopped -- so "reaches Launched" can never hold. Verified
# by reproducing it locally with the placeholder.
- name: Credentials
id: creds
env:
# iOS only: this job builds no Android app, and write-credentials
# accepts either token alone. Aliasing the Android variable to the
# iOS secret wrote the iOS token into android/bugsee.properties
# under the Android name -- inert here, and a trap if this job's
# scope ever grows.
BUGSEE_TOKEN_IOS: ${{ secrets.BUGSEE_TOKEN_IOS }}
BUGSEE_ENDPOINT: ${{ secrets.BUGSEE_ENDPOINT }}
run: |
if [ -z "${BUGSEE_TOKEN_IOS}" ]; then
echo "::warning title=iOS e2e skipped::BUGSEE_TOKEN_IOS is not set in repository secrets, so the only check that proves the SDK RUNS is not running. Every other job passes with launch() gutted."
echo "have=false" >> "$GITHUB_OUTPUT"
else
yarn workspace bugsee-example-bare credentials
echo "have=true" >> "$GITHUB_OUTPUT"
fi
- name: Boot a simulator
id: sim
run: |
UDID="$(xcrun simctl list devices available -j | jq -r '[.devices | to_entries[] | select(.key | test("SimRuntime\\.iOS-")) | .value[] | select(.name | startswith("iPhone"))][0].udid')"
test -n "$UDID" && test "$UDID" != null
# Erased before boot, deliberately. A runner's simulator is not
# guaranteed clean: a previous run saw the SDK fail its keychain
# write with errSecMissingEntitlement (-34018) and stall at
# Launching, on the same device that reached Launched in 2.6s the
# run before. Locally, leftover simulator state made two runs of
# this same test disagree. Erase, then wait for a full boot.
xcrun simctl shutdown "$UDID" || true
xcrun simctl erase "$UDID"
xcrun simctl boot "$UDID"
xcrun simctl bootstatus "$UDID" -b
echo "udid=$UDID" >> "$GITHUB_OUTPUT"
- name: Placeholder credentials for the build
if: steps.creds.outputs.have != 'true'
env:
BUGSEE_TOKEN_IOS: 00000000-0000-4000-8000-000000000000
BUGSEE_TOKEN_ANDROID: 00000000-0000-4000-8000-000000000000
run: yarn workspace bugsee-example-bare credentials
- name: Install pods
working-directory: examples/bare/ios
run: pod install
- name: Build for the simulator
working-directory: examples/bare/ios
run: |
xcodebuild \
-workspace BareExample.xcworkspace \
-scheme BareExample \
-destination "id=${{ steps.sim.outputs.udid }}" \
-configuration Debug \
-derivedDataPath build \
CODE_SIGNING_ALLOWED=NO \
build
- name: Install the app
run: |
xcrun simctl install "${{ steps.sim.outputs.udid }}" \
examples/bare/ios/build/Build/Products/Debug-iphonesimulator/BareExample.app
- name: Start Metro
working-directory: examples/bare
run: |
yarn start &
for _ in $(seq 1 60); do
curl -sf http://localhost:8081/status && break
sleep 1
done
# The only job that proves the SDK RUNS. Every other job passes with
# `launch` gutted to `resolve(@YES)`: the build succeeds and the
# framework is still embedded and linked. Verified by doing exactly
# that -- the embed assertion stayed green and this went red.
#
# A simulator is not a substitute for the handset: it cannot catch a
# code-signing or embedding fault on real hardware. It is the only iOS
# target CI has, and it runs the real SDK.
#
# launch.test.ts only, by ruling. A bare `yarn e2e` also picks up the
# report-handler and wrapper-channel suites, whose timing windows (a
# 25 s deadline asserted to within a second) a shared runner cannot
# promise, and which retain bundles -- on iOS beta3 those carry
# credentials, and CI has no policy for keeping them.
- name: Reach Status.Launched
if: steps.creds.outputs.have == 'true'
working-directory: examples/bare
env:
E2E_PLATFORM: ios
E2E_IOS_TARGET: simulator
IOS_SIMULATOR_ID: ${{ steps.sim.outputs.udid }}
run: yarn e2e launch.test.ts
ios:
name: ios (${{ matrix.delivery }})
runs-on: macos-15
strategy:
fail-fast: false
matrix:
# Both delivery paths, on the example's own React Native. SPM support
# for apps does not exist before 0.87 anyway — 0.81-0.86 ship only
# scripts/cocoapods/spm.rb, the spm_dependency helper the spike
# disproved — so there is no older SPM leg to run.
delivery: [cocoapods, spm]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22.18'
- run: corepack enable
- run: yarn install --immutable
- run: yarn workspace bugsee-example-bare credentials
- name: Install pods
if: matrix.delivery == 'cocoapods'
working-directory: examples/bare/ios
run: pod install
- name: Migrate to SPM
if: matrix.delivery == 'spm'
working-directory: examples/bare
run: npx react-native spm add --deintegrate --yes
- name: Build
working-directory: examples/bare/ios
run: |
xcodebuild \
-workspace BareExample.xcworkspace \
-scheme BareExample \
-destination 'generic/platform=iOS' \
-configuration Debug \
-derivedDataPath build \
CODE_SIGNING_ALLOWED=NO \
build
# The whole point of this job. The spm_dependency variant built cleanly
# and then dyld-crashed on the device, so a green build proves nothing
# on its own — only that the framework is embedded AND linked does.
#
# Through the example's OWN script rather than the root one with an
# explicit path, so CI exercises the invocation a developer actually
# runs. When the two differed, a broken working directory in the local
# path stayed green here for two pushes.
- name: Assert Bugsee.framework is embedded and linked
run: yarn workspace bugsee-example-bare assert:ios-embed