diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eb265481..763ac646 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,8 @@ name: Java CI +env: + RUN_FROM: GHA + on: [push] jobs: diff --git a/src/test/kotlin/no/rodland/advent/TestMisc.kt b/src/test/kotlin/no/rodland/advent/TestMisc.kt index 512a6b08..2cdcd352 100644 --- a/src/test/kotlin/no/rodland/advent/TestMisc.kt +++ b/src/test/kotlin/no/rodland/advent/TestMisc.kt @@ -8,6 +8,8 @@ import org.junit.jupiter.api.extension.ExtensionContext import kotlin.system.measureTimeMillis import kotlin.time.measureTimedValue +val GHA = System.getenv("RUN_FROM") == "GHA" + fun report(function: () -> Pair) { getHeader().run { println(this) @@ -123,8 +125,8 @@ fun defaultTestSuiteParseOnCall( numTestPart1: Int = 10, numTestPart2: Int = 10, ) = AOCTestSuite( - AOCTest(part1, liveData, livePart1, numTestPart1, day = day, part = Part.ONE, live = true), - AOCTest(part2, liveData, livePart2, numTestPart2, day = day, part = Part.TWO, live = true), + AOCTest(part1, liveData, livePart1, if (GHA) 1 else numTestPart1, day = day, part = Part.ONE, live = true), + AOCTest(part2, liveData, livePart2, if (GHA) 1 else numTestPart2, day = day, part = Part.TWO, live = true), AOCTest(part1, testData, testPart1, 1, day, part = Part.ONE, live = false), AOCTest(part2, testData, testPart2, 1, day, part = Part.TWO, live = false), AOCTest(part1, liveData, livePart1, 1, day = day, part = Part.ONE, live = true), @@ -146,12 +148,12 @@ fun defaultTestSuiteParseOnInit( numInitLive: Int = 100, numInitTest: Int = 100, ) = AOCTestSuite( - AOCTest({ liveDay.partOne() }, Unit, livePart1, numTestPart1, liveDay.day, Part.ONE, true), - AOCTest({ liveDay.partTwo() }, Unit, livePart2, numTestPart2, liveDay.day, Part.TWO, true), + AOCTest({ liveDay.partOne() }, Unit, livePart1, if (GHA) 1 else numTestPart1, liveDay.day, Part.ONE, true), + AOCTest({ liveDay.partTwo() }, Unit, livePart2, if (GHA) 1 else numTestPart2, liveDay.day, Part.TWO, true), AOCTest({ testDay.partOne() }, Unit, testPart1, 1, liveDay.day, Part.ONE, false), AOCTest({ testDay.partTwo() }, Unit, testPart2, 1, liveDay.day, Part.TWO, false), - AOCTest({ initLive() }, Unit, Unit, numInitLive, liveDay.day, Part.INIT, live = true), - AOCTest({ initTest() }, Unit, Unit, numInitTest, liveDay.day, Part.INIT, live = false), + AOCTest({ initLive() }, Unit, Unit, numInitLive, if (GHA) 1 else liveDay.day, Part.INIT, live = true), + AOCTest({ initTest() }, Unit, Unit, numInitTest, if (GHA) 1 else liveDay.day, Part.INIT, live = false), )