Update CI/build infra (#1852)

* Update CI/build infra

- Gradle caching on CI
- JDK 21
- Move gradle wrapper validation to a separate workflow that only runs on changes to those files

* Update .github/workflows/gradle-wrapper.yml

Co-authored-by: Jake Wharton <jw@squareup.com>

---------

Co-authored-by: Jake Wharton <jw@squareup.com>
This commit is contained in:
Zac Sweers
2024-06-03 22:27:27 -04:00
committed by GitHub
parent ce7abc3e5c
commit d98b143dac
5 changed files with 23 additions and 7 deletions

View File

@@ -16,16 +16,16 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Configure JDK - name: Configure JDK
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:
distribution: 'zulu' distribution: 'zulu'
java-version: '20' java-version: '21'
cache: 'gradle' cache: 'gradle'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Test - name: Test
run: ./gradlew build check --stacktrace -PkotlinTestMode=${{ matrix.kotlin-test-mode }} run: ./gradlew build check --stacktrace -PkotlinTestMode=${{ matrix.kotlin-test-mode }}

15
.github/workflows/gradle-wrapper.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: gradle-wrapper
on:
pull_request:
paths:
- 'gradlew'
- 'gradlew.bat'
- 'gradle/wrapper/**'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3

View File

@@ -77,7 +77,7 @@ subprojects {
pluginManager.withPlugin("java") { pluginManager.withPlugin("java") {
configure<JavaPluginExtension> { configure<JavaPluginExtension> {
toolchain { toolchain {
languageVersion.set(JavaLanguageVersion.of(20)) languageVersion.set(libs.versions.jdk.map(JavaLanguageVersion::of))
} }
} }
if (project.name != "records-tests") { if (project.name != "records-tests") {

View File

@@ -1,5 +1,6 @@
[versions] [versions]
autoService = "1.1.1" autoService = "1.1.1"
jdk = "21"
jvmTarget = "1.8" jvmTarget = "1.8"
kotlin = "2.0.0" kotlin = "2.0.0"
# No 0.5.0 full release yet due to KSP's 1.0.21 release being busted for CLI/programmatic use # No 0.5.0 full release yet due to KSP's 1.0.21 release being busted for CLI/programmatic use

View File

@@ -19,11 +19,11 @@ val java16: SourceSet by sourceSets.creating {
} }
} }
// We use JDK 17 for latest but target 16 for maximum compatibility // We use newer JDKs but target 16 for maximum compatibility
val service = project.extensions.getByType<JavaToolchainService>() val service = project.extensions.getByType<JavaToolchainService>()
val customLauncher = val customLauncher =
service.launcherFor { service.launcherFor {
languageVersion.set(JavaLanguageVersion.of(17)) languageVersion.set(libs.versions.jdk.map(JavaLanguageVersion::of))
} }
tasks.named<JavaCompile>("compileJava16Java") { tasks.named<JavaCompile>("compileJava16Java") {