Use absolute paths in CI scripts, add APK debugging
Build Debug APK / build (push) Failing after 2m5s

Resolve all paths from REPO_ROOT to eliminate fragile cd/relative
path issues. Add diagnostic steps to trace where the APK ends up.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Greg Shuflin
2026-03-21 00:30:15 -07:00
parent 4805eb0510
commit 41530eec8b
2 changed files with 26 additions and 9 deletions
+5
View File
@@ -21,6 +21,11 @@ jobs:
if: ${{ gitea.event.inputs.skip_build != 'true' }}
run: nix develop --command build-apk-ci
- name: Verify APK exists
run: |
echo "PWD: $PWD"
find . -name "*.apk" -type f 2>/dev/null || echo "No APK files found anywhere"
- name: Create release
env:
GITEA_SHA: ${{ gitea.sha }}
+21 -9
View File
@@ -46,10 +46,16 @@
# This script should run in the Gitea CI process to build the APK
createReleaseCi = pkgs.writeShellScriptBin "create-release-ci" ''
set -euo pipefail
APK_PATH="android/app/build/outputs/apk/debug/app-debug.apk"
REPO_ROOT="$PWD"
APK_PATH="$REPO_ROOT/android/app/build/outputs/apk/debug/app-debug.apk"
SHORT_SHA="''${GITEA_SHA:0:7}"
TAG="build-''${SHORT_SHA}"
if [ ! -f "$APK_PATH" ]; then
echo "ERROR: APK not found at $APK_PATH"
exit 1
fi
export XDG_CONFIG_HOME="$(mktemp -d)"
mkdir -p "$XDG_CONFIG_HOME/tea"
cat > "$XDG_CONFIG_HOME/tea/config.yml" <<YML
@@ -72,14 +78,15 @@
'';
buildApkCi = pkgs.writeShellScriptBin "build-apk-ci" ''
export GRADLE_USER_HOME="$PWD/.gradle-home"
export ANDROID_USER_HOME="$PWD/.android-home"
REPO_ROOT="$PWD"
export GRADLE_USER_HOME="$REPO_ROOT/.gradle-home"
export ANDROID_USER_HOME="$REPO_ROOT/.android-home"
export CARGO_BUILD_JOBS=2
export CARGO_TARGET_DIR="/var/cache/gitea-runner/cargo-target"
export RUSTC_WRAPPER="${pkgs.sccache}/bin/sccache"
export SCCACHE_DIR="/var/cache/gitea-runner/sccache"
cat > android/local.properties <<PROPS
cat > "$REPO_ROOT/android/local.properties" <<PROPS
sdk.dir=${androidSdk}/libexec/android-sdk
android.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/35.0.0/aapt2
PROPS
@@ -87,18 +94,23 @@
echo "=== sccache stats before build ==="
${pkgs.sccache}/bin/sccache --show-stats || true
cd android
bash gradlew assembleDebug --no-daemon --max-workers=2 -Pandroid.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/35.0.0/aapt2
"$REPO_ROOT/android/gradlew" \
-p "$REPO_ROOT/android" \
assembleDebug --no-daemon --max-workers=2 \
-Pandroid.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/35.0.0/aapt2
echo "=== build outputs ==="
find "$REPO_ROOT/android/app/build/outputs" -type f -name "*.apk" 2>/dev/null || echo "No APK files found"
echo "=== REPO_ROOT is: $REPO_ROOT ==="
echo "=== sccache stats after build ==="
${pkgs.sccache}/bin/sccache --show-stats || true
echo "=== APK size ==="
ls -lh "$PWD/app/build/outputs/apk/debug/app-debug.apk"
ls -lh "$REPO_ROOT/android/app/build/outputs/apk/debug/app-debug.apk"
echo "=== cleaning old cargo artifacts ==="
cd "$OLDPWD/rust"
${pkgs.cargo-sweep}/bin/cargo-sweep sweep --maxsize 2GB || true
${pkgs.cargo-sweep}/bin/cargo-sweep sweep --maxsize 2GB "$REPO_ROOT/rust" || true
'';
in {
devShells.default = pkgs.mkShell {