-
Notifications
You must be signed in to change notification settings - Fork 38
150 lines (136 loc) · 6.26 KB
/
Copy pathintegration-tests-bcit.yml
File metadata and controls
150 lines (136 loc) · 6.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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