You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/09/05 19:25:29 UTC
[incubator-nuttx-testing] 01/02: CI: Test enabling ccache for builds
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-testing.git
commit 00a2de76aac79b587fae5cce79c86511ba8c979c
Author: Brennan Ashton <ba...@brennanashton.com>
AuthorDate: Thu Sep 3 18:14:39 2020 -0700
CI: Test enabling ccache for builds
---
.github/workflows/build.yml | 34 ++++++++++++++++++++++++-----
cibuild.sh | 52 ++++++++++++++++++++++++++++++---------------
docker/linux/Dockerfile | 21 ++++++++++++++++++
3 files changed, 85 insertions(+), 22 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b931060..56af0b1 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -20,6 +20,7 @@ jobs:
runs-on: ubuntu-18.04
env:
DOCKER_BUILDKIT: 1
+ IMAGE_TAG: docker.pkg.github.com/${{ github.repository }}/nuttx-ci-linux
strategy:
matrix:
@@ -63,16 +64,27 @@ jobs:
timeout_minutes: 10
max_attempts: 3
retry_wait_seconds: 10
- command: docker pull docker.pkg.github.com/apache/incubator-nuttx-testing/nuttx-ci-linux
+ command: docker pull $IMAGE_TAG
+ - name: Restore ccache
+ id: ccache
+ uses: actions/cache@v2
+ with:
+ path: ccache
+ key: ccache-${{ runner.os }}-${{matrix.boards}}-${{ github.run_id }}
+ restore-keys: ccache-${{ runner.os }}-${{matrix.boards}}-
- name: Run builds
uses: ./testing/.github/actions/ci-container
env:
BLOBDIR: /tools/blobs
with:
run: |
+ export CCACHE_DIR=`pwd`/ccache
cd testing
- ./cibuild.sh -x testlist/${{matrix.boards}}.dat
+ ./cibuild.sh -c -x testlist/${{matrix.boards}}.dat
+ ccache -s
+ ccache -M 400M
+ ccache -c
macOS:
runs-on: macos-10.15
@@ -107,16 +119,28 @@ jobs:
repository: apache/incubator-nuttx-testing
path: testing
- - name: Restore cache
+ - name: Restore tools cache
id: cache-tools
- uses: actions/cache@v1
+ uses: actions/cache@v2
env:
cache-name: ${{ runner.os }}-cache-tools
with:
path: prebuilt
key: ${{ runner.os }}-tools-${{ hashFiles('./testing/cibuild.sh') }}
+ - name: Restore ccache
+ id: ccache
+ uses: actions/cache@v2
+ with:
+ path: ccache
+ key: ccache-${{ runner.os }}-${{matrix.boards}}-${{ github.run_id }}
+ restore-keys: ccache-${{ runner.os }}-${{matrix.boards}}-
- name: Run builds
run: |
+ export CCACHE_DIR=`pwd`/ccache
cd testing
- ./cibuild.sh -i -x testlist/${{matrix.boards}}.dat
+ ./cibuild.sh -i -c -x testlist/${{matrix.boards}}.dat
+ ccache -s
+ ccache -M 400M
+ ccache -c
+
diff --git a/cibuild.sh b/cibuild.sh
index c68422e..b737cb6 100755
--- a/cibuild.sh
+++ b/cibuild.sh
@@ -24,6 +24,7 @@
# - wget
set -e
+set -o xtrace
WD=$(cd $(dirname $0) && pwd)
WORKSPACE=$(cd $WD/.. && pwd -P)
@@ -36,12 +37,12 @@ EXTRA_PATH=
case $os in
Darwin)
- install="python-tools u-boot-tools discoteq-flock elf-toolchain gen-romfs kconfig-frontends bloaty arm-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain avr-gcc-toolchain"
+ install="python-tools u-boot-tools discoteq-flock elf-toolchain gen-romfs kconfig-frontends arm-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain avr-gcc-toolchain c-cache"
mkdir -p ${prebuilt}/homebrew
export HOMEBREW_CACHE=${prebuilt}/homebrew
;;
Linux)
- install="python-tools gen-romfs gperf kconfig-frontends bloaty arm-gcc-toolchain mips-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain rx-gcc-toolchain c-cache"
+ install="python-tools gen-romfs gperf kconfig-frontends arm-gcc-toolchain mips-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain rx-gcc-toolchain c-cache"
;;
esac
@@ -289,21 +290,39 @@ function rx-gcc-toolchain {
function c-cache {
add_path $prebuilt/ccache/bin
- if [ ! -f "$prebuilt/ccache/bin/ccache" ]; then
- cd $prebuilt;
- wget --quiet https://github.com/ccache/ccache/releases/download/v3.7.7/ccache-3.7.7.tar.gz
- tar zxf ccache-3.7.7.tar.gz
- cd ccache-3.7.7; ./configure --prefix=$prebuilt/ccache; make; make install
- cd $prebuilt; rm -rf ccache-3.7.7; rm ccache-3.7.7.tar.gz
- ln -sf $prebuilt/ccache/bin/ccache $prebuilt/ccache/bin/gcc
- ln -sf $prebuilt/ccache/bin/ccache $prebuilt/ccache/bin/g++
- ln -sf $prebuilt/ccache/bin/ccache $prebuilt/ccache/bin/arm-none-eabi-gcc
- ln -sf $prebuilt/ccache/bin/ccache $prebuilt/ccache/bin/arm-none-eabi-g++
- ln -sf $prebuilt/ccache/bin/ccache $prebuilt/ccache/bin/p32-gcc
- ln -sf $prebuilt/ccache/bin/ccache $prebuilt/ccache/bin/riscv64-unknown-elf-gcc
- ln -sf $prebuilt/ccache/bin/ccache $prebuilt/ccache/bin/riscv64-unknown-elf-g++
+ if ! type ccache > /dev/null; then
+ case $os in
+ Darwin)
+ brew install ccache
+ ;;
+ Linux)
+ cd $prebuilt;
+ wget https://github.com/ccache/ccache/releases/download/v3.7.7/ccache-3.7.7.tar.gz
+ tar zxf ccache-3.7.7.tar.gz
+ cd ccache-3.7.7; ./configure --prefix=$prebuilt/ccache; make; make install
+ cd $prebuilt; rm -rf ccache-3.7.7; rm ccache-3.7.7.tar.gz
+ ;;
+ esac
fi
+
ccache --version
+ mkdir -p $prebuilt/ccache/bin/
+ ln -sf `which ccache` $prebuilt/ccache/bin/x86_64-elf-gcc
+ ln -sf `which ccache` $prebuilt/ccache/bin/x86_64-elf-g++
+ ln -sf `which ccache` $prebuilt/ccache/bin/cc
+ ln -sf `which ccache` $prebuilt/ccache/bin/c++
+ ln -sf `which ccache` $prebuilt/ccache/bin/clang
+ ln -sf `which ccache` $prebuilt/ccache/bin/clang++
+ ln -sf `which ccache` $prebuilt/ccache/bin/gcc
+ ln -sf `which ccache` $prebuilt/ccache/bin/g++
+ ln -sf `which ccache` $prebuilt/ccache/bin/arm-none-eabi-gcc
+ ln -sf `which ccache` $prebuilt/ccache/bin/arm-none-eabi-g++
+ ln -sf `which ccache` $prebuilt/ccache/bin/p32-gcc
+ ln -sf `which ccache` $prebuilt/ccache/bin/riscv64-unknown-elf-gcc
+ ln -sf `which ccache` $prebuilt/ccache/bin/riscv64-unknown-elf-g++
+ ln -sf `which ccache` $prebuilt/ccache/bin/xtensa-esp32-elf-gcc
+ ln -sf `which ccache` $prebuilt/ccache/bin/avr-gcc
+ ln -sf `which ccache` $prebuilt/ccache/bin/avr-g++
}
function usage {
@@ -324,8 +343,7 @@ function usage {
function enable_ccache {
export USE_CCACHE=1;
- export CCACHE_DIR=$prebuilt/ccache/.ccache;
- ccache -c
+ ccache -z
ccache -M 5G;
ccache -s
}
diff --git a/docker/linux/Dockerfile b/docker/linux/Dockerfile
index 956b956..b33a92b 100644
--- a/docker/linux/Dockerfile
+++ b/docker/linux/Dockerfile
@@ -209,6 +209,7 @@ RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \
unzip \
python3 \
python3-pip \
+ ccache \
&& rm -rf /var/lib/apt/lists/*
@@ -257,4 +258,24 @@ RUN pip3 install esptool
COPY --from=nuttx-toolchain-renesas /tools/renesas-toolchain/rx-elf-gcc/ renesas-toolchain/rx-elf-gcc/
ENV PATH="/tools/renesas-toolchain/rx-elf-gcc/bin:$PATH"
+# Configure ccache
+RUN mkdir -p /tools/ccache/bin && \
+ ln -sf `which ccache` /tools/ccache/bin/cc && \
+ ln -sf `which ccache` /tools/ccache/bin/c++ && \
+ ln -sf `which ccache` /tools/ccache/bin/clang && \
+ ln -sf `which ccache` /tools/ccache/bin/clang++ && \
+ ln -sf `which ccache` /tools/ccache/bin/gcc && \
+ ln -sf `which ccache` /tools/ccache/bin/g++ && \
+ ln -sf `which ccache` /tools/ccache/bin/arm-none-eabi-gcc && \
+ ln -sf `which ccache` /tools/ccache/bin/arm-none-eabi-g++ && \
+ ln -sf `which ccache` /tools/ccache/bin/p32-gcc && \
+ ln -sf `which ccache` /tools/ccache/bin/riscv64-unknown-elf-gcc && \
+ ln -sf `which ccache` /tools/ccache/bin/riscv64-unknown-elf-g++ && \
+ ln -sf `which ccache` /tools/ccache/bin/xtensa-esp32-elf-gcc && \
+ ln -sf `which ccache` /tools/ccache/bin/xtensa-esp32-elf-g++ && \
+ ln -sf `which ccache` /tools/ccache/bin/avr-gcc && \
+ ln -sf `which ccache` /tools/ccache/bin/avr-g++ && \
+ ln -sf `which ccache` /tools/ccache/bin/rx-elf-gcc
+ENV PATH="/tools/ccache/bin:$PATH"
+
CMD [ "/bin/bash" ]