Fix gradle module nesting (#7984) #3772
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: [opened, labeled, unlabeled, synchronize] | |
permissions: | |
contents: read | |
env: | |
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false" | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
if: github.repository == 'square/okhttp' && github.ref == 'refs/heads/master' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Upload Artifacts | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: clean publish --stacktrace | |
env: | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }} | |
validation: | |
name: "Validation" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: gradle/wrapper-validation-action@v1 | |
- name: Validate Renovate | |
uses: rinchsan/[email protected] | |
with: | |
pattern: '.github/renovate.json' | |
checkjdk11: | |
permissions: | |
checks: write # for mikepenz/action-junit-report | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run Checks | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: check -PandroidBuild=true -PgraalBuild=true -x test -x jvmTest -x jsTest | |
testopenjdk11: | |
permissions: | |
checks: write # for mikepenz/action-junit-report | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run Checks | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jvmTest -Dtest.java.version=11 | |
- name: Publish Test Report | |
if: github.repository == 'square/okhttp' && github.ref == 'refs/heads/master' | |
uses: mikepenz/action-junit-report@v3 | |
with: | |
report_paths: '**/build/test-results/*/TEST-*.xml' | |
check_name: OpenJDK 11 Test Report | |
testjs: | |
permissions: | |
checks: write # for mikepenz/action-junit-report | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run Checks | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jsTest | |
- name: Publish Test Report | |
if: success() || failure() | |
uses: mikepenz/action-junit-report@v3 | |
with: | |
report_paths: '**/build/test-results/test/TEST-*.xml' | |
check_name: JS Test Report | |
testzulu11: | |
runs-on: ubuntu-latest | |
if: contains(github.event.pull_request.labels.*.name, 'zulu') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run Checks | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jvmTest -Dtest.java.version=11 | |
testopenjdk8: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'jdkversions') || contains(github.event.pull_request.labels.*.name, 'renovate') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run Checks | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jvmTest -Dtest.java.version=8 | |
testopenjdk8alpn: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'jdkversions') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install Old JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 8.0.242 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run Checks | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jvmTest -Dtest.java.version=8 -Dokhttp.platform=jdk8alpn -Dalpn.boot.version=8.1.13.v20181017 -Dorg.gradle.java.installations.paths=/opt/hostedtoolcache/Java_Adopt_jdk/8.0.242-8.1/x64 | |
testopenjsse: | |
runs-on: ubuntu-latest | |
if: contains(github.event.pull_request.labels.*.name, 'providers') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run Checks | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jvmTest -Dtest.java.version=8 -Dokhttp.platform=openjsse | |
testconscrypt: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'conscrypt') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run Checks | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jvmTest -Dokhttp.platform=conscrypt | |
testbouncycastle: | |
runs-on: ubuntu-latest | |
if: contains(github.event.pull_request.labels.*.name, 'providers') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run Checks | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jvmTest -Dokhttp.platform=bouncycastle | |
testcorretto: | |
runs-on: ubuntu-latest | |
# TODO add master build after fixing all tests in CI | |
if: contains(github.event.pull_request.labels.*.name, 'providers') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run Checks | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jvmTest -Dokhttp.platform=corretto | |
testopenjdk17: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'jdkversions') || contains(github.event.pull_request.labels.*.name, 'renovate') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run Checks | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jvmTest -Dtest.java.version=17 | |
testopenjdk19: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'jdkversions') || contains(github.event.pull_request.labels.*.name, 'renovate') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 19 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run Checks | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jvmTest -Dtest.java.version=19 | |
testwindows: | |
runs-on: windows-latest | |
# TODO add master build after fixing all tests in CI | |
if: contains(github.event.pull_request.labels.*.name, 'windows') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Test | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jvmTest | |
testgraal: | |
runs-on: ubuntu-latest | |
# TODO add master build after fixing all tests in CI | |
if: contains(github.event.pull_request.labels.*.name, 'graal') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Build okcurl | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: okcurl:nativeImage | |
- name: Build ConsoleLauncher | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: -PgraalBuild=true native-image-tests:nativeImage | |
- name: Run Checks | |
run: ./native-image-tests/build/graal/ConsoleLauncher | |
testandroid: | |
runs-on: macos-latest | |
timeout-minutes: 30 | |
if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'android') || contains(github.event.pull_request.labels.*.name, 'renovate') | |
strategy: | |
fail-fast: false | |
matrix: | |
api-level: | |
- 21 | |
- 29 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Gradle cache | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: -PandroidBuild=true :okhttp-android:test | |
- name: AVD cache | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }} | |
- name: Create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
script: echo "Generated AVD snapshot for caching." | |
- name: Run Tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
script: ./gradlew -PandroidBuild=true :okhttp-android:connectedCheck :android-test:connectedCheck | |
env: | |
API_LEVEL: ${{ matrix.api-level }} | |
testloom: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'loom') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 20 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run Checks | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: jvmTest -Dokhttp.platform=loom -Dtest.java.version=20 | |
testandroidregression: | |
runs-on: macos-latest | |
timeout-minutes: 10 | |
if: contains(github.event.pull_request.labels.*.name, 'android-regression') | |
strategy: | |
fail-fast: false | |
matrix: | |
api-level: | |
- 29 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Configure JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Gradle cache | |
uses: gradle/gradle-build-action@v2 | |
- name: AVD cache | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }} | |
- name: Create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
script: echo "Generated AVD snapshot for caching." | |
- name: Run Tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
script: ./gradlew -PandroidBuild=true :regression-test:connectedCheck | |
env: | |
API_LEVEL: ${{ matrix.api-level }} |