-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
785ca26
commit 4799c42
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env sh | ||
|
||
# get_caching_paths.sh | ||
# | ||
# get the paths to be cached by Github Actions. | ||
# paths are seperated by new lines | ||
|
||
sh get_submodule_paths.sh | ||
echo '~/.cargo/bin' | ||
echo '~/.cargo/registry/index' | ||
echo '~/.cargo/registry/cache' | ||
echo '~/.cargo/git/db' | ||
echo 'target/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env sh | ||
|
||
# get_submodule_paths | ||
# | ||
# returns the paths of each submodule in this repository, seperated by a new line | ||
# these paths are relative to the git repository. | ||
|
||
# go to top level of git repo | ||
cd $(git rev-parse --show-toplevel) | ||
|
||
# https://stackoverflow.com/questions/12641469/list-submodules-in-a-git-repository | ||
git config --file .gitmodules --get-regexp path | awk '{print $2}' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env sh | ||
|
||
# get_submodules_hash | ||
# | ||
# compute a hash that represents the current state of all git submodule | ||
# dependencies. Primarily used for cache invalidation in GitHub Actions. | ||
|
||
|
||
CI_SCRIPTS_DIR=$(realpath $(dirname "$0")) | ||
|
||
# go to top level of git repo | ||
cd $(git rev-parse --show-toplevel) | ||
|
||
git submodule update --init --recursive | ||
|
||
{ | ||
for module in $(sh "$CI_SCRIPTS_DIR/get_submodule_paths.sh") | ||
do | ||
git rev-parse "HEAD:$module" >> $SHAS | ||
done; | ||
} 2>/dev/null | sha256sum | head -c 40 # note: sha256sum print a - at the end - this is removed here. | ||
echo '' |