Skip to content

refactor: Enqueue Geofence Work with Unique Name and Replace Policy. #37

refactor: Enqueue Geofence Work with Unique Name and Replace Policy.

refactor: Enqueue Geofence Work with Unique Name and Replace Policy. #37

name: Kotlin Android CI Workflow
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
env:
MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }}
steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Grant execute permission for Gradlew
- name: Grant execute permission for Gradlew
run: chmod +x ./gradlew
# Step 3: Create dummy local.defaults.properties
- name: Create dummy local.defaults.properties
run: echo "MAPS_API_KEY=dummy_value" > local.defaults.properties
# Step 4: Create google-services.json
- name: Create Google Services JSON File
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $GOOGLE_SERVICES_JSON | base64 -di > app/google-services.json
# Step 5: Set up JDK 17
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
# Step 6: Set up Android SDK
- name: Set up Android SDK
uses: android-actions/setup-android@v2
# Step 7: Cache Gradle dependencies
- name: Cache Gradle and Android SDK
uses: actions/cache@v3
with:
path: ~/.android
key: android-sdk-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
android-sdk-${{ runner.os }}-
# Step 8: Build with Gradle
- name: Build with Gradle
run: ./gradlew assembleDebug
# Step 9: Run Kotlin Lint
- name: Run Kotlin Lint
run: ./gradlew lintDebug
# Step 10: Run Unit Tests
- name: Run Unit Tests
run: ./gradlew testDebugUnitTest
# Step 11: Run Instrumentation Tests (Optional)
# Uncomment this step if you have instrumentation tests configured
# - name: Run Instrumented Tests
# run: ./gradlew connectedAndroidTest