Skip to content

Commit 08ef04d

Browse files
authored
Merge pull request ARMmbed#13468 from urutva/add-ccache-to-travis
Add ccache to travis
2 parents 1c0318c + fef4454 commit 08ef04d

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ cache:
2828
pip: true
2929
directories:
3030
- ${HOME}/.cache/deps
31+
- ${HOME}/.ccache
3132

3233

3334
before_install:
@@ -156,6 +157,7 @@ matrix:
156157
make;
157158
sudo make install)
158159
# Create BUILD directory for tests
160+
- ccache -s
159161
- mkdir BUILD
160162
script:
161163
# Assert that the Doxygen build produced no warnings.
@@ -284,6 +286,7 @@ matrix:
284286
- python tools/make.py -t GCC_ARM -m NUCLEO_F103RB --source=. --build=BUILD/NUCLEO_F103RB/GCC_ARM -j0
285287
# Run profiling tests
286288
- make -C ${EVENTS}/tests/unit prof | tee prof
289+
- ccache -s
287290
after_success:
288291
# Update status, comparing with master if possible.
289292
- |
@@ -357,6 +360,7 @@ matrix:
357360
OBJ="$(ls lfs*.o | tr '\n' ' ')"
358361
CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR"
359362
| tee sizes
363+
- ccache -s
360364
after_success:
361365
# Update status, comparing with master if possible.
362366
- |

tools/test/travis-ci/functions.sh

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,34 @@ set_status()
5252
#
5353
# Sources a pre-compiled GCC installation from AWS, installing the archive by
5454
# extracting and prepending the executable directory to PATH.
55+
# Ccache is enabled for `arm-none-eabi-`.
5556
#
5657
# Note: Expects 'deps_url' and 'deps_dir' to already be defined.
5758
#
58-
_install_gcc()
59+
_install_gcc_and_ccache()
5960
{
61+
# Enable Ccache in Travis
62+
ccache -o compiler_check=content
63+
ccache -M 1G
64+
pushd /usr/lib/ccache
65+
sudo ln -s ../../bin/ccache arm-none-eabi-gcc
66+
sudo ln -s ../../bin/ccache arm-none-eabi-g++
67+
export "PATH=/usr/lib/ccache:${PATH}"
68+
popd
69+
70+
# Legacy Mbed build tool passes a new time stamp in commmand line argument
71+
# every time mbed-os is built. This causes ccache cache miss. But there is a
72+
# provision to read the time stamp from environment variable
73+
# (MBED_BUILD_TIMESTAMP). Setting this variable to a fixed value improves
74+
# ccache cache hits.
75+
export "MBED_BUILD_TIMESTAMP=0"
76+
6077
# Ignore shellcheck warnings: Variables defined in .travis.yml
6178
# shellcheck disable=SC2154
6279
local url="${deps_url}/gcc9-linux.tar.bz2"
6380

6481
# shellcheck disable=SC2154
65-
local gcc_path="${deps_dir}/gcc/gcc-arm-none-eabi-9-2019-q4-major/"
82+
local gcc_path="${deps_dir}/gcc/gcc-arm-none-eabi-9-2019-q4-major"
6683

6784
local archive="gcc.tar.bz2"
6885

@@ -82,7 +99,7 @@ _install_gcc()
8299
fi
83100

84101
info "Installing 'gcc'"
85-
export "PATH=${gcc_path}/bin:${PATH}"
102+
export "PATH=${PATH}:${gcc_path}/bin"
86103
}
87104

88105

@@ -184,7 +201,7 @@ source_pkg()
184201
;;
185202

186203
"gcc" )
187-
_install_gcc \
204+
_install_gcc_and_ccache \
188205
|| die "Installation failed"
189206
;;
190207

0 commit comments

Comments
 (0)