Skip to content

Commit c6887af

Browse files
authored
update cache key to reflect all rust files, not just cargo.lock (#8898)
rust uses mtime to determine if files are fresh or not. However, if the mtime of a file in main is newer than the mtime of a commit in a PR then it will load the cache and there will be weird errors since it thinks the cache is new enough but in reality the code has changed. This change ties our cache keys to all our rust files, not just our cargo.lock, and should resolve this issue.
1 parent 9dfb120 commit c6887af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.github/actions/cache/action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ runs:
4343
~/.cargo/registry/cache/
4444
src/rust/target/
4545
${{ inputs.additional-paths }}
46-
key: cargo-pip-${{ runner.os }}-${{ runner.arch }}-${{ inputs.key }}-3-${{ hashFiles('**/Cargo.lock') }}-${{ steps.rust-version.version }}
46+
key: cargo-pip-${{ runner.os }}-${{ runner.arch }}-${{ inputs.key }}-3-${{ hashFiles('**/Cargo.lock', '**/*.rs') }}-${{ steps.rust-version.version }}
4747
- name: Size of cache items
4848
run: |
4949
du -sh ~/.cargo/registry/index/
5050
du -sh ~/.cargo/registry/cache/
5151
du -sh src/rust/target/
5252
shell: bash
53-
if: ${{ steps.cache.outputs.cache-hit }}
53+
if: ${{ steps.cache.outputs.cache-hit }}

0 commit comments

Comments
 (0)