mirror of
https://github.com/square/okhttp.git
synced 2026-01-14 07:22:20 +03:00
469 lines
12 KiB
YAML
469 lines
12 KiB
YAML
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: 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
|
|
|
|
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: Run Checks
|
|
uses: gradle/gradle-build-action@v2
|
|
with:
|
|
arguments: check -x test
|
|
|
|
- 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'
|
|
|
|
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: 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'
|
|
|
|
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: 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'
|
|
|
|
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: 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, 'jdk8')
|
|
|
|
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: 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, 'jdk8')
|
|
|
|
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: 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: 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, '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: 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: 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: 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, 'jdk17')
|
|
|
|
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: Run Checks
|
|
uses: gradle/gradle-build-action@v2
|
|
with:
|
|
arguments: jvmTest -Dtest.java.version=17
|
|
|
|
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: 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: Build okcurl
|
|
uses: gradle/gradle-build-action@v2
|
|
env:
|
|
USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM: false
|
|
with:
|
|
arguments: okcurl:nativeImage
|
|
|
|
- name: Build ConsoleLauncher
|
|
uses: gradle/gradle-build-action@v2
|
|
env:
|
|
USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM: false
|
|
with:
|
|
arguments: -PgraalBuild 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')
|
|
|
|
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: 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 :okhttp-android:connectedCheck :android-test:connectedCheck
|
|
env:
|
|
API_LEVEL: ${{ matrix.api-level }}
|
|
|
|
|
|
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: 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 :regression-test:connectedCheck
|
|
env:
|
|
API_LEVEL: ${{ matrix.api-level }}
|