ci(android): fix CI runner (JDK/SDK/gradlew) + variant test
Some checks failed
PR Checks / android-build (pull_request) Failing after 2m48s
Some checks failed
PR Checks / android-build (pull_request) Failing after 2m48s
PR #2 merged the M0 scaffold with the initial CI, which fails on this self-hosted runner. Fix forward: - JDK 17 via apt (openjdk-17-jdk-headless) + JAVA_HOME, replacing actions/setup-java: the runner can't resolve api.adoptium.net (EAI_AGAIN). - Explicit `sdkmanager` install of platform-tools + platforms;android-35 + build-tools;35.0.0 so the build never relies on AGP auto-download. - `chmod +x ./gradlew` in the run step (and set the 100755 git bit): this runner's checkout drops file modes, so `./gradlew` alone hit "Permission denied" (exit 126). - ScaffoldSanityTest: drop the BuildConfig.DEBUG assertion, which fails under testReleaseUnitTest (the `test` task runs both variants); assert VERSION_NAME. - Remove the redundant android:label on MainActivity (RedundantLabel lint). Verified locally against the Android Studio SDK (platform 35 + build-tools 35.0.0): `./gradlew lint test assembleDebug` passes and builds a debug APK. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -8,10 +8,13 @@
|
|||||||
# * Enable Status Check
|
# * Enable Status Check
|
||||||
# * Status check patterns: PR Checks / *
|
# * Status check patterns: PR Checks / *
|
||||||
#
|
#
|
||||||
# Runner: the org's self-hosted `ubuntu-latest`, on a bare `ubuntu:latest`
|
# Runner: the org's self-hosted `ubuntu-latest`. The container lacks
|
||||||
# container that lacks git/curl/unzip (needed by checkout + sdkmanager) -- so the
|
# git/curl/unzip (needed by checkout + sdkmanager), so the first step installs
|
||||||
# first step installs them. (Faster later: switch to a prebuilt Android-SDK
|
# them. It also installs JDK 17 from the Ubuntu archive rather than using
|
||||||
# container image so nothing installs per-run.)
|
# actions/setup-java, because this runner can't resolve api.adoptium.net (that
|
||||||
|
# download fails with EAI_AGAIN) while the Ubuntu mirrors are reachable.
|
||||||
|
# (Faster later: switch to a prebuilt Android-SDK+JDK container image so nothing
|
||||||
|
# installs per-run.)
|
||||||
|
|
||||||
name: PR Checks
|
name: PR Checks
|
||||||
|
|
||||||
@@ -27,23 +30,24 @@ jobs:
|
|||||||
android-build:
|
android-build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
# Bare ubuntu:latest is missing the tools checkout + the SDK installer need.
|
# Install the tools checkout + the SDK installer need, plus JDK 17 (see the
|
||||||
- name: Install base tools
|
# header note on why we avoid actions/setup-java on this runner).
|
||||||
|
- name: Install base tools + JDK 17
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y git curl unzip
|
apt-get install -y git curl unzip openjdk-17-jdk-headless
|
||||||
|
echo "JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up JDK 17
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: temurin
|
|
||||||
java-version: "17"
|
|
||||||
|
|
||||||
- name: Set up Android SDK
|
- name: Set up Android SDK
|
||||||
uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v3
|
||||||
|
|
||||||
|
# Install exactly what the build targets so it never depends on AGP's
|
||||||
|
# build-time auto-download. `yes |` accepts any license prompts.
|
||||||
|
- name: Install Android SDK packages
|
||||||
|
run: yes | sdkmanager "platform-tools" "platforms;android-35" "build-tools;35.0.0"
|
||||||
|
|
||||||
- name: Cache Gradle
|
- name: Cache Gradle
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
@@ -54,5 +58,9 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
gradle-${{ runner.os }}-
|
gradle-${{ runner.os }}-
|
||||||
|
|
||||||
|
# chmod defensively: this runner's checkout doesn't preserve the git
|
||||||
|
# executable bit, so `./gradlew` alone fails with "Permission denied".
|
||||||
- name: Lint, test, assemble debug
|
- name: Lint, test, assemble debug
|
||||||
run: ./gradlew --no-daemon lint test assembleDebug
|
run: |
|
||||||
|
chmod +x ./gradlew
|
||||||
|
./gradlew --no-daemon lint test assembleDebug
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:label="@string/app_name"
|
|
||||||
android:theme="@style/Theme.RunicGateway">
|
android:theme="@style/Theme.RunicGateway">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import org.junit.Test
|
|||||||
/**
|
/**
|
||||||
* Placeholder JVM unit test so the `test` CI gate has something to run in M0.
|
* Placeholder JVM unit test so the `test` CI gate has something to run in M0.
|
||||||
* Real repository / view-model tests arrive with the functional pass (M1+).
|
* Real repository / view-model tests arrive with the functional pass (M1+).
|
||||||
|
*
|
||||||
|
* Assertions must be variant-agnostic: the `test` task runs both the debug and
|
||||||
|
* release unit-test variants, so nothing here may depend on `BuildConfig.DEBUG`.
|
||||||
*/
|
*/
|
||||||
class ScaffoldSanityTest {
|
class ScaffoldSanityTest {
|
||||||
@Test
|
@Test
|
||||||
@@ -18,8 +21,7 @@ class ScaffoldSanityTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun buildConfigIsDebuggableInTest() {
|
fun versionNameIsSet() {
|
||||||
// Unit tests run against the debug variant.
|
assertTrue(BuildConfig.VERSION_NAME.isNotBlank())
|
||||||
assertTrue(BuildConfig.DEBUG)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user