Skip to content

Commit

Permalink
Skip tests inside build
Browse files Browse the repository at this point in the history
  • Loading branch information
gabfssilva committed Feb 28, 2024
1 parent d410401 commit 7966ef7
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 64 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and assembly
name: Build monorepo

on:
workflow_call:
Expand All @@ -9,15 +9,18 @@ permissions:

jobs:
build:
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Build
uses: gradle/gradle-build-action@v3
with:
arguments: build -x test

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build monorepo
run: ./gradlew build -PskipTests=true
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ jobs:
name: Run all River's modules tests
uses: ./.github/workflows/test.yml
build:
needs: test
name: Build all monorepo
uses: ./.github/workflows/build.yml
release:
name: Release all River's modules to Maven Central
needs: build
needs: [test, build]
uses: ./.github/workflows/release.yml
secrets:
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Assembly
uses: gradle/gradle-build-action@v3
with:
Expand Down
45 changes: 0 additions & 45 deletions .github/workflows/test-module.yml

This file was deleted.

29 changes: 25 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)

import com.adarshr.gradle.testlogger.TestLoggerExtension
import com.adarshr.gradle.testlogger.theme.ThemeType
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.dokka.gradle.AbstractDokkaTask
import org.jetbrains.kotlin.cli.common.toBooleanLenient
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

Expand All @@ -13,6 +16,7 @@ plugins {
alias(libs.plugins.dokka)
alias(libs.plugins.nexus.publish) apply false
alias(libs.plugins.os.detector)
alias(libs.plugins.test.logger) apply false

`maven-publish`
signing
Expand Down Expand Up @@ -48,6 +52,7 @@ subprojects {
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "signing")
apply(plugin = "com.google.osdetector")
apply(plugin = "com.adarshr.test-logger")

version = rootProject.libs.versions.river.get()
group = "com.river-kt"
Expand All @@ -57,13 +62,29 @@ subprojects {
google()
}

configure<TestLoggerExtension> {
theme = ThemeType.MOCHA
showExceptions = true
showStackTraces = true
showFullStackTraces = false
showCauses = true
slowThreshold = 10000
showSummary = true
showSimpleNames = false
showPassed = true
showSkipped = true
showFailed = true
showStandardStreams = false
showPassedStandardStreams = true
showSkippedStandardStreams = true
showFailedStandardStreams = true
logLevel = LogLevel.LIFECYCLE
}

tasks.withType<Test>().configureEach {
useJUnitPlatform()

testLogging {
showStandardStreams = true
exceptionFormat = TestExceptionFormat.FULL
}
onlyIf { !skipTests() }
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
Expand Down
3 changes: 3 additions & 0 deletions buildSrc/src/main/kotlin/Ext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ inline fun Project.androidApp(crossinline configure: AppExtension.() -> Unit) {
extensions.configure<AppExtension> { configure() }
}
}

fun Project.skipTests(): Boolean =
"${properties["skipTests"] ?: "false"}".toBooleanStrict()
13 changes: 11 additions & 2 deletions connectors/format/csv/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@ kotlin {
mingwX64()

js(IR) {
browser()
nodejs()
browser {
testTask {
onlyIf { !skipTests() }
}
}

nodejs {
testTask {
onlyIf { !skipTests() }
}
}
}

androidTarget {
Expand Down
13 changes: 11 additions & 2 deletions connectors/format/positional-flat-line/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@ kotlin {
mingwX64()

js(IR) {
browser()
nodejs()
browser {
testTask {
onlyIf { !skipTests() }
}
}

nodejs {
testTask {
onlyIf { !skipTests() }
}
}
}

androidTarget {
Expand Down
13 changes: 11 additions & 2 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@ kotlin {
mingwX64()

js(IR) {
browser()
nodejs()
browser {
testTask {
onlyIf { !skipTests() }
}
}

nodejs {
testTask {
onlyIf { !skipTests() }
}
}
}

androidTarget {
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
org.gradle.jvmargs=-Xmx4096M
kotlin.mpp.androidSourceSetLayoutVersion=2
org.gradle.caching=true
org.gradle.configureondemand=true
3 changes: 3 additions & 0 deletions libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ os-detector = "1.7.3"
android-compile-sdk = "30"
desugar-jdk-libs = "2.0.3"
mockk = "1.13.9"
test-logger = "4.0.0"

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
Expand All @@ -56,6 +57,8 @@ nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version = "1.3.0

os-detector = { id = "com.google.osdetector", version.ref = "os-detector" }

test-logger = { id = "com.adarshr.test-logger", version.ref = "test-logger" }

[libraries]
# kotlin
coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
Expand Down

0 comments on commit 7966ef7

Please sign in to comment.