Skip to content

Commit 28dac73

Browse files
committed
Add basic benchmark action and fix spotless
1 parent 24f140f commit 28dac73

File tree

4 files changed

+73
-5
lines changed

4 files changed

+73
-5
lines changed

.github/workflows/benchmark.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"jobs": {
3+
"build": {
4+
"runs-on": "ubuntu-22.04",
5+
"steps": [
6+
{
7+
"name": "Setup Java",
8+
"run": "echo \"JAVA_HOME=$JAVA_HOME_21_X64\" >> \"$GITHUB_ENV\""
9+
},
10+
{
11+
"with": {
12+
"fetch-depth": "0",
13+
"persist-credentials": "false"
14+
},
15+
"name": "Checkout",
16+
"uses": "actions/checkout@v4"
17+
},
18+
{
19+
"name": "Validate Gradle Wrapper",
20+
"uses": "gradle/actions/wrapper-validation@v3"
21+
},
22+
{
23+
"with": {
24+
"path": "**/.gradle/loom-cache\n**/.gradle/quilt-loom-cache",
25+
"key": "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}",
26+
"restore-keys": "${{ runner.os }}-gradle-"
27+
},
28+
"name": "Cache",
29+
"uses": "actions/cache/restore@v4"
30+
},
31+
{
32+
"with": {
33+
"cache-read-only": true,
34+
"gradle-home-cache-cleanup": true
35+
},
36+
"name": "Setup Gradle",
37+
"uses": "gradle/actions/setup-gradle@v3"
38+
},
39+
{
40+
"name": "JMH",
41+
"run": "./gradlew jmh",
42+
"id": "jmh",
43+
"env": {
44+
"BUILD_CACHE_PASSWORD": "${{ secrets.BUILD_CACHE_PASSWORD }}",
45+
"BUILD_CACHE_USER": "${{ secrets.BUILD_CACHE_USER }}",
46+
"BUILD_CACHE_URL": "${{ secrets.BUILD_CACHE_URL }}"
47+
}
48+
}
49+
]
50+
}
51+
},
52+
"name": "Benchmark",
53+
"concurrency": "ci-${{ github.ref }}",
54+
"on": {
55+
"workflow_dispatch": {
56+
57+
}
58+
}
59+
}

.github/workflows/publish_pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545
"concurrency": "ci-${{ github.ref }}",
4646
"on": {
4747
"workflow_run": {
48-
"workflows": [
49-
"Build PR"
50-
],
5148
"types": [
5249
"completed"
50+
],
51+
"workflows": [
52+
"Build PR"
5353
]
5454
}
5555
}

build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ managedVersioning {
2424
mavenSnapshot('github')
2525
}
2626
}
27+
benchmark {
28+
prettyName.set 'Benchmark'
29+
workflowDispatch.set(true)
30+
gradleJob {
31+
buildCache()
32+
javaVersion.set '21'
33+
name.set 'build'
34+
gradlew 'JMH', 'jmh'
35+
}
36+
}
2737
release {
2838
prettyName.set 'Release'
2939
workflowDispatch.set(true)

src/main/java/dev/lukebemish/codecextras/KeyedRecordCodecBuilder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
import com.mojang.serialization.MapLike;
88
import com.mojang.serialization.RecordBuilder;
99
import com.mojang.serialization.codecs.RecordCodecBuilder;
10-
import org.jetbrains.annotations.ApiStatus;
11-
1210
import java.util.ArrayList;
1311
import java.util.List;
1412
import java.util.function.BiFunction;
1513
import java.util.function.Function;
1614
import java.util.stream.Stream;
15+
import org.jetbrains.annotations.ApiStatus;
1716

1817
/**
1918
* Similar to {@link ExtendedRecordCodecBuilder}, an alternative to {@link RecordCodecBuilder} that allows for any

0 commit comments

Comments
 (0)