-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (84 loc) · 2.5 KB
/
Copy pathandroid.yml
File metadata and controls
104 lines (84 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Android Pull Request Check
on:
push:
branches:
- main
- develop
pull_request:
types:
- opened
- synchronize
- reopened
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
JAVA_VERSION: 21
jobs:
android-build:
name: Android Build & Check
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ env.JAVA_VERSION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Grant Gradlew Permission
run: chmod +x gradlew
- name: Create google-services.json
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: |
echo "$GOOGLE_SERVICES_JSON" > app/google-services.json
- name: Run Unit Tests
id: test
continue-on-error: true
run: ./gradlew test
- name: Run Lint
id: lint
continue-on-error: true
run: ./gradlew lint
- name: Assemble Debug APK
id: build
continue-on-error: true
run: ./gradlew assembleDebug
- name: Check Results
if: always()
run: |
echo "Unit Tests: ${{ steps.test.outcome }}"
echo "Lint: ${{ steps.lint.outcome }}"
echo "Build: ${{ steps.build.outcome }}"
if [ "${{ steps.test.outcome }}" != "success" ] || \
[ "${{ steps.lint.outcome }}" != "success" ] || \
[ "${{ steps.build.outcome }}" != "success" ]; then
echo "::error::One or more checks failed — see logs above."
exit 1
fi
- name: Upload Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: analysis-reports
path: |
**/build/reports/lint-results*.xml
**/build/reports/lint-results*.html
if-no-files-found: ignore
- name: Upload Android APK
if: success()
uses: actions/upload-artifact@v4
with:
name: android-apk-debug
path: app/build/outputs/apk/debug/app-debug.apk
if-no-files-found: error
retention-days: 14