Skip to content

Commit

Permalink
Fix Cirrus configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
stevesoltys committed Sep 12, 2023
1 parent d0a9e8f commit 593651b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 26 deletions.
37 changes: 13 additions & 24 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
instrumented_task_test:
name: Run Android emulator tests
timeout_in: 30m
only_if: $CIRRUS_BRANCH == "main" || $CIRRUS_PR != ""
skip: "!changesInclude('.cirrus.yml', '*.gradle', '*.gradle.kts', '**/*.gradle', '**/*.gradle.kts', '*.properties', '**/*.properties', '**/*.kt', '**/*.xml')"
env:
JAVA_TOOL_OPTIONS: -Xmx6g
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dkotlin.incremental=false -Dkotlin.compiler.execution.strategy=in-process
container:
image: reactivecircus/android-emulator-33:latest
kvm: true
cpu: 8
memory: 24G
container:
image: ghcr.io/cirruslabs/android-sdk:33
kvm: true
cpu: 8
memory: 24G

create_device_script:
./gradlew :app:provisionEmulator
start_emulator_background_script:
$ANDROID_HOME/emulator/emulator -avd "seedvault" -no-window -gpu swiftshader_indirect -writable-system -no-snapshot -noaudio -no-boot-anim -camera-back none
check_android_task:
provision_emulator_script:
ANDROID_SDK_HOME=/opt/android-sdk-linux ./app/development/scripts/provision_emulator.sh seedvault "system-images;android-33;google_apis;x86_64"
assemble_instrumented_tests_script:
./gradlew assembleDebugAndroidTest
wait_for_emulator_script:
wait_for_avd_script:
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 3; done; input keyevent 82'
disable_animations_script: |
adb shell settings put global window_animation_scale 0.0
adb shell settings put global transition_animation_scale 0.0
adb shell settings put global animator_duration_scale 0.0
run_instrumented_tests_script:
./gradlew connectedAndroidTest
install_app_script:
wget --output-document etar.apk https://f-droid.org/repo/ws.xsoh.etar_35.apk
adb install etar.apk
check_script: ./gradlew connectedAndroidTest
3 changes: 1 addition & 2 deletions app/development/scripts/provision_emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ if $ANDROID_SDK_HOME/cmdline-tools/latest/bin/avdmanager list avd | grep -q "$EM
echo "AVD already exists. Skipping creation."
else
echo "Creating AVD..."
echo 'no' | $ANDROID_SDK_HOME/cmdline-tools/latest/bin/avdmanager create avd -n "$EMULATOR_NAME" -k "$SYSTEM_IMAGE"
echo 'no' | $ANDROID_SDK_HOME/cmdline-tools/latest/bin/avdmanager create avd --force -n "$EMULATOR_NAME" -k "$SYSTEM_IMAGE"
sleep 1
fi

echo "Starting emulator..."
$SCRIPT_DIR/start_emulator.sh "$EMULATOR_NAME"
sleep 3

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ android.enableJetifier=false
kotlin.code.style=official
android.nonTransitiveRClass=false
android.enableR8.fullMode=false
org.gradle.caching=true
15 changes: 15 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,18 @@ include ':app'
include ':contactsbackup'
include ':storage:lib'
include ':storage:demo'

ext.isCiServer = System.getenv().containsKey("CIRRUS_CI")
ext.isMasterBranch = System.getenv()["CIRRUS_BRANCH"] == "master"
ext.buildCacheHost = System.getenv().getOrDefault("CIRRUS_HTTP_CACHE_HOST", "localhost:12321")

buildCache {
local {
enabled = !isCiServer
}
remote(HttpBuildCache) {
url = "http://${buildCacheHost}/"
enabled = isCiServer
push = isMasterBranch
}
}

0 comments on commit 593651b

Please sign in to comment.