Skip to content

Commit 0852f3f

Browse files
committed
ensure zstd is installed in all stages that could access GHA cache
1 parent f113f50 commit 0852f3f

File tree

4 files changed

+71
-59
lines changed

4 files changed

+71
-59
lines changed

.github/actions/fetch_ctk/action.yml

+5-29
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,11 @@ runs:
2020
echo "CTK_CACHE_FILENAME=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}.tar.gz" >> $GITHUB_ENV
2121
2222
- name: Install dependencies
23-
shell: bash --noprofile --norc -xeuo pipefail {0}
24-
run: |
25-
dependencies=(zstd curl xz-utils)
26-
dependent_exes=(zstd curl xz)
27-
28-
not_found=0
29-
for dep in ${dependent_exes[@]}; do
30-
if ! (command -v curl 2>&1 >/dev/null); then
31-
not_found=1
32-
break
33-
fi
34-
done
35-
if [[ $not_found == 0 ]]; then
36-
echo "All dependencies are found. Do nothing."
37-
exit 0
38-
fi
39-
if ! (command -v sudo 2>&1 >/dev/null); then
40-
if [[ $EUID == 0 ]]; then
41-
alias SUDO=""
42-
else
43-
echo "The following oprations require root access."
44-
exit 1
45-
fi
46-
else
47-
alias SUDO="sudo"
48-
fi
49-
shopt -s expand_aliases
50-
SUDO apt update
51-
SUDO apt install -y ${dependencies[@]}
23+
uses: ./.github/actions/install_unix_deps
24+
continue-on-error: false
25+
with:
26+
dependencies: "zstd curl xz-utils"
27+
dependent_exes: "zstd curl xz"
5228

5329
- name: Download CTK cache
5430
id: ctk-get-cache
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Install dependencies on Ubuntu
2+
3+
description: Install needed dependencies, regardless if using GitHub- or self- hosted runners, container, sudo or not.
4+
5+
inputs:
6+
dependencies:
7+
required: true
8+
type: string
9+
dependent_exes:
10+
required: true
11+
type: string
12+
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Install dependencies
17+
shell: bash --noprofile --norc -xeuo pipefail {0}
18+
run: |
19+
dependencies=(${{ inputs.dependencies }})
20+
dependent_exes=(${{ inputs.dependent_exes }})
21+
22+
not_found=0
23+
for dep in ${dependent_exes[@]}; do
24+
if ! (command -v $dep 2>&1 >/dev/null); then
25+
not_found=1
26+
break
27+
fi
28+
done
29+
if [[ $not_found == 0 ]]; then
30+
echo "All dependencies are found. Do nothing."
31+
exit 0
32+
fi
33+
if ! (command -v sudo 2>&1 >/dev/null); then
34+
if [[ $EUID == 0 ]]; then
35+
alias SUDO=""
36+
else
37+
echo "The following oprations require root access."
38+
exit 1
39+
fi
40+
else
41+
alias SUDO="sudo"
42+
fi
43+
shopt -s expand_aliases
44+
SUDO apt update
45+
SUDO apt install -y ${dependencies[@]}

.github/workflows/build-and-test.yml

+13-30
Original file line numberDiff line numberDiff line change
@@ -100,35 +100,12 @@ jobs:
100100

101101
- name: Install dependencies
102102
if: ${{ env.USE_CACHE == '1' }}
103-
run: |
103+
uses: ./.github/actions/install_unix_deps
104+
continue-on-error: false
105+
with:
104106
# For GHA Cache
105-
dependencies=(zstd)
106-
dependent_exes=(zstd)
107-
108-
not_found=0
109-
for dep in ${dependent_exes[@]}; do
110-
if ! (command -v curl 2>&1 >/dev/null); then
111-
not_found=1
112-
break
113-
fi
114-
done
115-
if [[ $not_found == 0 ]]; then
116-
echo "All dependencies are found. Do nothing."
117-
exit 0
118-
fi
119-
if ! (command -v sudo 2>&1 >/dev/null); then
120-
if [[ $EUID == 0 ]]; then
121-
alias SUDO=""
122-
else
123-
echo "The following oprations require root access."
124-
exit 1
125-
fi
126-
else
127-
alias SUDO="sudo"
128-
fi
129-
shopt -s expand_aliases
130-
SUDO apt update
131-
SUDO apt install -y ${dependencies[@]}
107+
dependencies: "zstd"
108+
dependent_exes: "zstd"
132109

133110
- name: Dump environment
134111
run: |
@@ -350,6 +327,14 @@ jobs:
350327
echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV
351328
echo "SKIP_CUDA_BINDINGS_TEST=${SKIP_CUDA_BINDINGS_TEST}" >> $GITHUB_ENV
352329
330+
- name: Install dependencies
331+
uses: ./.github/actions/install_unix_deps
332+
continue-on-error: false
333+
with:
334+
# zstd for GHA Cache, gcc for Cython tests
335+
dependencies: "zstd build-essential"
336+
dependent_exes: "zstd gcc"
337+
353338
# We'll try GHA Artifacts first, and then fall back to GHA Cache
354339
- name: Download cuda.bindings build artifacts
355340
id: cuda-bindings-download
@@ -449,8 +434,6 @@ jobs:
449434
pip install -r requirements.txt
450435
pytest -rxXs tests/
451436
if [[ "${{ matrix.host-platform }}" == linux* ]]; then
452-
# cython tests require gcc
453-
apt install -y build-essential
454437
bash tests/cython/build_tests.sh
455438
elif [[ "${{ matrix.host-platform }}" == win* ]]; then
456439
# TODO: enable this once win-64 runners are up

.github/workflows/build-docs.yml

+8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ jobs:
3131
# TODO: cache conda env to speed up the workflow once conda-incubator/setup-miniconda#267
3232
# is resolved
3333

34+
- name: Install dependencies
35+
uses: ./.github/actions/install_unix_deps
36+
continue-on-error: false
37+
with:
38+
# zstd for GHA Cache
39+
dependencies: "zstd"
40+
dependent_exes: "zstd"
41+
3442
- name: Set up miniforge
3543
uses: conda-incubator/setup-miniconda@v3
3644
with:

0 commit comments

Comments
 (0)