Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ jobs:
sudo apt-get update
sudo apt-get install -y make perl

- name: Get Cargo lock hash
id: cargo-lock
shell: bash
run: |
if [ -f "Cargo.lock" ]; then
# macOS uses shasum, Linux uses sha256sum, Windows bash has sha256sum
if command -v shasum > /dev/null 2>&1; then
echo "hash=$(shasum -a 256 Cargo.lock | cut -d' ' -f1)" >> $GITHUB_OUTPUT
elif command -v sha256sum > /dev/null 2>&1; then
echo "hash=$(sha256sum Cargo.lock | cut -d' ' -f1)" >> $GITHUB_OUTPUT
else
# Fallback: use git hash-object if available
echo "hash=$(git hash-object Cargo.lock)" >> $GITHUB_OUTPUT
fi
else
echo "hash=no-lock" >> $GITHUB_OUTPUT
fi

- name: Cache cargo registry
uses: actions/cache@v4
with:
Expand All @@ -63,7 +81,7 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ steps.cargo-lock.outputs.hash }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.target }}-

Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,24 @@ jobs:
sudo apt-get update
sudo apt-get install -y make perl

- name: Get Cargo lock hash
id: cargo-lock
shell: bash
run: |
if [ -f "Cargo.lock" ]; then
# macOS uses shasum, Linux uses sha256sum, Windows bash has sha256sum
if command -v shasum > /dev/null 2>&1; then
echo "hash=$(shasum -a 256 Cargo.lock | cut -d' ' -f1)" >> $GITHUB_OUTPUT
elif command -v sha256sum > /dev/null 2>&1; then
echo "hash=$(sha256sum Cargo.lock | cut -d' ' -f1)" >> $GITHUB_OUTPUT
else
# Fallback: use git hash-object if available
echo "hash=$(git hash-object Cargo.lock)" >> $GITHUB_OUTPUT
fi
else
echo "hash=no-lock" >> $GITHUB_OUTPUT
fi

- name: Cache cargo registry
uses: actions/cache@v4
with:
Expand All @@ -66,7 +84,7 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ steps.cargo-lock.outputs.hash }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.target }}-

Expand Down
Loading