Compare commits
11 Commits
test1
...
2026-09-01
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bf7f6b387 | ||
|
|
1ac5f0d7fa | ||
|
|
052ea8de4c | ||
|
|
9c77cdc3a3 | ||
|
|
b5fea9e010 | ||
|
|
df07409e48 | ||
|
|
6604b5b94a | ||
|
|
56eddb424a | ||
|
|
98faa8b6f0 | ||
|
|
ee21751e03 | ||
|
|
0b719dcc36 |
@@ -1,7 +1,7 @@
|
||||
name: Android build
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
contents: write
|
||||
releases: write
|
||||
|
||||
on:
|
||||
@@ -50,8 +50,8 @@ jobs:
|
||||
set -o pipefail
|
||||
sdkmanager \
|
||||
"platform-tools" \
|
||||
"platforms;android-35" \
|
||||
"build-tools;35.0.0" \
|
||||
"platforms;android-36" \
|
||||
"build-tools;36.0.0" \
|
||||
"ndk;27.2.12479018" \
|
||||
"cmake;3.22.1"
|
||||
|
||||
@@ -96,6 +96,52 @@ jobs:
|
||||
set -euxo pipefail
|
||||
printf 'sdk.dir=%s/.android/sdk\n' "$HOME" > local.properties
|
||||
|
||||
- name: Install Rust toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
if ! command -v cargo >/dev/null 2>&1; then
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
|
||||
fi
|
||||
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
cargo --version
|
||||
rustc --version
|
||||
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
|
||||
|
||||
- name: Compile bundled native Git binaries
|
||||
shell: bash
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
export ANDROID_SDK_ROOT="$HOME/.android/sdk"
|
||||
export ANDROID_HOME="$ANDROID_SDK_ROOT"
|
||||
chmod +x ./AndroidProjectTooling.sh
|
||||
bash ./AndroidProjectTooling.sh --compile-android-git
|
||||
|
||||
- name: Prepare CI build metadata
|
||||
id: build_meta
|
||||
shell: bash
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
timestamp_utc="$(date -u +%Y%m%d-%H%M%S)"
|
||||
version_code="$(date -u +%s)"
|
||||
project_name="$(basename "$GITHUB_REPOSITORY")"
|
||||
python3 - "$version_code" <<'PY'
|
||||
from pathlib import Path
|
||||
import re, sys
|
||||
path = Path('app/build.gradle.kts')
|
||||
text = path.read_text(encoding='utf-8')
|
||||
new_text, count = re.subn(r'(\bversionCode\s*=\s*)\d+', rf'\g<1>{sys.argv[1]}', text, count=1)
|
||||
if count != 1:
|
||||
raise SystemExit('versionCode not found in app/build.gradle.kts')
|
||||
path.write_text(new_text, encoding='utf-8')
|
||||
PY
|
||||
echo "Using CI versionCode: $version_code"
|
||||
echo "project_name=$project_name" >> "$GITHUB_OUTPUT"
|
||||
echo "timestamp_utc=$timestamp_utc" >> "$GITHUB_OUTPUT"
|
||||
echo "version_code=$version_code" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build debug APK
|
||||
if: github.event_name != 'release'
|
||||
shell: bash
|
||||
@@ -105,6 +151,30 @@ jobs:
|
||||
export ANDROID_HOME="$ANDROID_SDK_ROOT"
|
||||
./gradlew --no-daemon clean assembleDebug
|
||||
|
||||
- name: Verify debug APK bundles native Git
|
||||
if: github.event_name != 'release'
|
||||
shell: bash
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
import zipfile
|
||||
apk = next(Path('app/build/outputs/apk/debug').glob('*.apk'))
|
||||
with zipfile.ZipFile(apk) as zf:
|
||||
names = zf.namelist()
|
||||
required = {
|
||||
'lib/arm64-v8a/libgit.so',
|
||||
'lib/armeabi-v7a/libgit.so',
|
||||
'lib/x86/libgit.so',
|
||||
'lib/x86_64/libgit.so',
|
||||
}
|
||||
found = {name for name in names if name in required}
|
||||
print('APK_NATIVE_GIT', sorted(found))
|
||||
missing = sorted(required - found)
|
||||
if missing:
|
||||
raise SystemExit(f'Missing native Git libraries in {apk}: {missing}')
|
||||
PY
|
||||
|
||||
- name: Build release AAB
|
||||
if: github.event_name == 'release'
|
||||
shell: bash
|
||||
@@ -114,6 +184,42 @@ jobs:
|
||||
export ANDROID_HOME="$ANDROID_SDK_ROOT"
|
||||
./gradlew --no-daemon bundleRelease
|
||||
|
||||
- name: Verify release AAB bundles native Git
|
||||
if: github.event_name == 'release'
|
||||
shell: bash
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
import zipfile
|
||||
aab = next(Path('app/build/outputs/bundle/release').glob('*.aab'))
|
||||
with zipfile.ZipFile(aab) as zf:
|
||||
names = zf.namelist()
|
||||
required = {
|
||||
'base/lib/arm64-v8a/libgit.so',
|
||||
'base/lib/armeabi-v7a/libgit.so',
|
||||
'base/lib/x86/libgit.so',
|
||||
'base/lib/x86_64/libgit.so',
|
||||
}
|
||||
found = {name for name in names if name in required}
|
||||
print('AAB_NATIVE_GIT', sorted(found))
|
||||
missing = sorted(required - found)
|
||||
if missing:
|
||||
raise SystemExit(f'Missing native Git libraries in {aab}: {missing}')
|
||||
PY
|
||||
|
||||
- name: Rename release AAB for upload
|
||||
if: github.event_name == 'release'
|
||||
id: release_aab
|
||||
shell: bash
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
aab="$(find app/build/outputs/bundle/release -name '*.aab' | head -n 1)"
|
||||
renamed="app/build/outputs/bundle/release/${{ steps.build_meta.outputs.project_name }}-${{ steps.build_meta.outputs.timestamp_utc }}-release.aab"
|
||||
mv -f "$aab" "$renamed"
|
||||
echo "Renamed release AAB to $(basename "$renamed")"
|
||||
echo "path=$renamed" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload debug APK
|
||||
if: github.event_name != 'release'
|
||||
uses: actions/upload-artifact@v3
|
||||
@@ -126,13 +232,19 @@ jobs:
|
||||
if: github.event_name == 'release'
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
token="${GITHUB_TOKEN:-${GITEA_TOKEN:-}}"
|
||||
if [ -z "$token" ]; then
|
||||
echo "::error::No release upload token is available from secrets.GITEA_TOKEN or github.token"
|
||||
exit 1
|
||||
fi
|
||||
release_id="$(python3 -c 'import json, os; print(json.load(open(os.environ["GITHUB_EVENT_PATH"], encoding="utf-8"))["release"]["id"])')"
|
||||
aab="$(find app/build/outputs/bundle/release -name '*.aab' | head -n 1)"
|
||||
aab="${{ steps.release_aab.outputs.path }}"
|
||||
curl --fail-with-body \
|
||||
--request POST \
|
||||
--header "Authorization: token ${GITEA_TOKEN}" \
|
||||
--header "Authorization: token ${token}" \
|
||||
--form "attachment=@${aab}" \
|
||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=$(basename "$aab")"
|
||||
|
||||
@@ -30,8 +30,8 @@ GRADLE_DIST_URL="https://services.gradle.org/distributions/gradle-8.7-bin.zip"
|
||||
JDK_DIST_URL="https://api.adoptium.net/v3/binary/latest/17/ga/linux/x64/jdk/hotspot/normal/eclipse"
|
||||
ANDROID_NDK_PACKAGE="ndk;27.2.12479018"
|
||||
ANDROID_CMAKE_PACKAGE="cmake;3.22.1"
|
||||
ANDROID_EMULATOR_SYSTEM_IMAGE="system-images;android-35;google_apis;x86_64"
|
||||
ANDROID_TEST_AVD_NAME="githug_android_api35"
|
||||
ANDROID_EMULATOR_SYSTEM_IMAGE="system-images;android-36;google_apis;x86_64"
|
||||
ANDROID_TEST_AVD_NAME="githug_android_api36"
|
||||
ANDROID_NDK_DIR="$SDK_DIR/ndk/27.2.12479018"
|
||||
ANDROID_CMAKE_DIR="$SDK_DIR/cmake/3.22.1"
|
||||
ANDROID_TOOLBIN="$ANDROID_NDK_DIR/toolchains/llvm/prebuilt/linux-x86_64/bin"
|
||||
@@ -48,7 +48,7 @@ quiet_log_name() {
|
||||
local arg
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--build|--build-release-aab|--test|--clean-test|--test-emulator|--compile-git)
|
||||
--build|--build-release-aab|--test|--clean-test|--test-emulator|--compile-git|--compile-android-git)
|
||||
mode="${arg#--}"
|
||||
;;
|
||||
esac
|
||||
@@ -139,8 +139,8 @@ mark_successful_check() {
|
||||
|
||||
required_sdk_packages_present() {
|
||||
[ -d "$SDK_DIR/platform-tools" ] \
|
||||
&& [ -d "$SDK_DIR/platforms/android-35" ] \
|
||||
&& [ -d "$SDK_DIR/build-tools/35.0.0" ] \
|
||||
&& [ -d "$SDK_DIR/platforms/android-36" ] \
|
||||
&& [ -d "$SDK_DIR/build-tools/36.0.0" ] \
|
||||
&& [ -d "$ANDROID_NDK_DIR" ] \
|
||||
&& [ -d "$ANDROID_CMAKE_DIR" ]
|
||||
}
|
||||
@@ -148,7 +148,7 @@ required_sdk_packages_present() {
|
||||
required_emulator_packages_present() {
|
||||
required_sdk_packages_present \
|
||||
&& [ -x "$SDK_DIR/emulator/emulator" ] \
|
||||
&& [ -d "$SDK_DIR/system-images/android-35/google_apis/x86_64" ]
|
||||
&& [ -d "$SDK_DIR/system-images/android-36/google_apis/x86_64" ]
|
||||
}
|
||||
|
||||
auto_commit_if_needed() {
|
||||
@@ -502,10 +502,11 @@ build_host_git() {
|
||||
build_android_git_for_abi() {
|
||||
local abi="$1"
|
||||
local cc="$2"
|
||||
local rust_target="$3"
|
||||
local output_dir="$ANDROID_JNI_DIR/$abi"
|
||||
local output_binary="$output_dir/libgit.so"
|
||||
local stamp="$output_dir/.source-fingerprint"
|
||||
local fingerprint="$3:android:$abi:$cc:$ANDROID_API:githug-embedded-main"
|
||||
local fingerprint="$4:android:$abi:$cc:$rust_target:$ANDROID_API:githug-embedded-main"
|
||||
|
||||
require_path "$ANDROID_TOOLBIN/$cc"
|
||||
|
||||
@@ -530,6 +531,7 @@ build_android_git_for_abi() {
|
||||
AR=llvm-ar \
|
||||
RANLIB=llvm-ranlib \
|
||||
STRIP=llvm-strip \
|
||||
RUST_TARGETS="$rust_target" \
|
||||
"${make_args[@]}" \
|
||||
git
|
||||
|
||||
@@ -554,10 +556,10 @@ build_android_git() {
|
||||
local fingerprint
|
||||
fingerprint="$(git_source_fingerprint)"
|
||||
|
||||
build_android_git_for_abi "arm64-v8a" "aarch64-linux-android${ANDROID_API}-clang" "$fingerprint"
|
||||
build_android_git_for_abi "armeabi-v7a" "armv7a-linux-androideabi${ANDROID_API}-clang" "$fingerprint"
|
||||
build_android_git_for_abi "x86" "i686-linux-android${ANDROID_API}-clang" "$fingerprint"
|
||||
build_android_git_for_abi "x86_64" "x86_64-linux-android${ANDROID_API}-clang" "$fingerprint"
|
||||
build_android_git_for_abi "arm64-v8a" "aarch64-linux-android${ANDROID_API}-clang" "aarch64-linux-android" "$fingerprint"
|
||||
build_android_git_for_abi "armeabi-v7a" "armv7a-linux-androideabi${ANDROID_API}-clang" "armv7-linux-androideabi" "$fingerprint"
|
||||
build_android_git_for_abi "x86" "i686-linux-android${ANDROID_API}-clang" "i686-linux-android" "$fingerprint"
|
||||
build_android_git_for_abi "x86_64" "x86_64-linux-android${ANDROID_API}-clang" "x86_64-linux-android" "$fingerprint"
|
||||
}
|
||||
|
||||
build_all_git_targets() {
|
||||
@@ -598,8 +600,8 @@ ensure_sdk_packages() {
|
||||
log "Installing required Android SDK packages"
|
||||
"$CMDLINE_TOOLS_LATEST_DIR/bin/sdkmanager" --sdk_root="$SDK_DIR" \
|
||||
"platform-tools" \
|
||||
"platforms;android-35" \
|
||||
"build-tools;35.0.0" \
|
||||
"platforms;android-36" \
|
||||
"build-tools;36.0.0" \
|
||||
"$ANDROID_NDK_PACKAGE" \
|
||||
"$ANDROID_CMAKE_PACKAGE"
|
||||
|
||||
@@ -629,8 +631,8 @@ ensure_emulator_sdk_packages() {
|
||||
log "Installing Android emulator SDK packages"
|
||||
"$CMDLINE_TOOLS_LATEST_DIR/bin/sdkmanager" --sdk_root="$SDK_DIR" \
|
||||
"platform-tools" \
|
||||
"platforms;android-35" \
|
||||
"build-tools;35.0.0" \
|
||||
"platforms;android-36" \
|
||||
"build-tools;36.0.0" \
|
||||
"$ANDROID_NDK_PACKAGE" \
|
||||
"$ANDROID_CMAKE_PACKAGE" \
|
||||
"emulator" \
|
||||
@@ -786,6 +788,11 @@ maybe_run_operation() {
|
||||
build_all_git_targets
|
||||
return
|
||||
;;
|
||||
--compile-android-git)
|
||||
setup_env
|
||||
build_android_git
|
||||
return
|
||||
;;
|
||||
*)
|
||||
return
|
||||
;;
|
||||
@@ -850,7 +857,7 @@ maybe_run_operation() {
|
||||
|
||||
print_usage() {
|
||||
cat <<EOF_USAGE
|
||||
Usage: bash ./AndroidProjectTooling.sh [--quiet] [--build | --build-release-aab | --test | --clean-test | --test-emulator [--hide-emulator-window] | --compile-git]
|
||||
Usage: bash ./AndroidProjectTooling.sh [--quiet] [--build | --build-release-aab | --test | --clean-test | --test-emulator [--hide-emulator-window] | --compile-git | --compile-android-git]
|
||||
|
||||
--build Set up the environment and build the debug APK
|
||||
--build-release-aab Set up the environment and build a release Android App Bundle (AAB)
|
||||
@@ -859,6 +866,7 @@ Usage: bash ./AndroidProjectTooling.sh [--quiet] [--build | --build-release-aab
|
||||
--test-emulator Set up a visible Android emulator and run debug instrumentation tests on it
|
||||
--hide-emulator-window Run --test-emulator with the emulator window hidden
|
||||
--compile-git Compile Git for the development host and all Android target ABIs
|
||||
--compile-android-git Compile Git only for the Android target ABIs used by the app
|
||||
--quiet Write full output to build/reports/android-project-tooling/ and print only a concise result
|
||||
EOF_USAGE
|
||||
}
|
||||
@@ -872,7 +880,7 @@ validate_args() {
|
||||
shift || true
|
||||
|
||||
case "$mode" in
|
||||
""|--build|--build-release-aab|--test|--clean-test|--test-emulator|--compile-git)
|
||||
""|--build|--build-release-aab|--test|--clean-test|--test-emulator|--compile-git|--compile-android-git)
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $mode" >&2
|
||||
@@ -913,11 +921,18 @@ main() {
|
||||
require_tool git
|
||||
require_tool perl
|
||||
require_tool make
|
||||
require_tool clang
|
||||
require_tool pkg-config
|
||||
require_tool readelf
|
||||
require_tool file
|
||||
|
||||
local mode="${1:-}"
|
||||
if [ "$mode" = "--build" ] || [ "$mode" = "--build-release-aab" ] || [ "$mode" = "--test" ] || [ "$mode" = "--clean-test" ] || [ "$mode" = "--compile-git" ] || [ "$mode" = "--test-emulator" ] || [ "$mode" = "--compile-android-git" ]; then
|
||||
require_tool cargo
|
||||
fi
|
||||
if [ "$mode" = "--build" ] || [ "$mode" = "--build-release-aab" ] || [ "$mode" = "--test" ] || [ "$mode" = "--clean-test" ] || [ "$mode" = "--compile-git" ] || [ "$mode" = "--test-emulator" ]; then
|
||||
require_tool clang
|
||||
fi
|
||||
|
||||
ensure_dir "$TMP_DIR"
|
||||
ensure_dir "$SDK_DIR"
|
||||
ensure_dir "$GRADLE_USER_HOME_DIR"
|
||||
@@ -936,6 +951,7 @@ main() {
|
||||
log "NDK dir: $ANDROID_NDK_DIR"
|
||||
log "CMake dir: $ANDROID_CMAKE_DIR"
|
||||
log "To compile Git for host and Android ABIs: bash ./AndroidProjectTooling.sh --compile-git"
|
||||
log "To compile Git only for Android ABIs: bash ./AndroidProjectTooling.sh --compile-android-git"
|
||||
log "To build without a background Gradle daemon: ./gradlew --no-daemon assembleDebug"
|
||||
log "To set up and build in one step: bash ./AndroidProjectTooling.sh --build"
|
||||
log "To set up and build a release AAB in one step: bash ./AndroidProjectTooling.sh --build-release-aab"
|
||||
|
||||
1
HERMES_PUSH_TRIGGER_TEST.txt
Normal file
1
HERMES_PUSH_TRIGGER_TEST.txt
Normal file
@@ -0,0 +1 @@
|
||||
trigger test 2026-08-30T10:01:44-05:00
|
||||
@@ -19,13 +19,13 @@ plugins {
|
||||
|
||||
android {
|
||||
namespace = "solutions.tretter.githugandroid"
|
||||
compileSdk = 35
|
||||
compileSdk = 36
|
||||
ndkVersion = "27.2.12479018"
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "solutions.tretter.githugandroid"
|
||||
minSdk = 26
|
||||
targetSdk = 35
|
||||
targetSdk = 36
|
||||
versionCode = 184
|
||||
versionName = "0.1.183"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
plugins {
|
||||
id("com.android.application") version "8.6.1" apply false
|
||||
id("com.android.application") version "8.10.0" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.9.24" apply false
|
||||
}
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
Reference in New Issue
Block a user