feat: Add ci workflow for the repo #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Kotlin Android CI Workflow | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Set up JDK for Android | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
# Step 3: Set up Android SDK | |
- name: Set up Android SDK | |
uses: android-actions/setup-android@v2 | |
with: | |
api-level: 35 | |
build-tools: '35.0.0' | |
# Step 4: Cache Gradle dependencies | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
gradle- | |
# Step 5: Build the project | |
- name: Build with Gradle | |
run: ./gradlew assembleDebug | |
# Step 6: Run Lint checks | |
- name: Run Kotlin Lint | |
run: ./gradlew lintDebug | |
# Step 7: Run unit tests | |
- name: Run Unit Tests | |
run: ./gradlew testDebugUnitTest | |
# Step 8: Run Instrumentation Tests (Optional) | |
# Uncomment this step if you have instrumentation tests configured | |
# - name: Run Instrumented Tests | |
# run: ./gradlew connectedAndroidTest |