Update actions/setup-java action to v4.5.0 #977
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 ] | |
env: | |
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false" | |
JAVA_VERSION: 11 | |
ANDROID_API_LEVEL: 23 | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
pull-requests: write | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v4.2.1 | |
- name: Validate Gradle Wrapper | |
uses: gradle/actions/wrapper-validation@v4 | |
- name: Configure JDK ${{ env.JAVA_VERSION }} | |
uses: actions/setup-java@v4.5.0 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JAVA_VERSION }} | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
gradle-home-cache-cleanup: true | |
- run: ./gradlew --version | |
- name: Run Ktlint Check On All Sources | |
run: ./gradlew ktlintCheck -s | |
- name: Run Build and Unit Tests | |
run: ./gradlew build -s | |
- name: Publish to maven local to run instrumentation tests | |
run: rm -rf ~/.m2/repository/com/jaredsburrows/gradle-spoon-plugin/ && ./gradlew publishToMavenLocal -x test -s | |
- 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 | |
- name: Create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2.33.0 | |
with: | |
api-level: ${{ env.ANDROID_API_LEVEL }} | |
arch: x86_64 | |
target: google_apis | |
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 Instrumentation Tests on Android API ${{ env.ANDROID_API_LEVEL }} | |
uses: reactivecircus/android-emulator-runner@v2.33.0 | |
with: | |
api-level: ${{ env.ANDROID_API_LEVEL }} | |
arch: x86_64 | |
target: google_apis | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot-save | |
disable-animations: true | |
script: cd test-app && ../gradlew clean spoonDebugAndroidTest checkReports -s && cd .. | |
- name: Publish Test Report | |
uses: EnricoMi/publish-unit-test-result-action@v2.17.1 | |
if: always() | |
with: | |
comment_mode: off | |
files: '**/build/test-results/test/TEST-*.xml' | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4.4.3 | |
if: github.repository == 'jaredsburrows/gradle-spoon-plugin' && github.ref == 'refs/heads/master' | |
with: | |
name: gradle-spoon-plugin-${{ github.workflow }}-${{ github.run_id }} | |
path: | | |
build/libs | |
build/outputs | |
build/publications | |
build/distributions | |
build/reports | |
build/test-results | |
publish: | |
name: Publish Snapshot | |
runs-on: ubuntu-latest | |
if: github.repository == 'jaredsburrows/gradle-spoon-plugin' && github.ref == 'refs/heads/master' | |
needs: | |
- build | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v4.2.1 | |
- name: Validate Gradle Wrapper | |
uses: gradle/actions/wrapper-validation@v4 | |
- name: Configure JDK ${{ env.JAVA_VERSION }} | |
uses: actions/setup-java@v4.5.0 | |
with: | |
distribution: temurin | |
java-version: ${{ env.JAVA_VERSION }} | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
gradle-home-cache-cleanup: true | |
- run: ./gradlew --version | |
- name: Publish | |
run: ./gradlew publish -s -i | |
env: | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} |