Skip to content

Create android.yml

Create android.yml #3

Workflow file for this run

name: Android CI
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build_debug_apk:
name: Build Debug APK
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set Up JDK 22
uses: actions/setup-java@v4
with:
java-version: '22'
distribution: 'oracle'
cache: gradle
- name: Cache Gradle Dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle
- name: Cache Android Build Outputs
uses: actions/cache@v4
with:
path: app/build
key: ${{ runner.os }}-build-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-build
- name: Set Executable Permission for Gradle Wrapper
run: chmod +x gradlew
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4
- name: Run Code Linting
run: ./gradlew lint
- name: Run Unit Tests
run: ./gradlew test
- name: Build APK (Debug)
id: gradle_build_debug
run: ./gradlew assembleDebug
- name: Upload Debug APK
uses: actions/upload-artifact@v4
with:
name: app-debug
path: app/build/outputs/apk/debug/