Skip to content

Commit 7997be0

Browse files
committed
Reproducibility CI
1 parent f7006b1 commit 7997be0

1 file changed

Lines changed: 146 additions & 0 deletions

File tree

.github/workflows/repro.yml

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: Build & Reproducibility Check
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch: {}
9+
10+
env:
11+
APK_KEYSTORE_PASSWORD: ${{ secrets.APK_KEYSTORE_PASSWORD }}
12+
APK_KEY_ALIAS: ${{ secrets.APK_KEY_ALIAS }}
13+
APK_KEY_PASSWORD: ${{ secrets.APK_KEY_PASSWORD }}
14+
15+
jobs:
16+
build:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-22.04, ubuntu-24.04]
21+
runs-on: ${{ matrix.os }}
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Stable env
27+
run: |
28+
echo "TZ=UTC" >> $GITHUB_ENV
29+
echo "LANG=C.UTF-8" >> $GITHUB_ENV
30+
echo "LC_ALL=C.UTF-8" >> $GITHUB_ENV
31+
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
32+
33+
- name: Restore testing keystore
34+
env:
35+
APK_KEYSTORE_B64: ${{ secrets.APK_KEYSTORE_B64 }}
36+
run: |
37+
echo "$APK_KEYSTORE_B64" | base64 -d > keystore.jks
38+
echo "APK_KEYSTORE=$GITHUB_WORKSPACE/keystore.jks" >> $GITHUB_ENV
39+
40+
- name: Set up JDK
41+
uses: actions/setup-java@v4
42+
with:
43+
distribution: temurin
44+
java-version: '17'
45+
cache: gradle
46+
47+
- name: Set up Android SDK
48+
uses: android-actions/setup-android@v3
49+
with:
50+
packages: |
51+
platforms;android-36 build-tools;36.0.0
52+
- name: Install Gradle (official distribution)
53+
env:
54+
GRADLE_VERSION: "8.13"
55+
run: |
56+
curl -L -o gradle-${GRADLE_VERSION}-bin.zip https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip
57+
unzip -q gradle-${GRADLE_VERSION}-bin.zip -d "$HOME/gradle"
58+
echo "$HOME/gradle/gradle-${GRADLE_VERSION}/bin" >> "$GITHUB_PATH"
59+
gradle --version
60+
61+
- name: Build with Gradle
62+
run: gradle --no-daemon assembleDebug assembleRelease
63+
64+
- name: Upload debug APK
65+
if: success()
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: app-debug-${{ matrix.os }}
69+
path: app/build/outputs/apk/debug/app-debug.apk
70+
compression-level: 0
71+
retention-days: 7
72+
73+
- name: Upload release APK
74+
if: success()
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: app-release-${{ matrix.os }}
78+
path: app/build/outputs/apk/release/app-release.apk
79+
compression-level: 0
80+
retention-days: 7
81+
82+
repro-check:
83+
name: Reproducibility
84+
runs-on: ubuntu-24.04
85+
needs: build
86+
steps:
87+
- name: Download APK from ubuntu-22.04
88+
uses: actions/download-artifact@v4
89+
with:
90+
name: app-release-ubuntu-22.04
91+
path: ./artifacts/ubuntu-22.04
92+
93+
- name: Download APK from ubuntu-24.04
94+
uses: actions/download-artifact@v4
95+
with:
96+
name: app-release-ubuntu-24.04
97+
path: ./artifacts/ubuntu-24.04
98+
99+
- name: Install tools (APT only)
100+
run: |
101+
set -euxo pipefail
102+
sudo apt-get update
103+
sudo apt-get install -y \
104+
apksigcopier \
105+
androguard \
106+
apktool \
107+
diffoscope \
108+
libarchive-tools \
109+
default-jre-headless
110+
111+
- name: apksigcopier compare
112+
id: apkcmp
113+
run: |
114+
set -euo pipefail
115+
A=./artifacts/ubuntu-22.04/app-release.apk
116+
B=./artifacts/ubuntu-24.04/app-release.apk
117+
# apksigcopier prints nothing & exits 0 when it sees no relevant differences
118+
apksigcopier compare "$A" "$B" | tee apksigcopier-compare.txt
119+
status=${PIPESTATUS[0]}
120+
if [ "$status" -ne 0 ]; then
121+
echo "❌ apksigcopier compare failed (exit $status)."
122+
exit "$status"
123+
fi
124+
if [ -s apksigcopier-compare.txt ]; then
125+
echo "❌ apksigcopier reports differences."
126+
exit 1
127+
fi
128+
echo "✅ apksigcopier reports no differences."
129+
130+
- name: diffoscope (report only; ignore exit)
131+
continue-on-error: true
132+
run: |
133+
set -euxo pipefail
134+
A=./artifacts/ubuntu-22.04/app-release.apk
135+
B=./artifacts/ubuntu-24.04/app-release.apk
136+
diffoscope "$A" "$B" | tee diffoscope.txt || true
137+
138+
- name: Upload reports
139+
if: always()
140+
uses: actions/upload-artifact@v4
141+
with:
142+
name: reproducibility-reports
143+
path: |
144+
apksigcopier-compare.txt
145+
diffoscope.txt
146+
retention-days: 7

0 commit comments

Comments
 (0)