Skip to content

[SDK-497] Add unknown user criteria fetch callbacks #51

[SDK-497] Add unknown user criteria fetch callbacks

[SDK-497] Add unknown user criteria fetch callbacks #51

name: Integration Tests (BCIT)
# SDK-115: single workflow that owns all BCIT integration-test runs (PR, push to
# master, manual dispatch, nightly cron).
on:
push:
branches: [ master ]
paths:
- 'integration-tests/**'
- 'iterableapi/**'
- 'iterableapi-ui/**'
- '.github/workflows/integration-tests-bcit.yml'
- '.github/scripts/run-e2e.sh'
pull_request:
# No `branches:` filter — `branches:` matches the PR's *target*, not its head, so
# restricting to [master] silently skips stacked PRs that target SDK-115-* (or any
# other long-lived integration branch). Path filters below still gate which PRs
# actually trigger the workflow.
paths:
- 'integration-tests/**'
- 'iterableapi/**'
- 'iterableapi-ui/**'
- '.github/workflows/integration-tests-bcit.yml'
- '.github/scripts/run-e2e.sh'
workflow_dispatch: # Allow manual triggering
schedule:
# Nightly smoke test at 02:00 UTC against the BCIT Iterable project. Catches
# backend-side drift (rotated keys, edited campaign templates, expired test
# users) that a code-only PR-triggered run would miss.
- cron: '0 2 * * *'
# SDK-115: serialise across all branches/refs. The whole suite drives a single
# shared BCIT user (ITERABLE_TEST_USER_EMAIL) for tens of minutes — two PRs, or
# a PR overlapping the nightly cron, race on backend state (in-app inbox,
# embedded placements, device tokens). Global scope queues one behind another.
# `cancel-in-progress: false` so a nightly already running isn't killed mid-suite
# when a PR opens.
concurrency:
group: bcit-integration-${{ github.workflow }}
cancel-in-progress: false
jobs:
integration-tests-bcit:
name: Integration Tests (BCIT)
# SDK-170: macOS Intel runners (2 cores / 3GB AVD on HVF) starved system_server during
# cold boot and produced cascading ANRs (systemui / nexuslauncher / gms / phone …),
# leaving a system dialog on top of MainActivity so UiAutomator could not find the
# in-app button. Ubuntu runners with KVM acceleration and 4 vCPU / 16GB stop the storm.
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [34] # MVP testing on most relevant API level only
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Enable KVM device permissions
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
| sudo tee /etc/udev/rules.d/99-kvm.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Android SDK
uses: android-actions/setup-android@v2
- name: Create local.properties
run: |
echo "sdk.dir=$ANDROID_SDK_ROOT" > local.properties
echo "ndk.dir=$ANDROID_SDK_ROOT/ndk" >> local.properties
- name: Accept Android SDK Licenses
run: |
echo "Accepting Android SDK licenses..."
yes | sdkmanager --licenses || true
echo "SDK licenses accepted"
- name: Setup Google Services Configuration
run: |
echo "Setting up Google Services configuration for CI..."
# Ensure the google-services.json file exists for the build
if [ ! -f "integration-tests/google-services.json" ]; then
echo "Creating google-services.json from template..."
cp integration-tests/google-services.json.template integration-tests/google-services.json
fi
echo "Google Services configuration ready"
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# SDK-170-followup: KVM-runner Gradle parallelism races on
# `integration-tests/build/intermediates/merged_res_blame_folder/`; do not
# reintroduce a background `assemble*` step alongside the test invocation.
- name: Run BCIT Integration Tests (KVM / x86_64)
uses: ReactiveCircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: google_apis
arch: x86_64
profile: pixel_6
cores: 4
ram-size: 4096M
heap-size: 576M
force-avd-creation: true
disable-animations: true
emulator-boot-timeout: 900
emulator-options: -no-window -no-snapshot -gpu swiftshader_indirect -no-boot-anim -camera-back none -partition-size 6000
pre-emulator-launch-script: |
# Clean + start adb after platform-tools exist (avoids tcp:5037 noise)
adb kill-server >/dev/null 2>&1 || true
adb start-server
# The android-emulator-runner action runs each line of an inline `script:`
# in a fresh `/bin/sh -c`, so cross-line variables and bash functions don't
# survive. Externalise the whole thing to a single bash file that runs in
# one process — see .github/scripts/run-e2e.sh for the actual logic.
script: bash "$GITHUB_WORKSPACE/.github/scripts/run-e2e.sh"
env:
ITERABLE_API_KEY: ${{ secrets.BCIT_ITERABLE_API_KEY }}
ITERABLE_SERVER_API_KEY: ${{ secrets.BCIT_ITERABLE_SERVER_API_KEY }}
ITERABLE_TEST_USER_EMAIL: ${{ secrets.BCIT_ITERABLE_TEST_USER_EMAIL }}
# SDK-170: do NOT upload integration-tests/build/outputs/ — that path contains the
# built APKs which embed BuildConfig.ITERABLE_API_KEY and BuildConfig.ITERABLE_SERVER_API_KEY
# as compile-time string constants. On a public repo, anyone who can download the
# artifact could `strings`/`apktool` the APK and recover both keys.
- name: Upload BCIT integration-test diagnostics
if: always()
uses: actions/upload-artifact@v4
with:
name: bcit-integration-diagnostics-api-${{ matrix.api-level }}
path: |
integration-tests/build/diagnostics/
integration-tests/build/reports/
if-no-files-found: warn
retention-days: 7