Skip to content

Commit

Permalink
Update CI/build infra (#1852)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
ZacSweers and JakeWharton committed Jun 4, 2024
1 parent ce7abc3 commit d98b143
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Configure JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '20'
java-version: '21'
cache: 'gradle'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Test
run: ./gradlew build check --stacktrace -PkotlinTestMode=${{ matrix.kotlin-test-mode }}

Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/gradle-wrapper.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ subprojects {
pluginManager.withPlugin("java") {
configure<JavaPluginExtension> {
toolchain {
languageVersion.set(JavaLanguageVersion.of(20))
languageVersion.set(libs.versions.jdk.map(JavaLanguageVersion::of))
}
}
if (project.name != "records-tests") {
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[versions]
autoService = "1.1.1"
jdk = "21"
jvmTarget = "1.8"
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
Expand Down
4 changes: 2 additions & 2 deletions moshi/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 customLauncher =
service.launcherFor {
languageVersion.set(JavaLanguageVersion.of(17))
languageVersion.set(libs.versions.jdk.map(JavaLanguageVersion::of))
}

tasks.named<JavaCompile>("compileJava16Java") {
Expand Down

0 comments on commit d98b143

Please sign in to comment.