name: Build TV app on: push: workflow_dispatch: # No marketplace actions: this Gitea runner resolves bare action names # against the local instance, and even with full URLs it cannot resolve # annotated tags ("unsupported object type"). Everything below is plain # shell, which also keeps the job readable. jobs: build: runs-on: ubuntu-latest container: image: docker.gitea.com/runner-images:ubuntu-latest # A directory on the runner host, whitelisted in the runner's # valid_volumes. Everything the job would otherwise download on every # push — JDK, Android SDK, Gradle distribution and dependencies — # lives here and survives the container. options: -v /etc/komodo/stacks/gitea/runner-cache/castarr:/cache env: CACHE: /cache JAVA_HOME: /cache/jdk17 ANDROID_SDK_ROOT: /cache/android-sdk GRADLE_USER_HOME: /cache/gradle JDK_URL: https://api.adoptium.net/v3/binary/latest/17/ga/linux/x64/jdk/hotspot/normal/eclipse CMDLINE_TOOLS: https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip steps: - name: Checkout run: | git init -q . git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" git fetch -q --depth 1 origin "${GITHUB_SHA}" git checkout -q FETCH_HEAD - name: JDK 17 run: | if [ ! -x "$JAVA_HOME/bin/java" ]; then echo "JDK nicht im Cache — einmalig herunterladen" mkdir -p "$JAVA_HOME" curl -sSL "$JDK_URL" | tar -xz -C "$JAVA_HOME" --strip-components=1 fi "$JAVA_HOME/bin/java" -version - name: Android SDK run: | if [ ! -d "$ANDROID_SDK_ROOT/platforms/android-35" ]; then echo "SDK nicht im Cache — einmalig einrichten" mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" curl -sSL -o /tmp/tools.zip "$CMDLINE_TOOLS" unzip -q -o /tmp/tools.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" rm -rf "$ANDROID_SDK_ROOT/cmdline-tools/latest" mv "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest" # Accept licences by writing the hashes: piping "yes" into # sdkmanager dies of SIGPIPE (exit 141) under pipefail. mkdir -p "$ANDROID_SDK_ROOT/licenses" echo "24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$ANDROID_SDK_ROOT/licenses/android-sdk-license" echo "84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_SDK_ROOT/licenses/android-sdk-preview-license" JAVA_HOME="$JAVA_HOME" "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" \ "platforms;android-35" "build-tools;35.0.0" "platform-tools" > /dev/null fi echo "sdk.dir=$ANDROID_SDK_ROOT" > local.properties # One invocation, not two: a second --no-daemon run pays for another JVM # start and another configuration phase to redo work it just did. - name: Tests und Debug-APK run: ./gradlew testDebugUnitTest assembleDebug --no-daemon --stacktrace - name: Summary if: always() run: | echo "APK:"; ls -la app/build/outputs/apk/debug/ 2>/dev/null || echo " (kein Build)" echo "Tests:"; ls tests/runs/junit/ 2>/dev/null || echo " (keine Reports)" echo "Cache:"; du -sh "$CACHE"/* 2>/dev/null || echo " (leer)"