|
27 | 27 | -DGODOTCPP_ENABLE_TESTING=ON |
28 | 28 | -DGODOTCPP_BUILD_PROFILE="test/build_profile.json" |
29 | 29 | SCCACHE_GHA_ENABLED: "true" |
| 30 | + DEBUG_BUILD_START: "" |
| 31 | + RELEASE_BUILD_START: "" |
30 | 32 |
|
31 | 33 | strategy: |
32 | 34 | fail-fast: false |
@@ -155,17 +157,31 @@ jobs: |
155 | 157 | rm -rf test/project/bin/libgdexample.macos.template_debug.framework |
156 | 158 | rm -rf test/project/bin/libgdexample.macos.template_release.framework |
157 | 159 |
|
| 160 | + # Configure and build the debug target with CMake |
158 | 161 | - 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 }} |
160 | 166 |
|
161 | 167 | - 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 |
163 | 172 |
|
| 173 | + # Configure and build the release target with CMake |
164 | 174 | - 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 }} |
166 | 179 |
|
167 | 180 | - 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 |
169 | 185 |
|
170 | 186 | - name: Download latest Godot artifacts |
171 | 187 | uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9 |
@@ -204,21 +220,71 @@ jobs: |
204 | 220 | path: ${{ matrix.artifact-path }} |
205 | 221 | if-no-files-found: error |
206 | 222 |
|
207 | | - - name: Show sccache statistics (Markdown table) |
| 223 | + - name: Show build and sccache statistics |
208 | 224 | if: always() |
209 | 225 | shell: bash |
210 | 226 | run: | |
211 | 227 | { |
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 |
223 | 287 | } >> "$GITHUB_STEP_SUMMARY" || true |
| 288 | +
|
| 289 | + # Stop sccache server (ignore errors) |
224 | 290 | "${SCCACHE_PATH}" --stop-server || true |
0 commit comments