Skip to content

Commit 4e873da

Browse files
committed
[red] Bound Android integration runner resources
Signed-off-by: Viwat Vchirawongkwin <viwat.v@chula.ac.th>
1 parent 2e950bb commit 4e873da

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

‎tests/publication/test_ci_contract.py‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,65 @@ def test_android_integration_builds_one_application_bundle(self) -> None:
152152
harness,
153153
)
154154

155+
def test_android_integration_prebuilds_with_bounded_runner_resources(
156+
self,
157+
) -> None:
158+
workflow = (REPO_ROOT / ".github" / "workflows" / "ci.yml").read_text(
159+
encoding="utf-8"
160+
)
161+
android_start = workflow.index(" android-webview:")
162+
build_start = workflow.index("\n build:", android_start)
163+
android = workflow[android_start:build_start]
164+
gradle_properties = (
165+
REPO_ROOT / "app" / "android" / "gradle.properties"
166+
).read_text(encoding="utf-8")
167+
168+
self.assertIn(
169+
"org.gradle.jvmargs=-Xmx3072m "
170+
"-XX:MaxMetaspaceSize=1024m "
171+
"-XX:ReservedCodeCacheSize=256m",
172+
gradle_properties,
173+
)
174+
self.assertIn(
175+
"GRADLE_OPTS: -Dorg.gradle.daemon=false "
176+
"-Dorg.gradle.workers.max=1",
177+
android,
178+
)
179+
self.assertIn("--set 'hw.ramSize=2048'", android)
180+
self.assertIn("--set 'hw.cpu.ncore=1'", android)
181+
self.assertIn("-memory 2048", android)
182+
self.assertIn("-cores 1", android)
183+
184+
prebuild = android.index(
185+
"- name: Prebuild Android integration application"
186+
)
187+
boot = android.index("- name: Boot headless emulator")
188+
integration = android.index(
189+
"- name: Real About + Blockly integration"
190+
)
191+
self.assertLess(prebuild, boot)
192+
self.assertLess(boot, integration)
193+
self.assertIn(
194+
"flutter build apk \\\n"
195+
" --debug \\\n"
196+
" --no-pub \\\n"
197+
" --target integration_test/android_smoke_test.dart",
198+
android,
199+
)
200+
self.assertIn(
201+
'>"$PYBLE_ANDROID_LOG_DIR/flutter-build.log" 2>&1',
202+
android,
203+
)
204+
self.assertIn("./android/gradlew --stop", android)
205+
self.assertIn(
206+
'>"$PYBLE_ANDROID_LOG_DIR/flutter-test.log" 2>&1',
207+
android,
208+
)
209+
self.assertNotIn(
210+
'2>&1 | tee "$PYBLE_ANDROID_LOG_DIR/flutter-test.log"',
211+
android,
212+
)
213+
155214
def test_workflow_has_no_adjacent_duplicate_shell_key(self) -> None:
156215
workflow = (REPO_ROOT / ".github" / "workflows" / "ci.yml").read_text(
157216
encoding="utf-8"

0 commit comments

Comments
 (0)