Skip to content

Commit

Permalink
ci: provide usage hint for rust-cache (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
drink7036290 authored Dec 31, 2024
1 parent 7e1bf5e commit 4b65cda
Showing 1 changed file with 21 additions and 42 deletions.
63 changes: 21 additions & 42 deletions .github/actions/basics/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ runs:

# ===============================================

- uses: Swatinem/rust-cache@v2

- uses: ./.github/actions/elapsed-time
with:
statement: "rust-cache"

# ===============================================

- uses: cargo-bins/cargo-binstall@main

# ===============================================
Expand All @@ -42,40 +34,6 @@ runs:
cargo binstall --no-confirm lychee prefligit ripgrep
cargo binstall --no-confirm --locked taplo-cli
- name: Debug installed binaries
shell: bash
run: |
echo "PATH is: $PATH"
echo "CARGO_HOME is: $CARGO_HOME"
echo
echo "==== Searching each PATH directory for 'prefligit' or 'rg' ===="
IFS=':' read -ra PATH_ARRAY <<< "$PATH"
for dir in "${PATH_ARRAY[@]}"; do
echo "-> Checking $dir"
# Only list if directory actually exists (some paths may not exist)
if [ -d "$dir" ]; then
ls -1 "$dir" | grep -E '^(prefligit|rg)$' || true
else
echo " (Not a directory)"
fi
done
echo
echo "==== Checking 'which' output for 'prefligit' or 'rg' ===="
which prefligit || echo "'prefligit' not found by 'which'"
which rg || echo "'rg' not found by 'which'"
echo
echo "==== Brute-force searching /home/runner for 'prefligit' and 'rg' ===="
# Use 'find' instead of 'rg', since 'rg' is missing
echo "Searching for prefligit..."
find /home/runner -name prefligit 2>/dev/null || echo "No prefligit found."
echo
echo "Searching for rg..."
find /home/runner -name rg 2>/dev/null || echo "No rg found."
- uses: ./.github/actions/elapsed-time
with:
statement: "install lychee prefligit ripgrep taplo-cli"
Expand All @@ -93,6 +51,27 @@ runs:

# ===============================================

### rust-cache ###
# a) save all contents even after its action location
#
# b) doesn’t cache binaries, but the related metadata will,
# so caused issues like “cargo binstall” detect binaries
# are installed, but actually they don’t exist! These
# binary installations should be put BEFORE this
# rust-cache action
#
# c) doesn’t remove user's bin files, the "Any files in
# ~/.cargo/bin that were present before the action
# ran (for example rustc)." says the cache itself

- uses: Swatinem/rust-cache@v2

- uses: ./.github/actions/elapsed-time
with:
statement: "rust-cache"

# ===============================================

- name: restore lychee cache
uses: actions/cache@v4
with:
Expand Down

0 comments on commit 4b65cda

Please sign in to comment.