Compare commits

...

3 commits

Author SHA1 Message Date
e5cb0bd903 Replaced jvmToolChain with Kotlin/Java compile options 2023-08-07 09:17:03 -07:00
57eb20a160
Merge pull request #9 from ethauvin/update/gh-workflow
update Gradle Build workflow
2023-08-07 08:56:34 -07:00
Adam
cdb0176560 update Gradle Build workflow 2023-08-07 12:00:23 +02:00
2 changed files with 53 additions and 18 deletions

View file

@ -1,22 +1,34 @@
name: gradle-ci name: gradle-ci
on: [ push, pull_request, workflow_dispatch ] on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
jobs: jobs:
build: build:
runs-on: ubuntu-latest
env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m"
strategy: strategy:
matrix: matrix:
java-version: [ 11, 17, 20 ] java-version: [ 11, 17, 20 ]
os:
- macos-latest
- ubuntu-latest
- windows-latest
fail-fast: false
runs-on: ${{ matrix.os }}
env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m"
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }} - name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3 uses: actions/setup-java@v3
@ -24,10 +36,19 @@ jobs:
distribution: 'zulu' distribution: 'zulu'
java-version: ${{ matrix.java-version }} java-version: ${{ matrix.java-version }}
- name: Grant execute permission for gradlew - name: Validate Gradle wrapper
run: chmod +x gradlew uses: gradle/wrapper-validation-action@v1
- name: Cache Kotlin Konan
id: cache-kotlin-konan
uses: actions/cache@v3
with:
path: |
~/.konan/**/*
key: kotlin-konan-${{ runner.os }}
- name: Test with Gradle - name: Test with Gradle
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
with: with:
gradle-home-cache-cleanup: true
arguments: build check --stacktrace -PtestsBadgeApiKey=${{ secrets.TESTS_BADGE_API_KEY }} arguments: build check --stacktrace -PtestsBadgeApiKey=${{ secrets.TESTS_BADGE_API_KEY }}

View file

@ -3,7 +3,10 @@ package buildsrc.conventions.lang
import buildsrc.utils.Rife2TestListener import buildsrc.utils.Rife2TestListener
import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
/** /**
@ -22,7 +25,7 @@ plugins {
kotlin { kotlin {
jvmToolchain(11) //jvmToolchain(11)
targets.configureEach { targets.configureEach {
compilations.configureEach { compilations.configureEach {
@ -49,11 +52,22 @@ kotlin {
} }
} }
tasks.withType<Test>().configureEach { tasks {
val testsBadgeApiKey = providers.gradleProperty("testsBadgeApiKey") withType<JavaCompile>().configureEach {
addTestListener(Rife2TestListener(testsBadgeApiKey)) sourceCompatibility = JavaVersion.VERSION_11.toString()
testLogging { targetCompatibility = JavaVersion.VERSION_11.toString()
exceptionFormat = TestExceptionFormat.FULL
events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
} }
}
withType<KotlinJvmCompile>().configureEach {
compilerOptions.jvmTarget.set(JvmTarget.JVM_11)
}
withType<Test>().configureEach {
val testsBadgeApiKey = providers.gradleProperty("testsBadgeApiKey")
addTestListener(Rife2TestListener(testsBadgeApiKey))
testLogging {
exceptionFormat = TestExceptionFormat.FULL
events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
}
}
}