Repository navigation
117 lines (111 loc) · 4.88 KB
/
Copy pathandroid.yml
File metadata and controls
117 lines (111 loc) · 4.88 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
name: Android build
on:
push:
branches: [dev, main]
pull_request:
branches: [dev, main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: android-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
branch-policy:
runs-on: ubuntu-24.04
steps:
- name: Only accept dev into main
if: github.event_name == 'pull_request' && github.base_ref == 'main'
env:
HEAD_BRANCH: ${{ github.head_ref }}
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
BASE_REPO: ${{ github.repository }}
run: test "$HEAD_BRANCH" = dev && test "$HEAD_REPO" = "$BASE_REPO"
build:
runs-on: ubuntu-24.04
timeout-minutes: 40
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
fetch-depth: 0
- name: Select validation scope
id: scope
env:
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: python3 scripts/ci_scope.py
- name: Inspect committed source
run: |
python3 -m unittest discover -s scripts -p 'test_*.py'
python3 scripts/check-source.py
- if: steps.scope.outputs.android == 'true'
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
with:
distribution: temurin
java-version: '17'
- if: steps.scope.outputs.android == 'true'
uses: gradle/actions/setup-gradle@4c125117fe7c5aed11272ec4213f602f012f89f2 # v5
with:
cache-disabled: true
- name: Install Android SDK packages
if: steps.scope.outputs.android == 'true'
uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407 # v3
with:
packages: platform-tools
log-accepted-android-sdk-licenses: false
- name: Install required SDK versions
if: steps.scope.outputs.android == 'true'
run: sdkmanager "platforms;android-35" "build-tools;35.0.0" "ndk;28.2.13676358"
- if: steps.scope.outputs.android == 'true'
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with:
go-version: '1.26.3'
cache: false
- name: Build, unit tests and lint
if: steps.scope.outputs.android == 'true'
run: ./gradlew :app:assembleDebug :app:assembleDebugAndroidTest :app:assembleRelease testDebugUnitTest :app:lintDebug :app:lintRelease --no-daemon --no-build-cache --max-workers=2 --stacktrace
- name: Verify supported ABIs and prepare APK
if: steps.scope.outputs.android == 'true'
run: |
python3 scripts/check-apk.py app/build/outputs/apk/debug/app-debug.apk
python3 scripts/check-apk.py app/build/outputs/apk/release/app-release-unsigned.apk
mkdir -p dist
cp app/build/outputs/apk/debug/app-debug.apk "dist/mbrain-debug-universal-${GITHUB_SHA:0:7}.apk"
cd dist
sha256sum *.apk > SHA256SUMS.txt
- name: Upload universal debug APK
if: steps.scope.outputs.android == 'true'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: mbrain-debug-universal-${{ github.run_number }}-${{ github.run_attempt }}
path: dist/
if-no-files-found: error
retention-days: 14
compression-level: 0
- name: Upload test and lint reports
if: ${{ !cancelled() && steps.scope.outputs.android == 'true' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: android-reports-${{ github.run_number }}-${{ github.run_attempt }}
path: |
**/build/reports/tests/
**/build/test-results/testDebugUnitTest/
app/build/reports/lint-results-*.*
if-no-files-found: ignore
retention-days: 14
- name: Build summary
if: steps.scope.outputs.android == 'true'
run: |
cat >> "$GITHUB_STEP_SUMMARY" <<'EOF'
## MBrain testing build
Download the universal APK from this run's **Artifacts** section.
- Android 9.0+; arm64-v8a, armeabi-v7a, x86_64 and x86 native libraries checked.
- SHA256SUMS.txt is included in the APK artifact.
- This is a debug-signed testing build, not an official release.
- Ephemeral CI signing keys may differ between runs; updating an existing installation may fail with a signature mismatch. Uninstalling clears app data.
- ABI packaging checks do not replace testing on each architecture.
EOF
- name: Documentation check summary
if: steps.scope.outputs.android == 'false'
run: echo 'Documentation-only PR; source checks passed. Android build skipped.' >> "$GITHUB_STEP_SUMMARY"