1- name : JDK cache benchmark dispatcher
1+ name : Focused cache restore
22
33on :
44 workflow_dispatch :
55 inputs :
6+ samples :
7+ description : Warm restore samples per version
8+ required : true
9+ type : choice
10+ options :
11+ - " 2"
12+ - " 6"
13+ - " 10"
14+ - " 20"
15+ default : " 10"
616 cleanup-caches :
717 description : Delete benchmark caches after measuring them
818 required : true
@@ -13,8 +23,156 @@ permissions:
1323 actions : write
1424 contents : read
1525
26+ env :
27+ JAVA_VERSION : 17.0.19+10
28+ DEPENDENCY_FIXTURE_MIB : " 160"
29+ WRAPPER_FIXTURE_MIB : " 9"
30+
31+ concurrency :
32+ group : focused-cache-restore
33+ cancel-in-progress : false
34+
1635jobs :
17- benchmark :
18- uses : actions/setup-java-benchmarks/.github/workflows/jdk-cache.yml@brunoborges-benchmark-jdk-cache
19- with :
20- cleanup-caches : ${{ inputs.cleanup-caches }}
36+ v4-seed :
37+ name : Seed v4 cache
38+ runs-on : ubuntu-24.04
39+ steps :
40+ - name : Check out benchmark repository
41+ uses : actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
42+ with :
43+ persist-credentials : false
44+ - name : Prepare cache identity
45+ env :
46+ BENCHMARK_ID : focused-v4-${{ github.run_id }}
47+ run : |
48+ printf '%s\n' "$BENCHMARK_ID" > .focused-cache-key
49+ mkdir -p .mvn/wrapper
50+ printf 'wrapperVersion=focused\n# benchmark-id=%s\n' "$BENCHMARK_ID" > .mvn/wrapper/maven-wrapper.properties
51+ - name : Setup Java v4
52+ uses : actions/setup-java@v4.8.0
53+ with :
54+ distribution : temurin
55+ java-version : ${{ env.JAVA_VERSION }}
56+ cache : maven
57+ cache-dependency-path : .focused-cache-key
58+ - name : Create synthetic cache fixtures
59+ run : |
60+ mkdir -p ~/.m2/repository/focused-benchmark
61+ head -c "$((DEPENDENCY_FIXTURE_MIB * 1024 * 1024))" /dev/urandom > ~/.m2/repository/focused-benchmark/dependencies.bin &
62+ wait
63+
64+ main-seed :
65+ name : Seed main caches
66+ runs-on : ubuntu-24.04
67+ steps :
68+ - name : Check out benchmark repository
69+ uses : actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
70+ with :
71+ persist-credentials : false
72+ - name : Prepare cache identity
73+ env :
74+ BENCHMARK_ID : focused-main-${{ github.run_id }}
75+ run : |
76+ printf '%s\n' "$BENCHMARK_ID" > .focused-cache-key
77+ mkdir -p .mvn/wrapper
78+ printf 'wrapperVersion=focused\n# benchmark-id=%s\n' "$BENCHMARK_ID" > .mvn/wrapper/maven-wrapper.properties
79+ - name : Setup Java main
80+ uses : actions/setup-java@main
81+ with :
82+ distribution : temurin
83+ java-version : ${{ env.JAVA_VERSION }}
84+ cache : maven
85+ cache-dependency-path : .focused-cache-key
86+ - name : Create synthetic cache fixtures
87+ run : |
88+ mkdir -p ~/.m2/repository/focused-benchmark
89+ mkdir -p ~/.m2/wrapper/dists/focused-benchmark
90+ head -c "$((DEPENDENCY_FIXTURE_MIB * 1024 * 1024))" /dev/urandom > ~/.m2/repository/focused-benchmark/dependencies.bin &
91+ head -c "$((WRAPPER_FIXTURE_MIB * 1024 * 1024))" /dev/urandom > ~/.m2/wrapper/dists/focused-benchmark/wrapper.bin &
92+ wait
93+
94+ v4-measure :
95+ name : v4 / warm / ${{ matrix.sample }}
96+ needs : v4-seed
97+ runs-on : ubuntu-24.04
98+ strategy :
99+ fail-fast : false
100+ matrix :
101+ sample : ${{ fromJSON(inputs.samples == '20' && '[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]' || inputs.samples == '10' && '[1,2,3,4,5,6,7,8,9,10]' || inputs.samples == '6' && '[1,2,3,4,5,6]' || '[1,2]') }}
102+ steps :
103+ - name : Check out benchmark repository
104+ uses : actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
105+ with :
106+ persist-credentials : false
107+ - name : Prepare cache identity
108+ env :
109+ BENCHMARK_ID : focused-v4-${{ github.run_id }}
110+ run : |
111+ printf '%s\n' "$BENCHMARK_ID" > .focused-cache-key
112+ mkdir -p .mvn/wrapper
113+ printf 'wrapperVersion=focused\n# benchmark-id=%s\n' "$BENCHMARK_ID" > .mvn/wrapper/maven-wrapper.properties
114+ - name : Setup Java v4
115+ uses : actions/setup-java@v4.8.0
116+ with :
117+ distribution : temurin
118+ java-version : ${{ env.JAVA_VERSION }}
119+ cache : maven
120+ cache-dependency-path : .focused-cache-key
121+ - name : Verify restored fixtures
122+ run : |
123+ test "$(wc -c < ~/.m2/repository/focused-benchmark/dependencies.bin)" -eq "$((DEPENDENCY_FIXTURE_MIB * 1024 * 1024))"
124+
125+ main-measure :
126+ name : main / warm / ${{ matrix.sample }}
127+ needs : main-seed
128+ runs-on : ubuntu-24.04
129+ strategy :
130+ fail-fast : false
131+ matrix :
132+ sample : ${{ fromJSON(inputs.samples == '20' && '[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]' || inputs.samples == '10' && '[1,2,3,4,5,6,7,8,9,10]' || inputs.samples == '6' && '[1,2,3,4,5,6]' || '[1,2]') }}
133+ steps :
134+ - name : Check out benchmark repository
135+ uses : actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
136+ with :
137+ persist-credentials : false
138+ - name : Prepare cache identity
139+ env :
140+ BENCHMARK_ID : focused-main-${{ github.run_id }}
141+ run : |
142+ printf '%s\n' "$BENCHMARK_ID" > .focused-cache-key
143+ mkdir -p .mvn/wrapper
144+ printf 'wrapperVersion=focused\n# benchmark-id=%s\n' "$BENCHMARK_ID" > .mvn/wrapper/maven-wrapper.properties
145+ - name : Setup Java main
146+ uses : actions/setup-java@main
147+ with :
148+ distribution : temurin
149+ java-version : ${{ env.JAVA_VERSION }}
150+ cache : maven
151+ cache-dependency-path : .focused-cache-key
152+ - name : Verify restored fixtures
153+ run : |
154+ test "$(wc -c < ~/.m2/repository/focused-benchmark/dependencies.bin)" -eq "$((DEPENDENCY_FIXTURE_MIB * 1024 * 1024))"
155+ test "$(wc -c < ~/.m2/wrapper/dists/focused-benchmark/wrapper.bin)" -eq "$((WRAPPER_FIXTURE_MIB * 1024 * 1024))"
156+
157+ report :
158+ name : Report
159+ needs : [v4-measure, main-measure]
160+ if : ${{ always() && !cancelled() }}
161+ runs-on : ubuntu-24.04
162+ steps :
163+ - name : Check out benchmark repository
164+ uses : actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
165+ with :
166+ persist-credentials : false
167+ - name : Generate focused report
168+ env :
169+ GH_TOKEN : ${{ github.token }}
170+ SAMPLES : ${{ inputs.samples }}
171+ CLEANUP_CACHES : ${{ inputs.cleanup-caches }}
172+ run : node scripts/report-focused.mjs
173+ - name : Upload benchmark results
174+ uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
175+ with :
176+ name : focused-cache-restore-${{ github.run_id }}
177+ path : focused-results/
178+ retention-days : 30
0 commit comments