Skip to content

Commit

Permalink
Run tests on all LTS JDKs but only build on 17 (#1453)
Browse files Browse the repository at this point in the history
* Run CI on java 17

* Run tests on all LTS JDKs

* Cleanup

* Increase jvm heap size

* Remove PR limit & Correct upload actions
  • Loading branch information
Goooler authored May 5, 2022
1 parent 3472532 commit 2ba00cd
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 22 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/gradle-pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: PR Build

on:
pull_request:
branches: [ master ]

jobs:
build:
Expand All @@ -15,23 +14,16 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 8
java-version: 17
- uses: gradle/gradle-build-action@v2
- name: Build with release Kotlin version
run: ./gradlew clean build ktlint
- name: Upload dependency verification report
uses: actions/upload-artifact@v3
if: failure()
with:
name: Build artifacts
path: '**/build/**/dependency-verification-report.html'
if-no-files-found: warn
- name: Upload test results
uses: actions/upload-artifact@v3
if: failure()
with:
name: Test artifacts
path: '**/tests/**/*.html'
path: 'ktlint/build/reports/tests/**'
if-no-files-found: warn
- name: Build with dev Kotlin version
run: ./gradlew -PkotlinDev clean build ktlint
2 changes: 1 addition & 1 deletion .github/workflows/gradle-snapshot-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 8
java-version: 17
- uses: gradle/gradle-build-action@v2
- name: Publish snapshot to Maven
run: ./gradlew clean publishMavenPublicationToMavenCentralRepository --no-daemon --no-parallel
Expand Down
6 changes: 0 additions & 6 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ plugins {
`kotlin-dsl`
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}

repositories {
mavenCentral()
}
Expand Down
7 changes: 3 additions & 4 deletions buildSrc/src/main/kotlin/ToolchainForTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ val Project.javaToolchains: JavaToolchainService

fun Project.addAdditionalJdkVersionTests() {
// Tests should be run on all supported LTS versions of the JDK. For example, see https://endoflife.date/java
addJdkVersionTests("testOnJdk11", 11)
addJdkVersionTests("testOnJdk17", 17)
arrayOf(8, 11, 17).forEach(::addJdkVersionTests)
}

private fun Project.addJdkVersionTests(taskName: String, jdkVersion: Int) {
val jdkVersionTests = tasks.register<Test>(taskName) {
private fun Project.addJdkVersionTests(jdkVersion: Int) {
val jdkVersionTests = tasks.register<Test>("testOnJdk$jdkVersion") {
javaLauncher.set(
javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(jdkVersion))
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ POM_DEVELOPER_ID=pinterest
POM_DEVELOPER_NAME=Pinterest, Inc.

# Gradle properties
org.gradle.jvmargs=-Xmx768m
org.gradle.jvmargs=-Xmx4g
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.vfs.watch=true
Expand Down

0 comments on commit 2ba00cd

Please sign in to comment.