ci: Enable `ccache` in Travis

Signed-off-by: Devaraj Ranganna <devaraj.ranganna@arm.com>
pull/13468/head
Devaraj Ranganna 2020-08-20 12:33:11 +01:00
parent 31701fa518
commit fef4454359
2 changed files with 25 additions and 4 deletions

View File

@ -28,6 +28,7 @@ cache:
pip: true
directories:
- ${HOME}/.cache/deps
- ${HOME}/.ccache
before_install:
@ -155,6 +156,7 @@ matrix:
make;
sudo make install)
# Create BUILD directory for tests
- ccache -s
- mkdir BUILD
script:
# Assert that the Doxygen build produced no warnings.
@ -283,6 +285,7 @@ matrix:
- python tools/make.py -t GCC_ARM -m NUCLEO_F103RB --source=. --build=BUILD/NUCLEO_F103RB/GCC_ARM -j0
# Run profiling tests
- make -C ${EVENTS}/tests/unit prof | tee prof
- ccache -s
after_success:
# Update status, comparing with master if possible.
- |
@ -356,6 +359,7 @@ matrix:
OBJ="$(ls lfs*.o | tr '\n' ' ')"
CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR"
| tee sizes
- ccache -s
after_success:
# Update status, comparing with master if possible.
- |

View File

@ -52,17 +52,34 @@ set_status()
#
# Sources a pre-compiled GCC installation from AWS, installing the archive by
# extracting and prepending the executable directory to PATH.
# Ccache is enabled for `arm-none-eabi-`.
#
# Note: Expects 'deps_url' and 'deps_dir' to already be defined.
#
_install_gcc()
_install_gcc_and_ccache()
{
# Enable Ccache in Travis
ccache -o compiler_check=content
ccache -M 1G
pushd /usr/lib/ccache
sudo ln -s ../../bin/ccache arm-none-eabi-gcc
sudo ln -s ../../bin/ccache arm-none-eabi-g++
export "PATH=/usr/lib/ccache:${PATH}"
popd
# Legacy Mbed build tool passes a new time stamp in commmand line argument
# every time mbed-os is built. This causes ccache cache miss. But there is a
# provision to read the time stamp from environment variable
# (MBED_BUILD_TIMESTAMP). Setting this variable to a fixed value improves
# ccache cache hits.
export "MBED_BUILD_TIMESTAMP=0"
# Ignore shellcheck warnings: Variables defined in .travis.yml
# shellcheck disable=SC2154
local url="${deps_url}/gcc9-linux.tar.bz2"
# shellcheck disable=SC2154
local gcc_path="${deps_dir}/gcc/gcc-arm-none-eabi-9-2019-q4-major/"
local gcc_path="${deps_dir}/gcc/gcc-arm-none-eabi-9-2019-q4-major"
local archive="gcc.tar.bz2"
@ -82,7 +99,7 @@ _install_gcc()
fi
info "Installing 'gcc'"
export "PATH=${gcc_path}/bin:${PATH}"
export "PATH=${PATH}:${gcc_path}/bin"
}
@ -184,7 +201,7 @@ source_pkg()
;;
"gcc" )
_install_gcc \
_install_gcc_and_ccache \
|| die "Installation failed"
;;