~ knotless Search/
↑↓ move↵ open⇧↵ all results

grain.social/grain-android

1 collaborator
0
1
main
50 lines · 2.3 KB Raw History
# The debug build, on pushes to main and pulls into it, as test.yml runs.
# That runs the JVM tests and the coverage gate beside this, in a job of
# its own, so neither waits on the other.
#
# The debug build is signed with the SDK's debug key, so it needs no
# keystore and no secret. The release build is not here, for the reason
# test.yml gives: R8 takes about an hour.
#
# Android lint is not here yet: `lintDebug` finds 8 errors in main as it
# is (MissingPermission in GrainMessagingService.kt, and seven of
# ViewModelConstructorInComposable). Once they are fixed, or taken into a
# baseline, it is one more step after the build:
# `./gradlew $GRADLE_FLAGS :app:lintDebug`.
#
# The SDK setup, the image and the memory settings are test.yml's, so the
# two share the SDK and Gradle caches: see there for why each is as it is.
image: eclipse-temurin:17-jdk
on:
  push: { refs: [refs/heads/main] }
  pull: { base: [refs/heads/main] }
cache: [/opt/android-sdk, /root/.gradle/caches, /root/.gradle/wrapper]
env:
  CMDLINE_TOOLS: commandlinetools-linux-16111833_latest.zip
  ANDROID_PLATFORM: platforms;android-37.0
  ANDROID_BUILD_TOOLS: build-tools;36.0.0
  ANDROID_HOME: /opt/android-sdk
  GRADLE_FLAGS: >-
    --no-daemon
    -Dorg.gradle.jvmargs=-Xmx1536m
    -Pkotlin.compiler.execution.strategy=in-process
    -Dorg.gradle.workers.max=2
steps:
  - name: android sdk
    run: |
      apt-get update -qq
      apt-get install -y -qq git unzip curl >/dev/null
      have="$CMDLINE_TOOLS $ANDROID_PLATFORM $ANDROID_BUILD_TOOLS"
      [ "$(cat "$ANDROID_HOME/.installed" 2>/dev/null)" = "$have" ] && exit 0
      find "$ANDROID_HOME" -mindepth 1 -delete 2>/dev/null || true
      mkdir -p "$ANDROID_HOME/cmdline-tools"
      curl -fsSL -o /tmp/cmdline-tools.zip "https://dl.google.com/android/repository/$CMDLINE_TOOLS"
      unzip -q /tmp/cmdline-tools.zip -d "$ANDROID_HOME/cmdline-tools"
      mv "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/latest"
      sdk="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager"
      yes 2>/dev/null | "$sdk" --licenses >/dev/null 2>&1 || true
      "$sdk" "platform-tools" "$ANDROID_PLATFORM" "$ANDROID_BUILD_TOOLS" >/dev/null
      echo "$have" > "$ANDROID_HOME/.installed"
  - name: assemble debug
    timeout: 30
    run: ./gradlew $GRADLE_FLAGS :app:assembleDebug