Skip to content

Enhancement/20-ocr

Enhancement/20-ocr #31

Workflow file for this run

name: Android CI
on:
push:
branches:
- main
- develop
pull_request:
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
security-events: write
steps:
# 1. Checkout code
- name: Checkout code
uses: actions/checkout@v4
# 1.1 Setup google-services.json
- name: Setup google-services.json
run: |
echo "Setting up google-services.json..."
echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > ./app/google-services.json
if [ -f ./app/google-services.json ]; then
echo "google-services.json successfully created at ./app/google-services.json"
else
echo "Error: google-services.json not found at ./app/google-services.json"
exit 1
fi
shell: bash
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
# 2. Set up JDK
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
# 3. Cache Gradle
- name: Cache Gradle
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-
# 4. Add Local Properties
- name: Add Local Properties
env:
BASE_URL: ${{ secrets.BASE_URL }}
run: |
echo base.url=\"$BASE_URL\" >> ./local.properties
# 5. Run Static Analysis (Detekt)
- name: Run Detekt
run: ./gradlew detekt
# 6. Check Code Formatting (Spotless)
- name: Run Spotless Check
run: ./gradlew spotlessCheck
# # 6. Run Unit Tests
# - name: Run Unit Tests
# run: ./gradlew test
# 7. Run Lint
- name: Run Lint
run: ./gradlew lint
# 8. Build APK
- name: Build APK
run: ./gradlew assembleDebug
# 9. Upload Artifacts
- name: Upload APKs
uses: actions/upload-artifact@v4
with:
name: APKs
path: '**/build/outputs/apk/**/*.apk'
- name: Upload Test Results
uses: actions/upload-artifact@v4
with:
name: Test Results
path: '**/build/test-results/**/*.xml'
# 10. Notify in Slack
- name: Notify in Slack
uses: 8398a7/action-slack@v3
with:
status: ${{job.status}}
fields: repo,message,commit,author,action,eventName,ref,workflow
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()