Repository navigation
73 lines (62 loc) · 2.12 KB
/
Copy pathbuild-android.yml
File metadata and controls
73 lines (62 loc) · 2.12 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
name: Build Android Java APK
on:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: klencod-java-${{ github.repository }}
cancel-in-progress: true
jobs:
build:
name: Build debug APK
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Java 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Set up Android SDK
uses: android-actions/setup-android@v3
with:
packages: 'platforms;android-34 build-tools;34.0.0'
accept-android-sdk-licenses: true
- name: Build debug APK
shell: bash
run: |
set -o pipefail
LOG="$RUNNER_TEMP/klencod-gradle.log"
if [ -f gradlew ]; then
echo "✅ Using Gradle Wrapper (gradlew)"
chmod +x gradlew || true
./gradlew --no-daemon --build-cache --parallel \
:app:assembleDebug -x lint -x test 2>&1 | tee "$LOG"
else
echo "⚠️ gradlew غير موجود — استخدام gradle من النظام"
echo "ℹ️ هذا شائع في المشاريع المستوردة من الخارج"
gradle --no-daemon --build-cache --parallel \
:app:assembleDebug -x lint -x test 2>&1 | tee "$LOG"
fi
- name: Print compiler diagnostics on failure
if: failure()
shell: bash
run: |
LOG="$RUNNER_TEMP/klencod-gradle.log"
echo "===== Klencod compiler diagnostics ====="
if [[ -f "$LOG" ]]; then
grep -E 'error:|warning:|FAILED|Compilation failed|BUILD FAILED|What went wrong' "$LOG" | tail -n 120 || true
else
echo "Gradle output file was not created."
fi
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: klencod-java-debug-apk
path: app/build/outputs/apk/debug/*.apk
if-no-files-found: error
retention-days: 7