Skip to content

Commit 4b65cda

Browse files
authored
ci: provide usage hint for rust-cache (#31)
1 parent 7e1bf5e commit 4b65cda

File tree

1 file changed

+21
-42
lines changed

1 file changed

+21
-42
lines changed

.github/actions/basics/action.yml

+21-42
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ runs:
2424

2525
# ===============================================
2626

27-
- uses: Swatinem/rust-cache@v2
28-
29-
- uses: ./.github/actions/elapsed-time
30-
with:
31-
statement: "rust-cache"
32-
33-
# ===============================================
34-
3527
- uses: cargo-bins/cargo-binstall@main
3628

3729
# ===============================================
@@ -42,40 +34,6 @@ runs:
4234
cargo binstall --no-confirm lychee prefligit ripgrep
4335
cargo binstall --no-confirm --locked taplo-cli
4436
45-
- name: Debug installed binaries
46-
shell: bash
47-
run: |
48-
echo "PATH is: $PATH"
49-
echo "CARGO_HOME is: $CARGO_HOME"
50-
51-
echo
52-
echo "==== Searching each PATH directory for 'prefligit' or 'rg' ===="
53-
IFS=':' read -ra PATH_ARRAY <<< "$PATH"
54-
for dir in "${PATH_ARRAY[@]}"; do
55-
echo "-> Checking $dir"
56-
# Only list if directory actually exists (some paths may not exist)
57-
if [ -d "$dir" ]; then
58-
ls -1 "$dir" | grep -E '^(prefligit|rg)$' || true
59-
else
60-
echo " (Not a directory)"
61-
fi
62-
done
63-
64-
echo
65-
echo "==== Checking 'which' output for 'prefligit' or 'rg' ===="
66-
which prefligit || echo "'prefligit' not found by 'which'"
67-
which rg || echo "'rg' not found by 'which'"
68-
69-
echo
70-
echo "==== Brute-force searching /home/runner for 'prefligit' and 'rg' ===="
71-
# Use 'find' instead of 'rg', since 'rg' is missing
72-
echo "Searching for prefligit..."
73-
find /home/runner -name prefligit 2>/dev/null || echo "No prefligit found."
74-
75-
echo
76-
echo "Searching for rg..."
77-
find /home/runner -name rg 2>/dev/null || echo "No rg found."
78-
7937
- uses: ./.github/actions/elapsed-time
8038
with:
8139
statement: "install lychee prefligit ripgrep taplo-cli"
@@ -93,6 +51,27 @@ runs:
9351

9452
# ===============================================
9553

54+
### rust-cache ###
55+
# a) save all contents even after its action location
56+
#
57+
# b) doesn’t cache binaries, but the related metadata will,
58+
# so caused issues like “cargo binstall” detect binaries
59+
# are installed, but actually they don’t exist! These
60+
# binary installations should be put BEFORE this
61+
# rust-cache action
62+
#
63+
# c) doesn’t remove user's bin files, the "Any files in
64+
# ~/.cargo/bin that were present before the action
65+
# ran (for example rustc)." says the cache itself
66+
67+
- uses: Swatinem/rust-cache@v2
68+
69+
- uses: ./.github/actions/elapsed-time
70+
with:
71+
statement: "rust-cache"
72+
73+
# ===============================================
74+
9675
- name: restore lychee cache
9776
uses: actions/cache@v4
9877
with:

0 commit comments

Comments
 (0)