Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Android CI
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: android-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4
with:
distribution: temurin
java-version: '21'
- name: Ensure Android SDK 36 components
run: |
set -euo pipefail
SDK_ROOT="${ANDROID_HOME:-${ANDROID_SDK_ROOT:-/usr/local/lib/android/sdk}}"
echo "ANDROID_HOME=$SDK_ROOT" >> "$GITHUB_ENV"
echo "ANDROID_SDK_ROOT=$SDK_ROOT" >> "$GITHUB_ENV"
chmod +x ./gradlew
SDKMANAGER="$SDK_ROOT/cmdline-tools/latest/bin/sdkmanager"
if [ ! -x "$SDKMANAGER" ]; then
SDKMANAGER="$(find "$SDK_ROOT/cmdline-tools" -name sdkmanager -type f 2>/dev/null | head -n 1 || true)"
fi
if [ -n "$SDKMANAGER" ]; then
yes | "$SDKMANAGER" --licenses > /dev/null || true
if [ ! -d "$SDK_ROOT/platforms/android-36" ] || [ ! -d "$SDK_ROOT/build-tools/36.0.0" ]; then
"$SDKMANAGER" "platforms;android-36" "build-tools;36.0.0" "platform-tools"
fi
fi
- uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4
- name: Validate documentation and resources
run: python3 tools/check_docs.py && python3 tools/check_android_scaffold.py
- name: Unit tests, lint and debug APK
run: |
set -euo pipefail
if ./gradlew --no-daemon --max-workers=2 --rerun-tasks \
:app:testDebugUnitTest :app:lintDebug :app:assembleDebug \
> "$RUNNER_TEMP/ci-gradle.log" 2>&1; then
tail -n 30 "$RUNNER_TEMP/ci-gradle.log"
else
echo "==== FAILING TESTS ===="
python3 - <<'PY' || true
import glob
import os
import xml.etree.ElementTree as ET

def emit(title, body):
safe = body.replace("%", "%25").replace("\r", "").replace("\n", "%0A")[:6000]
print(f"::error title={title}::{safe}")

for path in sorted(glob.glob("app/build/test-results/testDebugUnitTest/*.xml")):
try:
root = ET.parse(path).getroot()
except Exception:
continue
for case in root.iter("testcase"):
problems = list(case.findall("failure")) + list(case.findall("error"))
for failure in problems:
detail = (failure.get("message") or "") + "\n" + (failure.text or "")
emit(f"{case.get('classname')}.{case.get('name')}", detail.strip())
PY
tail -n 120 "$RUNNER_TEMP/ci-gradle.log"
python3 - "$RUNNER_TEMP/ci-gradle.log" <<'PY'
import os, pathlib, re, sys
lines = pathlib.Path(sys.argv[1]).read_text(errors="replace").splitlines()
errors = [l for l in lines if re.search(r"(^e: |\berror:|Unresolved reference|Type mismatch|Compilation error|FAILURE:)", l)]
markers = [i for i, l in enumerate(lines) if "* What went wrong:" in l]
tail = lines[max(0, markers[-1] - 10):min(len(lines), markers[-1] + 45)] if markers else lines[-50:]
excerpt = "\n".join(errors + ([""] if errors else []) + tail)[-6000:]
with open(os.environ["GITHUB_STEP_SUMMARY"], "a", encoding="utf-8") as f:
f.write("### Gradle CI failure\n\n```text\n" + excerpt + "\n```\n")
# The checks API only keeps the first ten annotations of a step.
for line in errors[:10]:
one = line.replace("%", "%25").replace("\r", "").replace("\n", " ")[:900]
print(f"::error title=Kotlin::{one}")
escaped = tail[:1500].replace("%", "%25").replace("\r", "%0D").replace("\n", "%0A")
print(f"::error title=Android CI failure::{escaped}")
PY
exit 1
fi

- name: Upload full build log on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: ci-gradle-log
path: ${{ runner.temp }}/ci-gradle.log
if-no-files-found: ignore
- name: Upload test reports and debug APK
if: always()
uses: actions/upload-artifact@v4
with:
name: android-ci-outputs
if-no-files-found: ignore
path: |
app/build/outputs/apk/debug/*.apk
app/build/reports/**
app/build/test-results/**
18 changes: 18 additions & 0 deletions .github/workflows/planning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Planning checks
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: planning-${{ github.ref }}
cancel-in-progress: true
jobs:
docs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Validate planning scaffold and links
run: python3 tools/check_docs.py
Loading
Loading