Skip to content

Commit

Permalink
sccache sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
FooBarWidget committed Oct 8, 2024
1 parent 056ac67 commit 3add43b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 5 additions & 5 deletions dev/ci/setup-sccache
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ done
## Update environment variables.

HAS_SCCACHE_IN_PATH=$(ruby -e 'puts ENV["PATH"].split(":").include?("/usr/local/bin")')
if !$HAS_SCCACHE_IN_PATH; then
if ! $HAS_SCCACHE_IN_PATH; then
echo "PATH=/usr/local/bin:$PATH" >> "$GITHUB_ENV"
fi

HAS_COMPILER_WRAPPERS_IN_PATH=$(ruby -e 'puts ENV["PATH"].split(":").include?("/usr/local/libexec/sccache")')
if ! $HAS_COMPILER_WRAPPERS_IN_PATH; then
echo "PATH=/usr/local/libexec/sccache:/usr/local/bin:$PATH" >> "$GITHUB_ENV"
else
if $HAS_COMPILER_WRAPPERS_IN_PATH; then
# When starting the sccache server, the compiler wrappers must *not* be in PATH
# so that the sccache server uses the non-wrapped compilers.
PATH=$(ruby -e 'paths = ENV["PATH"].split(":"); paths.delete("/usr/local/libexec/sccache"); puts paths.join(":")')
export PATH
else
echo "PATH=/usr/local/libexec/sccache:$PATH" >> "$GITHUB_ENV"
fi


Expand All @@ -77,7 +77,7 @@ else
fi

echo "Waiting until sccache server is started..."
while [[ -z "$(cat sccache.log)" ]]; then
while [[ -z "$(cat sccache.log)" ]]; do
sleep 0.1
fi
echo "sccache server is started."
7 changes: 6 additions & 1 deletion dev/ci/teardown-sccache
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ SUDO=${SUDO:-false}

# Ensure Github Actions print stdout and stderr data in correct order.
exec 2>&1

set -x

if $SUDO; then
sudo sccache --stop-server
else
sccache --stop-server
fi

cat sccache.log

# Remove compiler wrappers from PATH.
PATH=$(ruby -e 'paths = ENV["PATH"].split(":"); paths.delete("/usr/local/libexec/sccache"); puts paths.join(":")')
echo "PATH=$PATH" >> "$GITHUB_ENV"

0 comments on commit 3add43b

Please sign in to comment.