-
Notifications
You must be signed in to change notification settings - Fork 268
Clean up CI annotations and surface sccache stats from cibuildwheel #1879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1a0a753
Suppress pip cache and root-user warnings in Linux container CI jobs
leofang c938310
Move PIP_ROOT_USER_ACTION from container.env to job-level env
leofang bd7f5c0
Revert PIP_ROOT_USER_ACTION changes (ineffective for setup-python)
leofang 38416ad
Bump actions/cache to v5.0.4 (node24) and disable sccache annotations
leofang e5b7d53
Bump doc_preview actions to node24-compatible versions
leofang 5984786
Add sccache-summary action and surface container stats in job summary
leofang a3f9a2b
Fix sccache hit rate calculation and add step link hint
leofang f4ed3f3
Remove build-step input from sccache-summary action
leofang e7b7766
Revert "Remove build-step input from sccache-summary action"
leofang 3b0730e
Merge remote-tracking branch 'origin/main' into ci/suppress-pip-warnings
leofang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| name: sccache summary | ||
| description: Parse sccache stats JSON and write a summary table to GITHUB_STEP_SUMMARY | ||
|
|
||
| # Inspired by NVIDIA/cccl's prepare-execution-summary.py (PR #3621). | ||
| # Only counts C/C++ and CUDA language hits (excludes PTX/CUBIN which are | ||
| # not included in sccache's compile_requests counter). | ||
|
|
||
| inputs: | ||
| json-file: | ||
| description: "Path to the sccache stats JSON file (from sccache --show-stats --stats-format=json)" | ||
| required: true | ||
| label: | ||
| description: "Label for the stats row (e.g. cuda.bindings, cuda.core)" | ||
| required: false | ||
| default: "sccache" | ||
| build-step: | ||
| description: "Name of the cibuildwheel build step (for deep-link in summary)" | ||
| required: false | ||
| default: "" | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Report sccache stats | ||
| shell: bash --noprofile --norc -euo pipefail {0} | ||
| env: | ||
| SCCACHE_JSON: ${{ inputs.json-file }} | ||
| SCCACHE_LABEL: ${{ inputs.label }} | ||
| SCCACHE_BUILD_STEP: ${{ inputs.build-step }} | ||
| run: | | ||
| if [ ! -f "$SCCACHE_JSON" ]; then | ||
| echo "::warning::sccache stats file not found: $SCCACHE_JSON" | ||
| exit 0 | ||
| fi | ||
|
|
||
| python3 - <<'PYEOF' | ||
| import json, os, urllib.parse | ||
|
|
||
| json_file = os.environ["SCCACHE_JSON"] | ||
| label = os.environ["SCCACHE_LABEL"] | ||
| build_step = os.environ.get("SCCACHE_BUILD_STEP", "") | ||
|
|
||
| with open(json_file) as f: | ||
| stats = json.load(f)["stats"] | ||
|
|
||
| # compile_requests includes non-compilation calls (linker, etc). | ||
| # Use cache_hits + cache_misses as the denominator to match sccache's | ||
| # own "Cache hits rate" which only counts actual compilation requests. | ||
| counted_languages = {"C/C++", "CUDA"} | ||
| hits = sum( | ||
| v for k, v in stats.get("cache_hits", {}).get("counts", {}).items() | ||
| if k in counted_languages | ||
| ) | ||
| misses = sum( | ||
| v for k, v in stats.get("cache_misses", {}).get("counts", {}).items() | ||
| if k in counted_languages | ||
| ) | ||
| total = hits + misses | ||
| pct = int(100 * hits / total) if total > 0 else 0 | ||
|
|
||
| # Build a deep-link to the cibuildwheel step if step name is provided. | ||
| # GHA step summary links use the format: #step:N:L but we can't know the | ||
| # step number here. Instead, link to the job page with a search hint. | ||
| link_note = "" | ||
| if build_step: | ||
| link_note = f"\n\n_Full stats in the **{build_step}** step log._\n" | ||
|
|
||
| summary_file = os.environ.get("GITHUB_STEP_SUMMARY", "") | ||
| if summary_file: | ||
| with open(summary_file, "a") as sf: | ||
| sf.write(f"### 📊 {label} — sccache stats\n") | ||
| sf.write("| Hit Rate | Hits | Misses | Requests |\n") | ||
| sf.write("|----------|------|--------|----------|\n") | ||
| sf.write(f"| {pct}% | {hits} | {misses} | {total} |{link_note}\n") | ||
|
|
||
| print(f"{label}: {pct}% hit rate ({hits}/{total})") | ||
| PYEOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.