From 49fddada1e5e280cc8bbd3b626a505068c10b031 Mon Sep 17 00:00:00 2001 From: jmd Date: Sat, 6 Jul 2024 20:58:02 -0700 Subject: [PATCH] [ci] add back ccache --- scripts/docker_prepare.sh | 49 +++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/scripts/docker_prepare.sh b/scripts/docker_prepare.sh index 0a1aab545..1c6306b58 100644 --- a/scripts/docker_prepare.sh +++ b/scripts/docker_prepare.sh @@ -7,6 +7,9 @@ set -xe # manylinux prep if [[ -f "/etc/centos-release" ]]; then rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux + dnf config-manager --set-enabled powertools + dnf install epel-release -y + dnf install ccache -y # sometimes the epel server is down. retry 5 times for i in $(seq 1 5); do @@ -15,19 +18,19 @@ if [[ -f "/etc/centos-release" ]]; then [ $s -eq 0 ] || exit $s - # if [[ -d "/usr/lib64/ccache" ]]; then - # ln -s /usr/bin/ccache /usr/lib64/ccache/c++ - # ln -s /usr/bin/ccache /usr/lib64/ccache/cc - # ln -s /usr/bin/ccache /usr/lib64/ccache/gcc - # ln -s /usr/bin/ccache /usr/lib64/ccache/g++ - # export PATH="/usr/lib64/ccache:$PATH" - # elif [[ -d "/usr/lib/ccache" ]]; then - # ln -s /usr/bin/ccache /usr/lib/ccache/c++ - # ln -s /usr/bin/ccache /usr/lib/ccache/cc - # ln -s /usr/bin/ccache /usr/lib/ccache/gcc - # ln -s /usr/bin/ccache /usr/lib/ccache/g++ - # export PATH="/usr/lib/ccache:$PATH" - # fi + if [[ -d "/usr/lib64/ccache" ]]; then + ln -s /usr/bin/ccache /usr/lib64/ccache/c++ + ln -s /usr/bin/ccache /usr/lib64/ccache/cc + ln -s /usr/bin/ccache /usr/lib64/ccache/gcc + ln -s /usr/bin/ccache /usr/lib64/ccache/g++ + export PATH="/usr/lib64/ccache:$PATH" + elif [[ -d "/usr/lib/ccache" ]]; then + ln -s /usr/bin/ccache /usr/lib/ccache/c++ + ln -s /usr/bin/ccache /usr/lib/ccache/cc + ln -s /usr/bin/ccache /usr/lib/ccache/gcc + ln -s /usr/bin/ccache /usr/lib/ccache/g++ + export PATH="/usr/lib/ccache:$PATH" + fi elif [[ -f "/etc/alpine-release" ]]; then # musllinux prep @@ -38,17 +41,17 @@ fi # hack until https://github.com/pypa/cibuildwheel/issues/1030 is fixed # Place ccache folder in /outputs -# HOST_CCACHE_DIR="/host${HOST_CCACHE_DIR:-/home/runner/work/rollnw/rollnw/.ccache}" -# if [ -d $HOST_CCACHE_DIR ]; then -# mkdir -p /output -# cp -R $HOST_CCACHE_DIR /output/.ccache -# fi +HOST_CCACHE_DIR="/host${HOST_CCACHE_DIR:-/home/runner/work/rollnw/rollnw/.ccache}" +if [ -d $HOST_CCACHE_DIR ]; then + mkdir -p /output + cp -R $HOST_CCACHE_DIR /output/.ccache +fi -# ls -la /output/ +ls -la /output/ -# ccache -o cache_dir="/output/.ccache" -# ccache -M 5 G # set cache size to 5 G +ccache -o cache_dir="/output/.ccache" +ccache -M 5 G # set cache size to 5 G # Show ccache stats -# echo "Cache stats:" -# ccache -s +echo "Cache stats:" +ccache -s