Skip to content
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4f8e286
Testing ECH in Android Platform
yschimke Jan 16, 2026
e21fd68
More testing
yschimke Jan 16, 2026
8b062b8
Fixes
yschimke Jan 16, 2026
292d40a
Merge branch 'master' into testing_ech
yschimke Mar 15, 2026
5b46c86
Fixes
yschimke Mar 15, 2026
7e08fcb
Fixes
yschimke Mar 15, 2026
9692d67
Fixes
yschimke Mar 15, 2026
7ec38bf
Fixes
yschimke Mar 15, 2026
33c62cd
More fixes
yschimke Mar 16, 2026
2ea576e
More fixes
yschimke Mar 16, 2026
cc06a75
More fixes
yschimke Mar 16, 2026
cbecbaa
More fixes
yschimke Mar 16, 2026
487bc99
Refactor
yschimke Mar 17, 2026
2d8237e
Merge branch 'master' into testing_ech
yschimke Apr 4, 2026
7029d12
Android API 37
yschimke Apr 4, 2026
ae060bb
Testing with robolectric also
yschimke Apr 5, 2026
dc0f8ca
Merge branch 'master' into testing_ech
yschimke Apr 30, 2026
1a05f84
More fixes
yschimke Apr 30, 2026
e034658
Fix ECH branch CI failures
yschimke May 4, 2026
04f4a43
Avoid AGP source set cast for android tests
yschimke May 4, 2026
8702756
Permit localhost cleartext in Android tests
yschimke May 4, 2026
ffe3d69
Document ECH public APIs
yschimke May 4, 2026
b2652bb
Harden Android ECH support
yschimke May 4, 2026
ccde3d3
Temporarily focus CI on Android API 37
yschimke May 4, 2026
1b74946
Use explicit adb path for Android 37 CI
yschimke May 4, 2026
d71c148
Fix Android 37 cleanup workflow syntax
yschimke May 4, 2026
1fb1f76
Split Android 37 CI into separate job
yschimke May 4, 2026
5febd47
Wait for Android 37 package services
yschimke May 4, 2026
b890bb3
Try Android 37 Play Store system image
yschimke May 4, 2026
ec7e36d
Isolate Android 37 emulator job
yschimke May 4, 2026
892472b
Initialize OkHttp in public suffix Android test
yschimke May 4, 2026
72742fe
Re-enable regular build jobs
yschimke May 4, 2026
8cd005f
Restore conditional build job gates
yschimke May 4, 2026
994fe6f
Pin Android 37 workflow actions
yschimke May 4, 2026
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
133 changes: 122 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
validation:
name: "Validation"
runs-on: ubuntu-latest
if: false
steps:
- uses: actions/checkout@v6
- uses: gradle/actions/wrapper-validation@v5
Expand All @@ -58,6 +59,7 @@
permissions:
checks: write # for mikepenz/action-junit-report
runs-on: ubuntu-latest
if: false

steps:
- name: Checkout
Expand Down Expand Up @@ -88,6 +90,7 @@
permissions:
checks: write # for mikepenz/action-junit-report
runs-on: ubuntu-latest
if: false
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -131,7 +134,7 @@

openjdk8alpn:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'jdkversions')
if: false

steps:
- name: Checkout
Expand All @@ -157,7 +160,7 @@

providers:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'providers')
if: false
strategy:
matrix:
include:
Expand Down Expand Up @@ -190,6 +193,7 @@

openjdklatest:
runs-on: ubuntu-latest
if: false

steps:
- name: Checkout
Expand Down Expand Up @@ -243,6 +247,7 @@

testwindows:
runs-on: windows-latest
if: false

steps:
- name: Checkout
Expand All @@ -262,6 +267,7 @@

graal:
runs-on: ubuntu-latest
if: false

steps:
- name: Checkout
Expand Down Expand Up @@ -299,11 +305,19 @@
strategy:
fail-fast: false
matrix:
api-level:
- 21
- 23
- 29
- 34
include:
- api-level: 21
arch: x86
target: default
- api-level: 23
arch: x86
target: default
- api-level: 29
arch: x86
target: default
- api-level: 34
arch: x86_64
target: default

steps:
- name: Checkout
Expand Down Expand Up @@ -338,7 +352,7 @@
uses: actions/cache@v5
id: avd-cache
with:
key: avd-${{ runner.os }}-${{ matrix.api-level }}-${{ matrix.api-level >= 30 && 'x86_64' || 'x86' }}
key: avd-${{ runner.os }}-${{ matrix.api-level }}-${{ matrix.target }}-${{ matrix.arch }}
path: |
~/.android/avd/*
~/.android/adb*
Expand All @@ -351,7 +365,9 @@
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
arch: ${{ matrix.api-level >= 30 && 'x86_64' || 'x86' }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
emulator-boot-timeout: 1200
# No window, no audio, and use swiftshader for headless environments
emulator-options: >
-no-window
Expand All @@ -367,16 +383,110 @@
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: ${{ matrix.api-level == '34' && 'x86_64' || 'x86' }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
emulator-boot-timeout: 1200
# Match the snapshot creation options. The action default includes -no-snapshot,
# which forces a slow cold boot.
emulator-options: >
-no-window
-gpu swiftshader_indirect
-noaudio

Check failure

Code scanning / zizmor

unpinned action reference Error

unpinned action reference

Check failure

Code scanning / Semgrep OSS

Insecure GitHub Actions: Third-Party Action Not Pinned to Commit SHA Error

Insecure GitHub Actions: Third-Party Action Not Pinned to Commit SHA
-no-boot-anim
-camera-back none
-memory 2048
script: ./gradlew -PandroidBuild=true connectedCheck
env:
API_LEVEL: ${{ matrix.api-level }}

- name: Build Release App
run: ./gradlew android-test-app:lint android-test-app:assembleRelease

android37:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Configure JDK
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 21

- name: Enable KVM group perms
# https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: Verify KVM
run: |
sudo apt-get install -y cpu-checker
kvm-ok || echo "KVM is not accelerated"
kvm-ok || exit 1

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5

- name: Gradle cache
run: ./gradlew :android-test:test

- name: Run Android 37 Tests
run: |
SDKMANAGER="$(find "$ANDROID_HOME/cmdline-tools" -path '*/bin/sdkmanager' | sort | tail -n 1)"
AVDMANAGER="$(find "$ANDROID_HOME/cmdline-tools" -path '*/bin/avdmanager' | sort | tail -n 1)"
ADB="$ANDROID_HOME/platform-tools/adb"
EMULATOR="$ANDROID_HOME/emulator/emulator"
export ANDROID_AVD_HOME="$HOME/.android/avd"
mkdir -p "$ANDROID_AVD_HOME"

