Merge pull request #4117 from square/jw.public-optional.2024-03-27 #1305
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: | |
pull_request: {} | |
workflow_dispatch: {} | |
push: | |
branches: | |
- 'trunk' | |
tags-ignore: | |
- '**' | |
env: | |
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false" | |
jobs: | |
jvm: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 21 | |
- uses: gradle/actions/setup-gradle@v3 | |
- name: Test | |
run: ./gradlew build --stacktrace | |
android: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
api-level: | |
- 21 | |
- 24 | |
- 26 | |
- 29 | |
steps: | |
- name: Enable KVM group perms | |
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 | |
ls /dev/kvm | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 21 | |
- uses: gradle/actions/setup-gradle@v3 | |
- name: Run Tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
script: ./gradlew connectedCheck --stacktrace | |
env: | |
API_LEVEL: ${{ matrix.api-level }} | |
robovm: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 21 | |
- uses: gradle/actions/setup-gradle@v3 | |
- name: Run Tests | |
run: ./gradlew retrofit:robovm-test:robovmTest --stacktrace | |
publish: | |
runs-on: ubuntu-latest | |
if: github.repository == 'square/retrofit' && github.ref == 'refs/heads/trunk' | |
needs: | |
- jvm | |
- android | |
- robovm | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 21 | |
- uses: gradle/actions/setup-gradle@v3 | |
- name: Upload Artifacts | |
run: ./gradlew publish --stacktrace | |
env: | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} |