Skip to content

Commit da3ef94

Browse files
fix: merge conflict
2 parents 91421f7 + 8e74714 commit da3ef94

File tree

18 files changed

+1138
-16
lines changed

18 files changed

+1138
-16
lines changed

.github/workflows/rep-build.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Reproducible Build Check
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
verify-reproducibility:
7+
runs-on: ubuntu-latest
8+
env:
9+
# These flags prevent Gradle from being too "greedy" with RAM
10+
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2 -Xmx2g
11+
steps:
12+
- name: Checkout Source
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Docker Buildx
16+
uses: docker/setup-buildx-action@v3
17+
18+
- name: Build First APK
19+
uses: docker/build-push-action@v5
20+
with:
21+
context: .
22+
target: apk-builder
23+
tags: app:build-one
24+
outputs: type=docker,dest=/tmp/image1.tar
25+
cache-from: type=gha
26+
cache-to: type=gha,mode=max
27+
# Pass memory limits into the Docker build
28+
build-args: |
29+
GRADLE_OPTS=-Xmx2048m
30+
31+
- name: Extract and Compare
32+
run: |
33+
docker load -i /tmp/image1.tar
34+
docker create --name container1 app:build-one
35+
36+
# This 'find' command is safer: it looks for the APK and ensures we found it
37+
APK_PATH=$(docker run --rm app:build-one find /android/app/build -name "*.apk" | grep "release" | head -n 1)
38+
39+
if [ -z "$APK_PATH" ]; then
40+
echo "Error: APK not found in build output!"
41+
exit 1
42+
fi
43+
44+
docker cp container1:$APK_PATH ./build1.apk
45+
sha256sum build1.apk
46+
47+
# For the sake of this test, we can compare the same image
48+
# Or run the build-push-action again for image2.tar

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM ubuntu:22.04 AS base
2+
# Ensure we have essential tools for Gradle to run
3+
RUN apt-get update && apt-get install -y \
4+
openjdk-17-jdk wget unzip git \
5+
&& rm -rf /var/lib/apt/lists/*
6+
7+
ENV ANDROID_HOME="/opt/android-sdk"
8+
ENV PATH="${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools"
9+
10+
# Install SDK Tools properly
11+
RUN mkdir -p ${ANDROID_HOME}/cmdline-tools && \
12+
wget -q https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip -O /tmp/tools.zip && \
13+
unzip /tmp/tools.zip -d ${ANDROID_HOME}/cmdline-tools && \
14+
mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest && \
15+
rm /tmp/tools.zip
16+
17+
# Pre-accept licenses and install required components
18+
# Use the versions your specific app needs
19+
RUN yes | sdkmanager --licenses && \
20+
sdkmanager "platforms;android-33" "build-tools;33.0.0"
21+
22+
WORKDIR /android
23+
24+
# --- Cache Stage ---
25+
COPY gradlew .
26+
COPY gradle/ gradle/
27+
COPY build.gradle .
28+
COPY settings.gradle .
29+
COPY app/build.gradle app/
30+
31+
# FIX: Ensure gradlew is executable and run dependencies
32+
RUN chmod +x gradlew && ./gradlew --no-daemon dependencies
33+
34+
# --- Build Stage ---
35+
FROM base AS apk-builder
36+
COPY . .
37+
ENV SOURCE_DATE_EPOCH=1709834400
38+
RUN chmod +x gradlew && ./gradlew assembleRelease --no-daemon

Makefile

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
pass=$$(cat ks.passwd)
2+
branch_name=$$(git symbolic-ref HEAD)
3+
4+
branch=$$(git symbolic-ref HEAD | cut -d "/" -f 3)
5+
# track = 'internal', 'alpha', 'beta', 'production'
6+
track=$$(python3 track.py $(branch))
7+
8+
releaseVersion=$$(sed -n '1p' version.properties | cut -d "=" -f 2)
9+
stagingVersion=$$(sed -n '2p' version.properties | cut -d "=" -f 2)
10+
nightlyVersion=$$(sed -n '3p' version.properties | cut -d "=" -f 2)
11+
label=$$(sed -n '4p' version.properties | cut -d "=" -f 2)
12+
tagVersion=$$(sed -n '5p' version.properties | cut -d "=" -f 2)
13+
14+
# label=${releaseVersion}.${stagingVersion}.${nightlyVersion}
15+
16+
aab_output=${label}.aab
17+
apk_output=${label}.apk
18+
19+
APP_1=${label}.apk
20+
APP_2=${label}_1.apk
21+
22+
CONTAINER_NAME=deku_sms_container_${label}
23+
CONTAINER_NAME_1=deku_sms_container_${label}_1
24+
CONTAINER_NAME_BUNDLE=deku_sms_container_${label}_bundle
25+
CONTAINER_NAME_COMMIT_CHECK=$(commit)_commit_check
26+
27+
minSdk=24
28+
29+
github_url=https://api.github.com/repos/dekusms/DekuSMS-Android/releases
30+
docker_apk_image=deku_sms_apk_image
31+
docker_apk_image_commit_check=docker_apk_image_commit_check
32+
docker_app_image=deku_sms_app_image
33+
34+
diff_check:
35+
@echo "Building apk output: ${APP_1}"
36+
@docker build -t ${docker_apk_image} --platform linux/amd64 --target apk-builder .
37+
@docker run --name ${CONTAINER_NAME} -e PASS=$(pass) ${docker_apk_image} && \
38+
docker cp ${CONTAINER_NAME}:/android/app/build/outputs/apk/release/app-release.apk apk-outputs/${APP_1}
39+
@sleep 3
40+
@echo "Building apk output: ${APP_2}"
41+
@docker run --name ${CONTAINER_NAME_1} -e PASS=$(pass) ${docker_apk_image} && \
42+
docker cp ${CONTAINER_NAME_1}:/android/app/build/outputs/apk/release/app-release.apk apk-outputs/${APP_2}
43+
@diffoscope apk-outputs/${APP_1} apk-outputs/${APP_2}
44+
@echo $? | exit
45+
46+
docker-build-aab: diff_check
47+
@sleep 5
48+
@docker build -t ${docker_app_image} --platform linux/amd64 --target bundle-builder .
49+
@docker run --name ${CONTAINER_NAME_BUNDLE} -e PASS=$(pass) -e MIN_SDK=$(minSdk) ${docker_app_image} && \
50+
docker cp ${CONTAINER_NAME_BUNDLE}:/android/app/build/outputs/bundle/release/app-bundle.aab apk-outputs/${aab_output}
51+
52+
build-apk:
53+
@echo "+ Building apk output: ${apk_output} - ${branch_name}"
54+
@./gradlew clean assembleRelease
55+
@apksigner sign --ks app/keys/app-release-key.jks \
56+
--ks-pass pass:$(pass) \
57+
--in app/build/outputs/apk/release/app-release-unsigned.apk \
58+
--out apk-outputs/${apk_output}
59+
@shasum apk-outputs/${apk_output}
60+
61+
bump_version:
62+
@python3 -m venv venv; \
63+
( \
64+
. venv/bin/activate; \
65+
pip3 install -r requirements.txt; \
66+
python3 bump_version.py $(branch_name); \
67+
git add . ; \
68+
git commit -m "release: making release"; \
69+
)
70+
71+
build-aab:
72+
@echo "+ Building aab output: ${aab_output} - ${branch_name}"
73+
@./gradlew clean bundleRelease
74+
@apksigner sign --ks app/keys/app-release-key.jks \
75+
--ks-pass pass:$(pass) \
76+
--in app/build/outputs/bundle/release/app-release.aab \
77+
--out apk-outputs/${aab_output} \
78+
--min-sdk-version ${minSdk}
79+
@shasum apk-outputs/${aab_output}
80+
81+
test-flight:
82+
# check if builds can be signed
83+
@if [ ! -f "app/keys/app-release-key.jks" ]; then \
84+
echo "+ [ERROR] app/keys/app-release-key.jks file not found for signing"; \
85+
exit 1; \
86+
else \
87+
python3 -m venv venv; \
88+
( \
89+
. venv/bin/activate; \
90+
pip3 install -r requirements.txt; \
91+
python3 release.py --github_url "${github_url}"; \
92+
) \
93+
fi
94+
95+
release-cd: requirements.txt bump_version docker-build-aab
96+
@echo "+ Target branch for relase: ${branch}"
97+
@git tag -f ${tagVersion}
98+
@git push origin ${branch_name}
99+
@git push --tag
100+
@python3 -m venv venv
101+
@( \
102+
. venv/bin/activate; \
103+
pip3 install -r requirements.txt; \
104+
python3 release.py \
105+
--version_code ${tagVersion} \
106+
--version_name ${label} \
107+
--description "<b>Release</b>: ${label}<br><b>Build No</b>: ${tagVersion}<br><b>shasum</b>: $$(shasum apk-outputs/$(apk_output))" \
108+
--branch ${branch} \
109+
--track ${track} \
110+
--app_bundle_file apk-outputs/${aab_output} \
111+
--app_apk_file apk-outputs/${apk_output} \
112+
--status "completed" \
113+
--platform "all" \
114+
--github_url "${github_url}" \
115+
)
116+
117+
118+
clean:
119+
@containers=$$(docker ps -a --filter "ancestor=$(docker_apk_image)" --format "{{.ID}}"); \
120+
if [ -n "$$containers" ]; then \
121+
docker stop $$containers; \
122+
docker rm $$containers; \
123+
fi
124+
@containers=$$(docker ps -a --filter "ancestor=$(docker_app_image)" --format "{{.ID}}"); \
125+
if [ -n "$$containers" ]; then \
126+
docker stop $$containers; \
127+
docker rm $$containers; \
128+
fi
129+
@containers=$$(docker ps -a --filter "ancestor=$(docker_apk_image_commit_check)" --format "{{.ID}}"); \
130+
if [ -n "$$containers" ]; then \
131+
docker stop $$containers; \
132+
docker rm $$containers; \
133+
fi
134+
@echo "y" | docker builder prune -a
135+
@echo "y" | docker image prune -a
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="language_spanish" >الأسبانية</string>
4+
<string name="language_arabic">عربي</string>
5+
<string name="language_arabic_value" />
6+
</resources>

0 commit comments

Comments
 (0)