yes | "$SDKMANAGER" --licenses > /dev/null
"$SDKMANAGER" --install \
'build-tools;36.0.0' \
platform-tools \
'platforms;android-37.0' \
emulator \
'system-images;android-37.0;google_apis_ps16k;x86_64' \
--channel=0 > /dev/null

printf 'no\n' | "$AVDMANAGER" create avd \
--force \
--name test \
--package 'system-images;android-37.0;google_apis_ps16k;x86_64'

"$AVDMANAGER" list avd

"$EMULATOR" \
-port 5554 \
-avd test \
-no-window \
-gpu swiftshader_indirect \
-no-snapshot \
-noaudio \
-no-boot-anim \
-camera-back none \
-memory 2048 &

"$ADB" -s emulator-5554 wait-for-device
timeout 1200 bash -c 'until [[ "$("$1" -s emulator-5554 shell getprop sys.boot_completed | tr -d "\r")" == "1" ]]; do sleep 2; done' -- "$ADB"
timeout 300 bash -c 'until "$1" -s emulator-5554 shell service check input | grep -q "found"; do sleep 2; done' -- "$ADB"

./gradlew -PandroidBuild=true connectedCheck
env:
API_LEVEL: 37.0

- name: Stop Android 37 Emulator
if: always()
run: |
"$ANDROID_HOME/platform-tools/adb" -s emulator-5554 emu kill || true

loom:
runs-on: ubuntu-latest
if: false

steps:
- name: Checkout
Expand All @@ -398,6 +508,7 @@

maven:
runs-on: ubuntu-latest
if: false

steps:
- name: Checkout
Expand All @@ -421,6 +532,7 @@

java9_modules:
runs-on: ubuntu-latest
if: false

steps:
- name: Checkout
Expand All @@ -440,4 +552,3 @@

- name: Run with Jlink
run: ./gradlew module-tests:imageRun -PokhttpModuleTests=true

9 changes: 4 additions & 5 deletions android-test-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
@file:Suppress("UnstableApiUsage")

import okhttp3.buildsupport.testJavaVersion


plugins {
id("okhttp.base-conventions")
id("com.android.application")
}

android {
compileSdk = 36
compileSdk {
version = release(37)
}

namespace = "okhttp.android.testapp"

Expand All @@ -18,7 +17,7 @@ android {

defaultConfig {
minSdk = 21
targetSdk = 36
targetSdk = 37
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down
35 changes: 23 additions & 12 deletions android-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ plugins {
}

android {
compileSdk = 36
compileSdk {
version = release(37)
}

namespace = "okhttp.android.test"

Expand All @@ -24,26 +26,16 @@ android {
)
}

if (androidBuild) {
sourceSets["androidTest"].java.srcDirs(
"../okhttp-brotli/src/test/java",
"../okhttp-dnsoverhttps/src/test/java",
"../okhttp-logging-interceptor/src/test/java",
"../okhttp-sse/src/test/java"
)
}

compileOptions {
targetCompatibility(JavaVersion.VERSION_11)
sourceCompatibility(JavaVersion.VERSION_11)
}

testOptions {
targetSdk = 34
targetSdk = 37
unitTests.isIncludeAndroidResources = true
}


// issue merging due to conflict with httpclient and something else
packagingOptions.resources.excludes += setOf(
"META-INF/DEPENDENCIES",
Expand All @@ -55,11 +47,25 @@ android {
)
}

if (androidBuild) {
androidComponents {
onVariants(selector().all()) { variant ->
variant.androidTest?.sources?.java?.apply {
addStaticSourceDirectory("../okhttp-brotli/src/test/java")
addStaticSourceDirectory("../okhttp-dnsoverhttps/src/test/java")
addStaticSourceDirectory("../okhttp-logging-interceptor/src/test/java")
addStaticSourceDirectory("../okhttp-sse/src/test/java")
}
}
}
}

dependencies {
implementation(libs.kotlin.reflect)
implementation(libs.playservices.safetynet)
"friendsImplementation"(projects.okhttp)
"friendsImplementation"(projects.okhttpDnsoverhttps)
implementation(libs.androidx.activity)

testImplementation(projects.okhttp)
testImplementation(libs.junit)
Expand Down Expand Up @@ -114,3 +120,8 @@ junitPlatform {
excludeTags("Remote")
}
}

tasks.withType<Test> {
// Fix for robolectric https://github.com/robolectric/robolectric/pull/10996
jvmArgs("--add-opens", "java.base/jdk.internal.access=ALL-UNNAMED")
}
Loading
Loading