Skip to content

Commit 6656a3e

Browse files
authored
Split tests by year for github Actions (#296)
1 parent 6f5a2e8 commit 6656a3e

File tree

2 files changed

+21
-20
lines changed

2 files changed

+21
-20
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,25 @@ on:
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
total_shard_count: [11]
15+
shard_number: ['2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024', '2025']
1216

1317
steps:
1418
- name: Checkout Main AoC code
1519
uses: actions/checkout@v6
1620

17-
- name: Checkout the AoC Input files
21+
- name: Checkout The AoC Input Files
1822
uses: actions/checkout@v6
1923
with:
2024
token: ${{ secrets.AOC_INPUT }}
2125
repository: peckb1/advent-of-code-input
2226
path: advent-of-code-input
2327
ref: main
2428

25-
- name: Bring in the gradle wrapper running the build
26-
uses: gradle/wrapper-validation-action@v3
29+
- name: Bring In Gradle Wrapper
30+
uses: gradle/actions/wrapper-validation@v4
2731

2832
- name: Set up JDK 21
2933
uses: actions/setup-java@v5
@@ -34,20 +38,5 @@ jobs:
3438
- name: Grant execute permission for gradlew
3539
run: chmod +x gradlew
3640

37-
- name: Build with Gradle jacocoTestReport
38-
run: ./gradlew --no-daemon build
39-
40-
- name: Publish Unit Test Results
41-
uses: EnricoMi/publish-unit-test-result-action@v2
42-
if: always()
43-
with:
44-
files: build/test-results/**/*.xml
45-
46-
- name: Add coverage to PR
47-
id: jacoco
48-
uses: madrapps/[email protected]
49-
with:
50-
paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
51-
token: ${{ secrets.GITHUB_TOKEN }}
52-
min-coverage-overall: 40
53-
min-coverage-changed-files: 60
41+
- name: Build with Gradle jacocoTestReport for year ${{ matrix.shard_number }}
42+
run: ./gradlew --no-daemon build -Pyear=${{ matrix.shard_number }}

build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,18 @@ dependencies {
5151
}
5252

5353
tasks.test {
54+
filter {
55+
val year: String? = project.findProperty("year") as? String
56+
if (year != null) {
57+
includeTestsMatching("me.peckb.aoc._${year}.*")
58+
}
59+
}
60+
5461
useJUnitPlatform()
5562
testLogging {
5663
events("SKIPPED", "FAILED", "STANDARD_OUT", "STANDARD_ERROR")
5764
exceptionFormat = FULL
65+
showStandardStreams = true
5866
}
5967
finalizedBy(tasks.jacocoTestReport)
6068
maxParallelForks = ((Runtime.getRuntime().availableProcessors() / 3.0) * 2.0).toInt()
@@ -68,6 +76,10 @@ tasks.jacocoTestReport {
6876
classDirectories.setFrom(files(classDirectories.files.map {
6977
fileTree(it) {
7078
exclude("**/skeleton/**", "**/Application*")
79+
val year: String? = project.findProperty("year") as? String
80+
if (year != null) {
81+
include("**/_${year}/**")
82+
}
7183
}
7284
}))
7385
}

0 commit comments

Comments
 (0)