Merge pull request #13468 from urutva/add-ccache-to-travis

Add ccache to travis
pull/13478/head
Martin Kojtal 2020-08-24 08:47:27 +01:00 committed by GitHub
commit 08ef04d027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 4 deletions

View File

@ -28,6 +28,7 @@ cache:
pip: true pip: true
directories: directories:
- ${HOME}/.cache/deps - ${HOME}/.cache/deps
- ${HOME}/.ccache
before_install: before_install:
@ -156,6 +157,7 @@ matrix:
make; make;
sudo make install) sudo make install)
# Create BUILD directory for tests # Create BUILD directory for tests
- ccache -s
- mkdir BUILD - mkdir BUILD
script: script:
# Assert that the Doxygen build produced no warnings. # Assert that the Doxygen build produced no warnings.
@ -284,6 +286,7 @@ matrix:
- python tools/make.py -t GCC_ARM -m NUCLEO_F103RB --source=. --build=BUILD/NUCLEO_F103RB/GCC_ARM -j0 - python tools/make.py -t GCC_ARM -m NUCLEO_F103RB --source=. --build=BUILD/NUCLEO_F103RB/GCC_ARM -j0
# Run profiling tests # Run profiling tests
- make -C ${EVENTS}/tests/unit prof | tee prof - make -C ${EVENTS}/tests/unit prof | tee prof
- ccache -s
after_success: after_success:
# Update status, comparing with master if possible. # Update status, comparing with master if possible.
- | - |
@ -357,6 +360,7 @@ matrix:
OBJ="$(ls lfs*.o | tr '\n' ' ')" OBJ="$(ls lfs*.o | tr '\n' ' ')"
CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR" CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR"
| tee sizes | tee sizes
- ccache -s
after_success: after_success:
# Update status, comparing with master if possible. # 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 # Sources a pre-compiled GCC installation from AWS, installing the archive by
# extracting and prepending the executable directory to PATH. # 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. # 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 # Ignore shellcheck warnings: Variables defined in .travis.yml
# shellcheck disable=SC2154 # shellcheck disable=SC2154
local url="${deps_url}/gcc9-linux.tar.bz2" local url="${deps_url}/gcc9-linux.tar.bz2"
# shellcheck disable=SC2154 # 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" local archive="gcc.tar.bz2"
@ -82,7 +99,7 @@ _install_gcc()
fi fi
info "Installing 'gcc'" info "Installing 'gcc'"
export "PATH=${gcc_path}/bin:${PATH}" export "PATH=${PATH}:${gcc_path}/bin"
} }
@ -184,7 +201,7 @@ source_pkg()
;; ;;
"gcc" ) "gcc" )
_install_gcc \ _install_gcc_and_ccache \
|| die "Installation failed" || die "Installation failed"
;; ;;