Skip to content

Commit

Permalink
nit: automate dep management
Browse files Browse the repository at this point in the history
  • Loading branch information
leofang committed Dec 16, 2024
1 parent 7320786 commit 36f4771
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions .github/actions/fetch_ctk/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,21 @@ runs:
- name: Install dependencies
shell: bash --noprofile --norc -xeuo pipefail {0}
run: |
if (command -v curl 2>&1 >/dev/null) && (command -v zstd 2>&1 >/dev/null); then
dependencies=(zstd curl xz-utils)
dependent_exes=(zstd curl xz)
not_found=0
for dep in ${dependent_exes[@]}; do
if ! (command -v curl 2>&1 >/dev/null); then
not_found=1
break
fi
done
if [[ $not_found == 0 ]]; then
echo "All dependencies are found. Do nothing."
exit 0
fi
if ! command -v sudo 2>&1 >/dev/null; then
if ! (command -v sudo 2>&1 >/dev/null); then
if [[ $EUID == 0 ]]; then
alias SUDO=""
else
Expand All @@ -38,7 +48,7 @@ runs:
fi
shopt -s expand_aliases
SUDO apt update
SUDO apt install -y zstd curl xz-utils
SUDO apt install -y ${dependencies[@]}
- name: Download CTK cache
id: ctk-get-cache
Expand Down

0 comments on commit 36f4771

Please sign in to comment.