Repository navigation
185 lines (159 loc) · 6.07 KB
/
Copy pathandroid.yml
File metadata and controls
185 lines (159 loc) · 6.07 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: android
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Build, test, lint APK
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
# Defensive: the exec bit can get lost when the file is re-added from
# a Windows environment (core.filemode=false). This guarantees the
# wrapper is runnable even if the stored file mode regresses.
- name: Ensure gradlew is executable
run: chmod +x gradlew
- name: Set up JDK 17 (Temurin)
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: temurin
java-version: '17'
- name: Set up Android SDK (pinned cmdline tools + packages)
uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4
with:
packages: >-
platforms;android-35
build-tools;35.0.0
platform-tools
ndk;26.3.11579264
cmake;3.22.1
- name: Verify tool pins
run: |
echo "NDK installed versions:" "$ANDROID_HOME/ndk"
echo "CMake installed versions:" "$ANDROID_HOME/cmake"
- name: Gradle wrapper validation
uses: gradle/actions/wrapper-validation@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
- name: Cache Gradle
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: gradle-${{ runner.os }}-
- name: Unit tests
run: |
set -o pipefail
./gradlew --no-daemon test 2>&1 | tee gradle-test.log
- name: Lint debug
run: |
set -o pipefail
./gradlew --no-daemon :app:lintDebug 2>&1 | tee gradle-lint.log
- name: Build debug APK (includes native NDK/CMake build)
run: |
set -o pipefail
./gradlew --no-daemon assembleDebug 2>&1 | tee gradle-build.log
# Logs require auth to download via API; the step summary is public.
# This makes the failure reason visible in the run page itself.
- name: Publish Gradle diagnostics to step summary (on failure)
if: failure()
run: |
emit() { echo "::error title=Gradle::$1"; }
{
echo "## CI diagnostics"
for name in test lint build; do
f="gradle-${name}.log"
[ -f "$f" ] || continue
echo ""
echo "### gradle-${name}.log: Kotlin/compile errors"
echo ""
echo '```'
grep -E "^e: |^w: |error:|FAILURE|What went wrong" "$f" | head -n 80
echo '```'
echo ""
echo "### gradle-${name}.log: tail (last 120 lines)"
echo ""
echo '```'
tail -n 120 "$f"
echo '```'
done
} >> "$GITHUB_STEP_SUMMARY"
for name in test lint build; do
f="gradle-${name}.log"
[ -f "$f" ] || continue
grep -E "^e: |error:|What went wrong|FAILURE:| Gradle task" "$f" | head -n 40 | cut -c1-300 | while IFS= read -r line; do emit "$line"; done
tail -n 25 "$f" | cut -c1-300 | while IFS= read -r line; do emit "tail: $line"; done
done
- name: Debug APK artifact, even when later steps fail
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: OpenEar-debug-apk
path: app/build/outputs/apk/debug/*.apk
if-no-files-found: error
- name: Test reports artifact (on any test failure)
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-reports
path: |
gradle-*.log
app/build/reports/tests/
app/build/test-results/
whisper/build/reports/tests/
if-no-files-found: ignore
- name: Gradle summary
if: always()
run: |
echo "Exits success when unit tests, debug + release builds, and lint complete."
release:
name: Release APK (tags only)
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
timeout-minutes: 90
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Ensure gradlew is executable
run: chmod +x gradlew
- name: Set up JDK 17 (Temurin)
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: temurin
java-version: '17'
- name: Set up Android SDK (pinned)
uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4
with:
packages: >-
platforms;android-35
build-tools;35.0.0
platform-tools
ndk;26.3.11579264
cmake;3.22.1
- name: Cache Gradle
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: gradle-${{ runner.os }}-
- name: Build debug APK (unsigned release is not sideload-ready)
run: ./gradlew --no-daemon assembleDebug
- name: Checksums
run: |
sha256sum app/build/outputs/apk/debug/*.apk | tee OpenEar-apk-sha256.txt
- name: Publish GitHub Release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
with:
files: |
app/build/outputs/apk/debug/*.apk
OpenEar-apk-sha256.txt