Skip to content

Commit 3bfb2bc

Browse files
committed
more complicated summary
1 parent dd5f2a6 commit 3bfb2bc

File tree

1 file changed

+82
-16
lines changed

1 file changed

+82
-16
lines changed

.github/workflows/ci-cmake.yml

Lines changed: 82 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
-DGODOTCPP_ENABLE_TESTING=ON
2828
-DGODOTCPP_BUILD_PROFILE="test/build_profile.json"
2929
SCCACHE_GHA_ENABLED: "true"
30+
DEBUG_BUILD_START: ""
31+
RELEASE_BUILD_START: ""
3032

3133
strategy:
3234
fail-fast: false
@@ -155,17 +157,31 @@ jobs:
155157
rm -rf test/project/bin/libgdexample.macos.template_debug.framework
156158
rm -rf test/project/bin/libgdexample.macos.template_release.framework
157159
160+
# Configure and build the debug target with CMake
158161
- name: Configure godot-cpp-test with template_debug
159-
run: cmake --log-level=VERBOSE -S . -B cmake-build ${{ env.config-flags }} ${{ matrix.config-flags }}
162+
id: configure-debug
163+
run: |
164+
echo "DEBUG_BUILD_START=$(date +%s)" >> $GITHUB_ENV
165+
cmake --log-level=VERBOSE -S . -B cmake-build ${{ env.config-flags }} ${{ matrix.config-flags }}
160166
161167
- name: Build godot-cpp-test (template_debug)
162-
run: cmake --build cmake-build --verbose --target godot-cpp-test ${{ matrix.build-flags }}
168+
id: build-debug
169+
run: |
170+
cmake --build cmake-build --verbose --target godot-cpp-test ${{ matrix.build-flags }}
171+
echo "DEBUG_BUILD_END=$(date +%s)" >> $GITHUB_ENV
163172
173+
# Configure and build the release target with CMake
164174
- name: Configure godot-cpp-test with template_release
165-
run: cmake --fresh --log-level=VERBOSE -S . -B cmake-build -DGODOTCPP_TARGET=template_release ${{ env.config-flags }} ${{ matrix.config-flags }}
175+
id: configure-release
176+
run: |
177+
echo "RELEASE_BUILD_START=$(date +%s)" >> $GITHUB_ENV
178+
cmake --fresh --log-level=VERBOSE -S . -B cmake-build -DGODOTCPP_TARGET=template_release ${{ env.config-flags }} ${{ matrix.config-flags }}
166179
167180
- name: Build godot-cpp-test (template_release)
168-
run: cmake --build cmake-build --verbose --target godot-cpp-test ${{ matrix.build-flags }}
181+
id: build-release
182+
run: |
183+
cmake --build cmake-build --verbose --target godot-cpp-test ${{ matrix.build-flags }}
184+
echo "RELEASE_BUILD_END=$(date +%s)" >> $GITHUB_ENV
169185
170186
- name: Download latest Godot artifacts
171187
uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9
@@ -204,21 +220,71 @@ jobs:
204220
path: ${{ matrix.artifact-path }}
205221
if-no-files-found: error
206222

207-
- name: Show sccache statistics (Markdown table)
223+
- name: Show build and sccache statistics
208224
if: always()
209225
shell: bash
210226
run: |
211227
{
212-
echo "## 📊 sccache Statistics"
213-
echo
214-
echo "| Metric | Value |"
215-
echo "|--------|-------|"
216-
"${SCCACHE_PATH}" --show-stats 2>/dev/null | awk '
217-
/^[A-Za-z]/ {
218-
gsub(/^[ \t]+|[ \t]+$/, "");
219-
gsub(/[ \t]{2,}/, "|");
220-
print "| " $0 " |";
221-
}
222-
'
228+
echo "## 📊 Build & Cache Statistics"
229+
230+
# === Build Times ===
231+
echo ""
232+
echo "### ⏱️ Build Times"
233+
echo ""
234+
echo "| Target | Duration |"
235+
echo "|---------------------|----------|"
236+
237+
debug_duration=$((DEBUG_BUILD_END - DEBUG_BUILD_START))
238+
release_duration=$((RELEASE_BUILD_END - RELEASE_BUILD_START))
239+
240+
echo "| template_debug | ${debug_duration}s |"
241+
echo "| template_release | ${release_duration}s |"
242+
echo ""
243+
244+
# === Extract sccache stats ===
245+
STATS=$("${SCCACHE_PATH}" --show-stats 2>/dev/null || echo "")
246+
247+
if [ -n "$STATS" ]; then
248+
REQUESTS=$(echo "$STATS" | grep -oP 'Compile requests\s+\K\d+' || echo "0")
249+
HITS=$(echo "$STATS" | grep -oP 'Cache hits\s+\K\d+' || echo "0")
250+
MISSES=$(echo "$STATS" | grep -oP 'Cache misses\s+\K\d+' || echo "0")
251+
252+
if [ "$REQUESTS" -gt 0 ]; then
253+
HIT_RATE=$(awk "BEGIN {printf \"%.2f\", ($HITS / $REQUESTS) * 100}")
254+
else
255+
HIT_RATE="0.00"
256+
fi
257+
258+
# Prominent summary
259+
echo "### ✅ Cache Summary"
260+
echo ""
261+
echo "**sccache hit rate: ${HIT_RATE}%** (${HITS}/${REQUESTS} requests cached)"
262+
if [ "$MISSES" -eq 0 ]; then
263+
echo "✅ **Perfect cache hit** — no cache misses!"
264+
else
265+
echo "⚠️ **${MISSES} cache miss(es)**"
266+
fi
267+
echo ""
268+
269+
# Collapsible full stats
270+
echo "<details>"
271+
echo "<summary>📈 Full sccache Statistics</summary>"
272+
echo ""
273+
echo "| Metric | Value |"
274+
echo "|--------|-------|"
275+
echo "$STATS" | awk '
276+
/^[A-Za-z]/ {
277+
gsub(/^[ \t]+|[ \t]+$/, "");
278+
gsub(/[ \t]{2,}/, "|");
279+
print "| " $0 " |";
280+
}
281+
'
282+
echo ""
283+
echo "</details>"
284+
else
285+
echo "**sccache statistics not available**"
286+
fi
223287
} >> "$GITHUB_STEP_SUMMARY" || true
288+
289+
# Stop sccache server (ignore errors)
224290
"${SCCACHE_PATH}" --stop-server || true

0 commit comments

Comments
 (0)