Skip to content

Commit 3464c1b

Browse files
committedMar 2, 2023
test against all supported versions of the JVM
configure pagefile for tests in windows
1 parent 33a2194 commit 3464c1b

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed
 

‎.github/workflows/build-and-check.yml

+20-4
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,36 @@ on:
99
- main
1010

1111
jobs:
12+
build-jvm-matrix:
13+
runs-on: ubuntu-latest
14+
steps: # https://michaelheap.com/dynamic-matrix-generation-github-actions/
15+
- id: set-matrix
16+
run: echo "::set-output name=version_matrix::$(curl https://endoflife.date/api/java.json | jq -c '[.[] | select(.eol > (now | strftime("%Y-%m-%d"))) | .cycle]' | sed 's/ //g')"
17+
- name: verify-matrix
18+
run: echo "The selected java versions are ${{ steps.set-matrix.outputs.version_matrix }}"
19+
outputs:
20+
version_matrix: ${{ steps.set-matrix.outputs.version_matrix }}
1221
build:
22+
needs: build-jvm-matrix
1323
strategy:
1424
fail-fast: false
1525
matrix:
1626
os: [ubuntu-latest, windows-latest]
17-
# Windows is failing with "out of memory" errors.
18-
continue-on-error: ${{ matrix.os == 'windows-latest' }}
27+
java_version: ${{ fromJson(needs.build-jvm-matrix.outputs.version_matrix) }}
1928
runs-on: ${{ matrix.os }}
2029
steps:
2130
- uses: actions/checkout@v2
22-
- name: set up JDK 1.8
31+
- name: configure windows pagefile
32+
if: ${{ matrix.os == 'windows-latest' }}
33+
uses: al-cheb/configure-pagefile-action@v1.2
34+
with:
35+
minimum-size: 8GB
36+
maximum-size: 8GB
37+
disk-root: "D:"
38+
- name: set up JDK
2339
uses: actions/setup-java@v2
2440
with:
25-
java-version: 8
41+
java-version: ${{ matrix.java_version }}
2642
distribution: 'zulu'
2743
- name: Restore Gradle caches
2844
uses: actions/cache@v2

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
1313
- add ktlint version 0.48.2 to testing [#632](https://github.com/JLLeitschuh/ktlint-gradle/pull/632)
1414
- update latest gradle version for testing to 7.6 [#632](https://github.com/JLLeitschuh/ktlint-gradle/pull/632)
1515
- improve release process to update VERSION_LATEST_RELEASE automatically [#631](https://github.com/JLLeitschuh/ktlint-gradle/pull/631)
16+
- test against all supported jvm versions [#642](https://github.com/JLLeitschuh/ktlint-gradle/pull/642)
1617

1718
## [11.2.0] - 2023-02-14
1819

‎plugin/build.gradle.kts

+5-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ tasks.named("test").configure {
8383

8484
tasks.withType<Test>().configureEach {
8585
useJUnitPlatform()
86-
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
86+
maxParallelForks = if (org.codehaus.plexus.util.Os.isFamily(org.codehaus.plexus.util.Os.FAMILY_WINDOWS)) {
87+
(Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
88+
} else {
89+
(Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
90+
}
8791
doFirst {
8892
logger.lifecycle("maxParallelForks for '$path' is $maxParallelForks")
8993
}

0 commit comments

Comments
 (0)