Gitea rejects an unparsable workflow without running anything, which for release.yml only surfaces when a tag is pushed. Parsing them all in CI catches it on master first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
86 lines
3.2 KiB
YAML
86 lines
3.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
|
|
# One runner serves all three repos, so a queue is a real cost: superseding
|
|
# pushes shouldn't each wait for a full build. Releases deliberately aren't
|
|
# covered — cancelling a publish halfway is worse than running it twice.
|
|
concurrency:
|
|
group: ${{ gitea.workflow }}-${{ gitea.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: rocky-10
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@v4
|
|
|
|
# Gitea rejects a workflow file it can't parse without running
|
|
# anything, which for release.yml only shows up when a tag is pushed.
|
|
# Parsing them all here catches that on master, before tagging.
|
|
- name: Check workflow files parse
|
|
run: |
|
|
python3 - <<'PY'
|
|
import glob, yaml
|
|
for f in sorted(glob.glob(".gitea/workflows/*.yml")):
|
|
yaml.safe_load(open(f))
|
|
print("ok", f)
|
|
PY
|
|
|
|
- name: Set up JDK
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: '17'
|
|
|
|
# Installed explicitly rather than via android-actions/setup-android
|
|
# so the SDK package versions are pinned to match compileSdk 37 /
|
|
# build-tools 36.0.0, instead of whatever the action defaults to.
|
|
# 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-37.0" "build-tools;36.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
|
|
|
|
- name: Unit tests
|
|
run: ./gradlew testDebugUnitTest --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."
|