Skip to content

Commit fc418fc

Browse files
authored
Merge pull request #73 from mdabir1203/codex/add-profile-metrics-to-github-actions-display2025-11-05-vruqhl
[actions] chore: explain profiling cache behavior
2 parents 025022d + 903b15a commit fc418fc

3 files changed

Lines changed: 65 additions & 4 deletions

File tree

.github/workflows/codeprofiling.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ jobs:
1616

1717
- uses: dtolnay/rust-toolchain@stable
1818
- uses: Swatinem/rust-cache@v2
19+
id: rust_cache
20+
with:
21+
shared-key: profiling
22+
23+
- name: Note cache status
24+
env:
25+
CACHE_HIT: ${{ steps.rust_cache.outputs.cache-hit }}
26+
run: |
27+
echo "### Build cache" >> "$GITHUB_STEP_SUMMARY"
28+
echo >> "$GITHUB_STEP_SUMMARY"
29+
if [ "$CACHE_HIT" = "true" ]; then
30+
echo "Using cached cargo artifacts for hotpath profiling run." >> "$GITHUB_STEP_SUMMARY"
31+
else
32+
echo "Cache miss for hotpath profiling job. This is normal on the first run for a branch or after toolchain changes; the next run will populate the cache." >> "$GITHUB_STEP_SUMMARY"
33+
fi
1934
2035
- id: head_timing_metrics
2136
run: |

.github/workflows/slsa-release.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,21 @@ jobs:
7171
7272
- name: Package binaries
7373
run: |
74+
set -euo pipefail
7475
mkdir -p dist
75-
tar -czf dist/shadowmap-${GITHUB_REF_NAME}.tar.gz -C target/release shadowmap
76-
sha256sum dist/* > dist/shadowmap-${GITHUB_REF_NAME}.sha256
76+
umask 0022
77+
GZIP=-n tar \
78+
--sort=name \
79+
--mtime='@0' \
80+
--owner=0 \
81+
--group=0 \
82+
--numeric-owner \
83+
-czf dist/shadowmap-${GITHUB_REF_NAME}.tar.gz \
84+
-C target/release shadowmap
85+
(
86+
cd dist
87+
sha256sum shadowmap-${GITHUB_REF_NAME}.tar.gz > shadowmap-${GITHUB_REF_NAME}.sha256
88+
)
7789
7890
- name: Generate SBOM
7991
uses: anchore/sbom-action@e812a0fdf0d83f33cd9ba7f8c4ce3e9e2f8d2c9d
@@ -140,9 +152,21 @@ jobs:
140152
141153
- name: Package reproducibility outputs
142154
run: |
155+
set -euo pipefail
143156
mkdir -p dist
144-
tar -czf dist/shadowmap-${GITHUB_REF_NAME}.tar.gz -C target/release shadowmap
145-
sha256sum dist/* > dist/shadowmap-${GITHUB_REF_NAME}.sha256
157+
umask 0022
158+
GZIP=-n tar \
159+
--sort=name \
160+
--mtime='@0' \
161+
--owner=0 \
162+
--group=0 \
163+
--numeric-owner \
164+
-czf dist/shadowmap-${GITHUB_REF_NAME}.tar.gz \
165+
-C target/release shadowmap
166+
(
167+
cd dist
168+
sha256sum shadowmap-${GITHUB_REF_NAME}.tar.gz > shadowmap-${GITHUB_REF_NAME}.sha256
169+
)
146170
147171
- name: Upload rebuild artifacts
148172
uses: actions/upload-artifact@c7d6c3d5c0f8b7b2e07c5e6c5a9a7d1e2b9db4c4

docs/hotpath-profiling-overview.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Hotpath Profiling Workflow Overview
2+
3+
The `hotpath-profile` GitHub Actions workflow runs a lightweight benchmark so we can quickly compare how the main execution path performs on a pull request versus the base branch.
4+
5+
## What the workflow builds
6+
7+
1. **Compile the binary** – We build the ShadowMap binary with the profiling feature flags enabled.
8+
2. **Run focused benchmarks** – The workflow runs the `examples/benchmark` target twice, once to measure timing data and once to record allocation counts.
9+
3. **Compare pull request vs. base branch** – After the pull request metrics are collected, the workflow checks out the base branch and repeats the measurements so we can spot regressions.
10+
4. **Publish the results** – The collected JSON metrics are uploaded as an artifact and rendered in the job summary so reviewers can read them without downloading anything.
11+
12+
## Why the cache might be missing
13+
14+
The workflow uses `Swatinem/rust-cache` to reuse compiled dependencies between runs. When the cache logs `Cache not found for keys ...`, it simply means we do not yet have a saved cache for that exact key. Common reasons include:
15+
16+
- The workflow is running for the first time on a branch.
17+
- The toolchain or dependency lockfile changed, invalidating the previous cache.
18+
- GitHub rotated runners and the cache has not been restored yet.
19+
20+
After the run completes, the job saves the new cache key so the next invocation should hit the cache and skip rebuilding unchanged dependencies.
21+
22+
Share this explanation with anyone who sees the cache miss message—it is informational and does not indicate a failure in the profiling workflow.

0 commit comments

Comments
 (0)