Skip to content

Commit

Permalink
update ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
machado001 committed Jan 5, 2025
1 parent 1dddbc7 commit 5f36a63
Showing 1 changed file with 30 additions and 35 deletions.
65 changes: 30 additions & 35 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,54 @@
name: Build debug apk
name: Kotlin Android CI Workflow

on:
push:
branches:
- main
branches: [ "master" ]
pull_request:
branches:
- main
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup JDK
uses: actions/setup-java@v2
# Step 2: Set up JDK for Android
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
java-version: '17'

- name: Setup Android SDK
# Step 3: Set up Android SDK
- name: Set up Android SDK
uses: android-actions/setup-android@v2
with:
android-sdk-tools-version: 30.0.5

- name: Make gradlew executable
run: chmod +x ./gradlew

- name: Generate Gradle checksums
run: |
find "." -name "gradle.lockfile" -type f | sort | xargs shasum > gradle-checksums.txt
cat gradle-checksums.txt

- name: Setup gradlew cache
# Step 4: Cache Gradle dependencies
- name: Cache Gradle dependencies
uses: actions/cache@v3
with:
path: ~/.gradle
key: gradle-${{ hashFiles('gradle-checksums.txt') }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ hashFiles('gradle-checksums.txt') }}-
gradle-
- name: Setup local.properties
env:
APIRESTKEY: ${{ secrets.API_ROTATIONS_KEY }}
run: |
sed "s|API_ROTATIONS_KEY|API_ROTATIONS_KEY|g;" local.defaults.properties > local.properties
# Step 5: Grant executable permissions to the gradlew script
- name: Grant execute permission for Gradlew
run: chmod +x ./gradlew

- name: Build APK
# Step 5: Build the project
- name: Build with Gradle
run: ./gradlew assembleDebug

- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: app-debug.apk
path: app/build/outputs/apk/debug/app-debug.apk
# Step 6: Run Lint checks
- name: Run Kotlin Lint
run: ./gradlew lintDebug


- name: Run Instrumented Tests
run: ./gradlew connectedAndroidTest

0 comments on commit 5f36a63

Please sign in to comment.