CI / build (push) Successful in 7m10s
android-actions/setup-android assumes a GitHub-hosted image with the SDK already present, and fails on a bare self-hosted host runner. Install cmdline-tools directly instead — same approach verified locally, and it persists in $HOME between runs so it's a one-time cost. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
63 lines
2.3 KiB
YAML
63 lines
2.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: rocky-10
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: '17'
|
|
|
|
# Installed explicitly rather than via android-actions/setup-android,
|
|
# which assumes a GitHub-hosted image with the SDK already present.
|
|
# Persists in $HOME on this self-hosted runner, so it's a one-time cost.
|
|
- name: Set up Android SDK
|
|
run: |
|
|
set -eu
|
|
SDK="$HOME/android-sdk"
|
|
if [ ! -d "$SDK/cmdline-tools/latest" ]; then
|
|
mkdir -p "$SDK/cmdline-tools"
|
|
curl -sSLo /tmp/cmdline-tools.zip \
|
|
https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
|
unzip -q /tmp/cmdline-tools.zip -d "$SDK/cmdline-tools"
|
|
mv "$SDK/cmdline-tools/cmdline-tools" "$SDK/cmdline-tools/latest"
|
|
rm -f /tmp/cmdline-tools.zip
|
|
fi
|
|
yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --licenses >/dev/null 2>&1 || true
|
|
"$SDK/cmdline-tools/latest/bin/sdkmanager" \
|
|
"platform-tools" "platforms;android-35" "build-tools;35.0.0" >/dev/null
|
|
echo "ANDROID_HOME=$SDK" >> "$GITHUB_ENV"
|
|
echo "ANDROID_SDK_ROOT=$SDK" >> "$GITHUB_ENV"
|
|
|
|
- name: Cache Gradle
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.gradle/caches
|
|
key: gradle-${{ hashFiles('**/*.gradle.kts', 'gradle/wrapper/gradle-wrapper.properties') }}
|
|
restore-keys: gradle-
|
|
|
|
- name: Build debug APK
|
|
run: ./gradlew assembleDebug --no-daemon
|
|
|
|
# Hard constraint from android-client-spec.md §7: nothing Google-
|
|
# dependent, including transitive pulls. Cheap to assert here, and far
|
|
# easier than noticing a library dragged it in three months from now.
|
|
- name: Assert no Play Services or Firebase
|
|
run: |
|
|
if ./gradlew :app:dependencies --configuration releaseRuntimeClasspath --no-daemon \
|
|
| grep -iE 'play-services|firebase|com\.google\.android\.gms'; then
|
|
echo "::error::Play Services/Firebase found in the dependency tree"
|
|
exit 1
|
|
fi
|
|
echo "Dependency tree is clean."
|