Skip to content

Commit af47cba

Browse files
committed
ci: report what the Nix and node_modules caches restored
The sticky disk and cache-nix-action steps only log that a mount or restore happened, so job logs never showed whether the run started warm or cold, or what the restored data actually was. Add report steps after each restore that print the sticky disk key, the mount path, disk usage, and the number of restored Nix store paths or top-level node_modules entries, with an explicit cold-start message when the disk or cache comes back empty.
1 parent 32f808b commit af47cba

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

‎.github/actions/setup-linux-blacksmith-sticky-disk/action.yaml‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,39 @@ runs:
5050
fi
5151
done
5252
53+
- name: Report restored Nix store
54+
if: steps.blacksmith.outputs.enabled == 'true'
55+
shell: bash
56+
env:
57+
STICKY_DISK_KEY: ${{ github.repository }}-nix-${{ runner.os }}-${{ runner.arch }}
58+
run: |
59+
echo "Sticky disk '$STICKY_DISK_KEY' is mounted at /nix (persistent disk, no save step)"
60+
df -h /nix | tail -n 1 | awk '{ printf "Disk usage: %s used of %s (%s)\n", $3, $2, $5 }'
61+
store_paths="$(find /nix/store -mindepth 1 -maxdepth 1 2>/dev/null | wc -l | tr -d ' ')"
62+
if [ "$store_paths" -eq 0 ]; then
63+
echo "The Nix store is empty: cold start, every derivation will be built or substituted"
64+
else
65+
echo "Restored $store_paths Nix store paths (dev shell closure, crane dependency artifacts, package builds)"
66+
fi
67+
5368
- name: Mount root node_modules sticky disk
5469
if: steps.blacksmith.outputs.enabled == 'true'
5570
uses: useblacksmith/stickydisk@d58829ad6f9be8822ec5efe74256c82cd62915ab # v1
5671
with:
5772
key: ${{ github.repository }}-node-modules-pnpm-${{ steps.pnpm.outputs.version }}-${{ runner.os }}-${{ runner.arch }}
5873
path: ./node_modules
74+
75+
- name: Report restored node_modules
76+
if: steps.blacksmith.outputs.enabled == 'true'
77+
shell: bash
78+
env:
79+
STICKY_DISK_KEY: ${{ github.repository }}-node-modules-pnpm-${{ steps.pnpm.outputs.version }}-${{ runner.os }}-${{ runner.arch }}
80+
run: |
81+
echo "Sticky disk '$STICKY_DISK_KEY' is mounted at ./node_modules (persistent disk, no save step)"
82+
df -h ./node_modules | tail -n 1 | awk '{ printf "Disk usage: %s used of %s (%s)\n", $3, $2, $5 }'
83+
entries="$(find node_modules -mindepth 1 -maxdepth 1 2>/dev/null | wc -l | tr -d ' ')"
84+
if [ "$entries" -eq 0 ]; then
85+
echo "node_modules is empty: cold start, 'pnpm install' will populate it from scratch"
86+
else
87+
echo "Restored $entries top-level node_modules entries; 'pnpm install --frozen-lockfile' only applies the lockfile diff"
88+
fi

‎.github/actions/setup-macos-nix-cache/action.yaml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,14 @@ runs:
1313
purge-prefixes: nix-${{ runner.os }}-${{ runner.arch }}-
1414
purge-created: 172800
1515
purge-primary-key: never
16+
17+
- name: Report restored Nix store
18+
shell: bash
19+
run: |
20+
echo "GitHub Actions cache restored into /nix (see the cache step above for the matched key)"
21+
store_paths="$(find /nix/store -mindepth 1 -maxdepth 1 2>/dev/null | wc -l | tr -d ' ')"
22+
if [ "$store_paths" -eq 0 ]; then
23+
echo "The Nix store is empty: cache miss, every derivation will be built or substituted"
24+
else
25+
echo "Restored $store_paths Nix store paths (dev shell closure, crane dependency artifacts, package builds)"
26+
fi

0 commit comments

Comments
 (0)