Skip to content

Commit 1a814e4

Browse files
authored
Fix failing pip on CI (#224)
Specify a cache directory for each parallel pip run
1 parent 789cb13 commit 1a814e4

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

scripts/activate-venv.sh

+11-7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ log() { echo -e "\x1B[92m[OK]\x1B[39m $@"; }
1515

1616
source "$VENV_ROOT/bin/activate"
1717

18+
MODULE_FEATURE="[dev]"
19+
if ! [[ -z "${BUILD_CONTEXT+x}" ]]; then
20+
if [[ "$BUILD_CONTEXT" == "ci" ]]; then
21+
MODULE_FEATURE="[test]" # Will cause testing tools to be installed.
22+
export PIP_CACHE_DIR=$VENV_ROOT/pip_cache # Avoid concurrent cache access issue on CI
23+
echo "PIP_CACHE_DIR=${PIP_CACHE_DIR}"
24+
fi
25+
fi
26+
27+
pip3 cache info
28+
1829
if ! pip3 show wheel 2>&1 >/dev/null; then
1930
log "Installing wheel..."
2031
pip3 install wheel
@@ -24,13 +35,6 @@ if ! pip3 show wheel 2>&1 >/dev/null; then
2435
pip3 install --upgrade setuptools
2536
fi
2637

27-
MODULE_FEATURE="[dev]"
28-
if ! [[ -z "${BUILD_CONTEXT+x}" ]]; then
29-
if [[ "$BUILD_CONTEXT" == "ci" ]]; then
30-
MODULE_FEATURE="[test]" # Will cause testing tools to be installed.
31-
fi
32-
fi
33-
3438
if ! diff "$PY_MODULE_ROOT/setup.py" "$VENV_ROOT/cache/setup.py" 2>&1 >/dev/null; then
3539
log "Install inside venv"
3640
pip3 install -e "${PY_MODULE_ROOT}${MODULE_FEATURE}"

0 commit comments

Comments
 (0)