Skip to content

Commit

Permalink
Start adding CI features
Browse files Browse the repository at this point in the history
  • Loading branch information
ds58 committed Sep 23, 2024
1 parent 9056f2a commit 4b15dbe
Show file tree
Hide file tree
Showing 7 changed files with 643 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ dependencies {
api("com.hierynomus:sshj:0.38.0")

testApi("org.junit.jupiter:junit-jupiter-api:5.10.3")
testApi("org.junit.platform:junit-platform-console:1.10.3")

testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.3")
}

Expand Down
6 changes: 6 additions & 0 deletions src/main/kotlin/us/ihmc/ci/AllocationInstrumenter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package us.ihmc.ci

class AllocationInstrumenter(val version: String)
{
fun instrumenter(): String = "com.google.code.java-allocation-instrumenter:java-allocation-instrumenter:$version"
}
45 changes: 45 additions & 0 deletions src/main/kotlin/us/ihmc/ci/IHMCCICategoriesExtension.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package us.ihmc.ci

import org.gradle.api.Project

val ALLOCATION_AGENT_KEY = "allocationAgent"

class IHMCCICategory(val name: String)
{
var forkEvery = 0 // no limit
var maxParallelForks = 1 // careful, cost of spawning JVMs is high
var junit5ParallelEnabled = false // doesn't work right now with Gradle's test runner. See: https://github.com/gradle/gradle/issues/6453
var junit5ParallelStrategy = "fixed"
var junit5ParallelFixedParallelism = 1
val excludeTags = hashSetOf<String>()
val includeTags = hashSetOf<String>()
val jvmProperties = hashMapOf<String, String>()
val jvmArguments = hashSetOf<String>()
var minHeapSizeGB = 1
var maxHeapSizeGB = 4
var enableAssertions = true
var defaultTimeout = 1200 // 20 minutes
var testTaskTimeout = 1800 // 30 minutes
var doFirst: () -> Unit = {} // run user code when this category is selected
}

open class IHMCCICategoriesExtension(private val project: Project)
{
val categories = hashMapOf<String, IHMCCICategory>()

fun configure(name: String, configuration: IHMCCICategory.() -> Unit)
{
configuration.invoke(configure(name))
}

fun configure(name: String): IHMCCICategory
{
val category = categories.getOrPut(name, { IHMCCICategory(name) })
if (name != "all" && name != "fast") // all require no includes or excludes, fast will be configured later
{
category.includeTags += name // by default, include tags of the category name
}

return category
}
}
48 changes: 48 additions & 0 deletions src/main/kotlin/us/ihmc/ci/IHMCCILogTools.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package us.ihmc.ci

import org.gradle.api.GradleException
import org.gradle.api.logging.Logger

class IHMCCILogTools(val logger: Logger)
{
fun quiet(message: Any)
{
logger.quiet(ihmcBuildMessage(message))
}

fun info(message: Any)
{
logger.info(ihmcBuildMessage(message))
}

fun warn(message: Any)
{
logger.warn(ihmcBuildMessage(message))
}

fun error(message: Any)
{
logger.error(ihmcBuildMessage(message))
}

fun debug(message: Any)
{
logger.debug(ihmcBuildMessage(message))
}

fun trace(trace: Any)
{
logger.trace(trace.toString())
}

fun crash(message: Any)
{
error(message)
throw GradleException("[ihmc-ci] " + message as String)
}

private fun ihmcBuildMessage(message: Any): String
{
return "[ihmc-ci] " + message
}
}
Loading

0 comments on commit 4b15dbe

Please sign in to comment.