-
Notifications
You must be signed in to change notification settings - Fork 3
136 lines (116 loc) · 4.58 KB
/
Copy pathandroid-ci.yml
File metadata and controls
136 lines (116 loc) · 4.58 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
name: Android CI
# Builds debug APK + runs unit tests on every push and pull request to
# master. The APK is uploaded as a workflow artifact so you can sideload
# it without tagging a release.
#
# Also runs the cross-validation harness: our Kotlin RoundtripGenerator
# emits a JSON document containing fresh identities, an announce, an
# encrypted LXMF, an LRPROOF, and a full link handshake — produced by
# our actual protocol modules. tools/validate_vectors.py then verifies
# every artifact under upstream Python RNS. If our code regresses
# against RNS this job goes red.
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
# Gradle 8.7 pin: the GHA Linux image (and macos-14) now ships
# Gradle 9.4.1 by default, which removed
# `DefaultArtifactPublicationSet`. The Android Gradle Plugin and
# the KMP iOS-target setup both still reference that class; the
# bootstrap step crashes before it can install our own wrapper.
- name: Set up Gradle 8.7
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '8.7'
- name: Bootstrap Gradle wrapper if missing
run: |
if [ ! -f ./gradlew ]; then
gradle wrapper --gradle-version 8.7 --distribution-type bin
chmod +x ./gradlew
fi
- name: Run shared module tests
run: ./gradlew :shared:testDebugUnitTest
- name: Run androidApp unit tests
run: ./gradlew :androidApp:testDebugUnitTest
- name: Assemble debug APK
run: ./gradlew :androidApp:assembleDebug
- name: Upload debug APK
uses: actions/upload-artifact@v5
with:
name: reticulum-mobile-debug
path: androidApp/build/outputs/apk/debug/*.apk
if-no-files-found: error
retention-days: 30
- name: Upload test reports on failure
if: failure()
uses: actions/upload-artifact@v5
with:
name: test-reports
path: |
shared/build/reports/tests/
androidApp/build/reports/tests/
if-no-files-found: ignore
validate-against-rns:
# Runs in parallel with `build` — neither needs the other's
# outputs (this job generates its own vectors via the same Gradle
# toolchain) and the validate path is much shorter, so dropping
# the gate lets us see protocol regressions ~10 minutes earlier
# than waiting for the full APK assembly.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
- name: Set up Gradle 8.7
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '8.7'
- name: Bootstrap Gradle wrapper if missing
run: |
if [ ! -f ./gradlew ]; then
gradle wrapper --gradle-version 8.7 --distribution-type bin
chmod +x ./gradlew
fi
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install upstream RNS reference
run: |
python -m pip install --upgrade pip
pip install rns msgpack
- name: Generate fresh test vectors via RoundtripGenerator
# `--rerun` forces the test to actually execute. Without it,
# Gradle's test-result cache hits on a clean shared/ module
# and the side-effect file (shared/build/roundtrip-vectors.json)
# is never written — so the next step fails on `test -f`.
# Caught when an unrelated shared/build.gradle.kts change
# (linker fix in dfeef0e) didn't invalidate the cached test.
run: |
./gradlew :shared:testDebugUnitTest --tests "io.github.thatsfguy.reticulum.RoundtripGenerator.generateVectors" --rerun
test -f shared/build/roundtrip-vectors.json && \
echo "vectors written:" && head -c 200 shared/build/roundtrip-vectors.json
- name: Validate vectors against Python RNS
run: python tools/validate_vectors.py shared/build/roundtrip-vectors.json
- name: Upload generated vectors on failure
if: failure()
uses: actions/upload-artifact@v5
with:
name: roundtrip-vectors
path: shared/build/roundtrip-vectors.json
if-no-files-found: ignore