Skip to content

Create Date Filter (#51) #105

Create Date Filter (#51)

Create Date Filter (#51) #105

Workflow file for this run

name: Android CI
on:
push:
branches:
- main
pull_request:
env:
ANDROID_ARCH: x86_64
ANDROID_TARGET: default
API_LEVEL: 34
ANDROID_BUILD_TOOLS_VERSION: 34.0.0
ANDROID_SDK_PACKAGES: system-images;android-34;default;x86_64 platforms;android-34 build-tools;34.0.0 platform-tools emulator
EMULATOR_TIMEOUT: 350
EMULATOR_NAME: nexus
jobs:
buildUnitTest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Cache Gradle dependencies
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-
- name: Build with Gradle
run: |
chmod +x gradlew
./gradlew test
continue-on-error: true
androidTest:
runs-on: macos-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Cache Gradle dependencies
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Add avdmanager and sdkmanager to system PATH
run: |
echo "$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/${{ env.ANDROID_BUILD_TOOLS_VERSION }}" >> $GITHUB_PATH
- name: Install Sdk
id: install-sdk
run: |
if [ -d "$RUNNER_WORKSPACE/android-sdk" ]; then
echo "SDK already installed, skipping installation."
else
yes Y | sdkmanager --licenses
sdkmanager --install ${ANDROID_SDK_PACKAGES}
echo "SDK installation complete."
fi
- name: Build emulator
run: |
echo "no" | avdmanager --verbose create avd --force -n $EMULATOR_NAME --abi "${ANDROID_TARGET}/${ANDROID_ARCH}" -k "system-images;android-${API_LEVEL};${ANDROID_TARGET};${ANDROID_ARCH}"
- name: Launch emulator
run: |
chmod +x ./start_emu_headless.sh
EMULATOR_TIMEOUT=$EMULATOR_TIMEOUT EMULATOR_NAME=$EMULATOR_NAME ./start_emu_headless.sh
- name: Run tests
run: ./gradlew connectedAndroidTest
- name: Stop emulator
run: adb emu kill