Skip to content

Commit

Permalink
Run tests parallelly on CI (#1787)
Browse files Browse the repository at this point in the history
* Run tests parallelly on CI

Revert some changes in 2ba00cd to save more time on CI.

* Update CHANGELOG

* Configure jvmTarget in compilerOptions

---------

Co-authored-by: Paul Dingemans <pdingemans@bol.com>
  • Loading branch information
Goooler and Paul Dingemans authored Jan 30, 2023
1 parent 37f40b6 commit 2aa83e1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 45 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/gradle-pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
jdk: [ 8, 11, 17, 19 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 19
java-version: ${{ matrix.jdk }}
- uses: gradle/gradle-build-action@v2
- name: Build with release Kotlin version
run: ./gradlew clean build ktlint --no-daemon
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).

### Changed

* Revert to matrix build to speed up build, especially for the Windows related build ([#1786](https://github.com/pinterest/ktlint/pull/1787))

## [0.48.2] - 2023-01-21

### Additional clarification on API Changes in `0.48.0` and `0.48.1`
Expand Down
39 changes: 0 additions & 39 deletions build-logic/src/main/kotlin/ToolchainForTests.kt

This file was deleted.

13 changes: 8 additions & 5 deletions build-logic/src/main/kotlin/ktlint-kotlin-common.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm")
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}

// All modules, the CLI included, must have an explicit API
explicitApi()
}

addAdditionalJdkVersionTests()
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}
14 changes: 14 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ allprojects {
} else {
logger.warn("Skipping tests for task '$name' as system property 'skipTests=$skipTests'")
}

val args = mutableSetOf<String>()
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_16)) {
// https://docs.gradle.org/7.5/userguide/upgrading_version_7.html#removes_implicit_add_opens_for_test_workers
args += listOf(
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
)
}
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_18)) {
// https://openjdk.org/jeps/411
args += "-Djava.security.manager=allow"
}
jvmArgs(args)
}
}

Expand Down

0 comments on commit 2aa83e1

Please sign in to comment.