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
163 changes: 163 additions & 0 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
name: Android CI

on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main" ]

jobs:
# ---------------------------------------------------------------
# 🧪 Job 1: Run Unit Tests (JVM tests under src/test/java)
# ---------------------------------------------------------------
unit-tests:
name: 🧪 Unit Tests
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: gradle

# ⚙️ Make gradlew executable
- name: Grant execute permission to gradlew
run: chmod +x CineLayr/gradlew

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

with:
cache-read-only: false

# 🧩 Run all unit tests in all modules
- name: Run all unit tests (Debug + Release)
working-directory: CineLayr
run: |
./gradlew clean testDebugUnitTest testReleaseUnitTest --stacktrace

# 📂 Aggregate all unit test reports
- name: Collect all unit test reports
working-directory: CineLayr
run: |
# Create central folder
mkdir -p CineLayr/UnitTestArtifacts/HTML
mkdir -p CineLayr/UnitTestArtifacts/XML

# Copy all HTML reports from all modules
find CineLayr -path "*/build/reports/tests/*" -type d -exec cp -r {}/* CineLayr/UnitTestArtifacts/HTML/ \;

# Copy all XML results from all modules
find CineLayr -path "*/build/test-results/*" -type d -exec cp -r {}/* CineLayr/UnitTestArtifacts/XML/ \;

# 📦 Upload aggregated reports
- name: Upload all unit test reports
uses: actions/upload-artifact@v4
with:
name: unit-test-reports
path: CineLayr/UnitTestArtifacts/

# ---------------------------------------------------------------
# 📱 Job 2: Run Android Instrumented (UI) Tests (src/androidTest/java)
# ---------------------------------------------------------------
# android-ui-tests:
# name: 📱 Android Instrumented Tests
# runs-on: ubuntu-latest
# timeout-minutes: 60
# needs: unit-tests
#
# steps:
# - name: Checkout sources
# uses: actions/checkout@v4
#
# - name: Set up JDK 17
# uses: actions/setup-java@v4
# with:
# distribution: temurin
# java-version: 17
# cache: gradle
#
# - name: Grant execute permission to gradlew
# run: chmod +x CineLayr/gradlew
#
# - name: Set up Android SDK
# uses: android-actions/setup-android@v3
#
# - name: Set Android environment variables
# run: |
# echo "ANDROID_AVD_HOME=$HOME/.android/avd" >> $GITHUB_ENV
# echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> $GITHUB_ENV
# echo "PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$PATH" >> $GITHUB_PATH
#
# - name: Create local.properties
# working-directory: CineLayr
# run: |
# echo "sdk.dir=/github/home/Android/Sdk" >> local.properties
# echo "TMDB_API_KEY=${{ secrets.TMDB_API_KEY }}" >> local.properties
# echo "RELEASE_STORE_FILE=keystore/release-keystore.jks" >> local.properties
# echo "RELEASE_STORE_PASSWORD=${{ secrets.RELEASE_STORE_PASSWORD }}" >> local.properties
# echo "RELEASE_KEY_ALIAS=${{ secrets.RELEASE_KEY_ALIAS }}" >> local.properties
# echo "RELEASE_KEY_PASSWORD=${{ secrets.RELEASE_KEY_PASSWORD }}" >> local.properties
#
# - name: Install system image & create AVD
# run: |
# sudo apt-get install openjdk-8-jdk -y
# export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
# export PATH=$JAVA_HOME/bin:$PATH
# sdkmanager --list | grep "system-images;android-34;google_apis;x86_64" || sdkmanager "system-images;android-34;google_apis;x86_64"
# AVD_NAME="test"
# mkdir -p $HOME/.android/avd
# if [ ! -f "$HOME/.android/avd/${AVD_NAME}.avd/config.ini" ]; then
# echo "Creating AVD $AVD_NAME..."
# echo "no" | avdmanager create avd -n $AVD_NAME -k "system-images;android-34;google_apis;x86_64" --device "pixel" --force
# else
# echo "AVD $AVD_NAME already exists, reusing."
# fi
#
# - name: Switch back to JDK 17
# uses: actions/setup-java@v4
# with:
# distribution: temurin
# java-version: 17
# cache: gradle
#
# - name: Start emulator and wait for boot
# run: |
# nohup emulator -avd test -no-window -noaudio -gpu swiftshader_indirect -no-boot-anim &
# adb wait-for-device
# retries=0
# boot_completed=""
# while [ -z "$boot_completed" ] && [ $retries -lt 30 ]; do
# sleep 20
# boot_completed=$(adb shell getprop sys.boot_completed 2>/dev/null | tr -d '\r')
# echo "Boot check $retries/30 -> $boot_completed"
# retries=$((retries + 1))
# done
# if [ -z "$boot_completed" ]; then
# echo "❌ Emulator failed to start in time."
# exit 1
# fi
# adb shell input keyevent 82
#
# - name: Run instrumented (androidTest) tests
# working-directory: CineLayr
# run: ./gradlew :app:connectedDebugAndroidTest :app:connectedReleaseAndroidTest --stacktrace
#
# - name: Upload androidTest HTML report
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: android-ui-test-report
# path: CineLayr/app/build/reports/androidTests/connected/
#
# - name: Upload androidTest XML results
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: android-ui-test-xml
# path: CineLayr/app/build/outputs/androidTest-results/connected/
154 changes: 154 additions & 0 deletions CineLayr/.github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Android CI

on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main" ]

jobs:
# ---------------------------------------------------------------
# 🧪 Job 1: Run Unit Tests (JVM tests under src/test/java)
# ---------------------------------------------------------------
unit-tests:
name: 🧪 Unit Tests
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: gradle

# ⚙️ Make gradlew executable
- name: Grant execute permission to gradlew
run: chmod +x CineLayr/gradlew

- name: Gradle cache
uses: gradle/gradle-build-action@v3
with:
cache-read-only: false

- name: Run unit tests
working-directory: CineLayr
run: |
./gradlew clean :app:testDebugUnitTest :app:testReleaseUnitTest --stacktrace

- name: Upload unit test HTML report
if: always()
uses: actions/upload-artifact@v4
with:
name: unit-test-report
path: CineLayr/app/build/reports/tests/testDebugUnitTest/

- name: Upload unit test XML results
if: always()
uses: actions/upload-artifact@v4
with:
name: unit-test-xml
path: CineLayr/app/build/test-results/testDebugUnitTest/

# ---------------------------------------------------------------
# 📱 Job 2: Run Android Instrumented (UI) Tests (src/androidTest/java)
# ---------------------------------------------------------------
# android-ui-tests:
# name: 📱 Android Instrumented Tests
# runs-on: ubuntu-latest
# timeout-minutes: 60
# needs: unit-tests
#
# steps:
# - name: Checkout sources
# uses: actions/checkout@v4
#
# - name: Set up JDK 17
# uses: actions/setup-java@v4
# with:
# distribution: temurin
# java-version: 17
# cache: gradle
#
# - name: Grant execute permission to gradlew
# run: chmod +x CineLayr/gradlew
#
# - name: Set up Android SDK
# uses: android-actions/setup-android@v3
#
# - name: Set Android environment variables
# run: |
# echo "ANDROID_AVD_HOME=$HOME/.android/avd" >> $GITHUB_ENV
# echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> $GITHUB_ENV
# echo "PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$PATH" >> $GITHUB_PATH
#
# - name: Create local.properties
# working-directory: CineLayr
# run: |
# echo "sdk.dir=/github/home/Android/Sdk" >> local.properties
# echo "TMDB_API_KEY=${{ secrets.TMDB_API_KEY }}" >> local.properties
# echo "RELEASE_STORE_FILE=keystore/release-keystore.jks" >> local.properties
# echo "RELEASE_STORE_PASSWORD=${{ secrets.RELEASE_STORE_PASSWORD }}" >> local.properties
# echo "RELEASE_KEY_ALIAS=${{ secrets.RELEASE_KEY_ALIAS }}" >> local.properties
# echo "RELEASE_KEY_PASSWORD=${{ secrets.RELEASE_KEY_PASSWORD }}" >> local.properties
#
# - name: Install system image & create AVD
# run: |
# sudo apt-get install openjdk-8-jdk -y
# export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
# export PATH=$JAVA_HOME/bin:$PATH
# sdkmanager --list | grep "system-images;android-34;google_apis;x86_64" || sdkmanager "system-images;android-34;google_apis;x86_64"
# AVD_NAME="test"
# mkdir -p $HOME/.android/avd
# if [ ! -f "$HOME/.android/avd/${AVD_NAME}.avd/config.ini" ]; then
# echo "Creating AVD $AVD_NAME..."
# echo "no" | avdmanager create avd -n $AVD_NAME -k "system-images;android-34;google_apis;x86_64" --device "pixel" --force
# else
# echo "AVD $AVD_NAME already exists, reusing."
# fi
#
# - name: Switch back to JDK 17
# uses: actions/setup-java@v4
# with:
# distribution: temurin
# java-version: 17
# cache: gradle
#
# - name: Start emulator and wait for boot
# run: |
# nohup emulator -avd test -no-window -noaudio -gpu swiftshader_indirect -no-boot-anim &
# adb wait-for-device
# retries=0
# boot_completed=""
# while [ -z "$boot_completed" ] && [ $retries -lt 30 ]; do
# sleep 20
# boot_completed=$(adb shell getprop sys.boot_completed 2>/dev/null | tr -d '\r')
# echo "Boot check $retries/30 -> $boot_completed"
# retries=$((retries + 1))
# done
# if [ -z "$boot_completed" ]; then
# echo "❌ Emulator failed to start in time."
# exit 1
# fi
# adb shell input keyevent 82
#
# - name: Run instrumented (androidTest) tests
# working-directory: CineLayr
# run: ./gradlew :app:connectedDebugAndroidTest :app:connectedReleaseAndroidTest --stacktrace
#
# - name: Upload androidTest HTML report
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: android-ui-test-report
# path: CineLayr/app/build/reports/androidTests/connected/
#
# - name: Upload androidTest XML results
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: android-ui-test-xml
# path: CineLayr/app/build/outputs/androidTest-results/connected/
47 changes: 47 additions & 0 deletions CineLayr/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
*.iml

.gradle
/.gradle/
.gradle/

.idea
/.idea/
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.idea/

.kotlin
/.kotlin/
.kotlin/

/build
/app/build
/benchmark/build
/core/database/build
/core/designsystem/build
/core/navigation/build
/core/network/build
/data/build
/domain/build
/feature-trending/build
/feature-details/build
/feature-watchlist/build

keystore/
*.jks
*.keystore
keystore/release-keystore.jks

local.properties
/captures
/local.properties
local.properties/

.DS_Store
/captures
.externalNativeBuild
.cxx
1 change: 1 addition & 0 deletions CineLayr/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Empty file.
Loading
Loading