Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ ktlint_function_naming_ignore_when_annotated_with = Composable
ktlint_standard_class-naming = disabled
# Auto generated SQL lines can be very long
ktlint_standard_max-line-length = disabled

# For generated code
[**/build/generated/**/*]
ktlint = disabled
47 changes: 47 additions & 0 deletions .github/scripts/connected-android-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

OUTPUT_ROOT="build/ci-connected-android-test-reports"
echo "reports-path=$OUTPUT_ROOT" >>"$GITHUB_OUTPUT"

TEST_FAILED=0

set_orientation() {
# portrait: 0, landscape: 1
local rotation=$1
adb shell settings put system accelerometer_rotation 0
adb shell settings put system user_rotation "$rotation"
}

archive_reports() {
local stage=$1
local target_dir="$OUTPUT_ROOT/$stage"

echo "=== Archiving $stage test reports ==="
mkdir -p "$target_dir/app" "$target_dir/shared"

cp -r app/build/reports/androidTests/connected/* "$target_dir/app/" 2>/dev/null || true
cp -r shared/build/reports/androidTests/connected/* "$target_dir/shared/" 2>/dev/null || true
}

echo "=== Starting Portrait Tests ==="
set_orientation 0
if ! ./gradlew connectedDebugAndroidTest --stacktrace; then
echo "❌ Portrait tests failed!"
TEST_FAILED=1
fi
archive_reports "portrait"

echo "=== Starting Landscape Tests ==="
set_orientation 1
if ! ./gradlew connectedDebugAndroidTest --stacktrace; then
echo "❌ Landscape tests failed!"
TEST_FAILED=1
fi
archive_reports "landscape"

if [ $TEST_FAILED -ne 0 ]; then
echo "❌ One or more test stages failed."
exit 1
fi

echo "✅ All UI tests passed."
5 changes: 3 additions & 2 deletions .github/workflows/build_unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ permissions:
contents: write
discussions: write

env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4096M -Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.caching=true"

jobs:
build:
runs-on: ubuntu-latest
env:
GRADLE_OPTS: -Xmx6g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8

steps:
- name: Check out repository
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4096M -Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.caching=true"

jobs:
general:
name: General Checks
Expand Down Expand Up @@ -50,5 +53,4 @@ jobs:
with:
name: check-results
path: |
**/build/reports/tests/
**/build/reports/lint-results-*.html
**/build/reports/
32 changes: 8 additions & 24 deletions .github/workflows/connected-android-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4096M -Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.caching=true"

jobs:
test:
name: Run Connected Android Tests (unstableDebug)
name: Run Connected Android Tests
runs-on: ubuntu-latest
env:
GRADLE_OPTS: -Xmx6g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8
strategy:
fail-fast: false
matrix:
Expand All @@ -42,7 +43,7 @@ jobs:

# Avoid building the application when AVD is running, so Gradle can use more RAM
- name: Build Application
run: ./gradlew assembleUnstableDebug assembleUnstableDebugAndroidTest --stacktrace
run: ./gradlew assembleDebugAndroidTest --stacktrace

# android-emulator-runner configurations start here
# See also https://github.com/ReactiveCircus/android-emulator-runner#usage--examples
Expand All @@ -53,36 +54,19 @@ jobs:
sudo udevadm trigger --name-match=kvm

- name: Run UI Tests
id: ui_tests
uses: reactivecircus/android-emulator-runner@e89f39f1abbbd05b1113a29cf4db69e7540cae5a # v2.37.0
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
emulator-options: -no-metrics -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
disable-animations: true
script: |
# Disable auto-rotation and lock device to landscape
adb shell settings put system accelerometer_rotation 0
# Lock device to portrait
adb shell settings put system user_rotation 0

./gradlew connectedUnstableDebugAndroidTest --stacktrace

mkdir -p app/build/reports/portrait-tests
cp -r app/build/reports/androidTests/connected/* app/build/reports/portrait-tests/ || true

# Lock device to landscape
adb shell settings put system user_rotation 1

./gradlew connectedUnstableDebugAndroidTest --stacktrace

mkdir -p app/build/reports/landscape-tests
cp -r app/build/reports/androidTests/connected/* app/build/reports/landscape-tests/ || true
script: .github/scripts/connected-android-test.sh

- name: Upload Test Results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() }} # run this step even if previous step failed
with:
name: test-results-api${{ matrix.api-level }}-${{ matrix.target }}
path: |
**/build/reports/
path: ${{ steps.ui_tests.outputs.reports-path }}
6 changes: 4 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ android {
}

dependencies {
implementation(project(":shared"))
implementation(project(":core"))

// android & androidx
coreLibraryDesugaring(libs.desugarJdkLibs)

Expand Down Expand Up @@ -233,8 +236,7 @@ dependencies {
androidTestImplementation(androidx.test.espresso.core)
androidTestImplementation(androidx.test.espresso.contrib)
androidTestImplementation(androidx.compose.ui.test.junit4)
androidTestImplementation(project(":shared"))

debugImplementation(androidx.compose.ui.test.manifest)

implementation(project(":core"))
}
Loading
Loading