gitlab-ci: use ccache to speed up builds
authorEric Engestrom <eric.engestrom@intel.com>
Tue, 12 Feb 2019 16:59:27 +0000 (16:59 +0000)
committerEric Engestrom <eric@engestrom.ch>
Tue, 19 Feb 2019 10:09:51 +0000 (10:09 +0000)
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
.gitlab-ci.yml
.gitlab-ci/Dockerfile.ubuntu

index 9e1a32f7a0af3fecc221b973609717bd0b4444ac..7e4a5f1d8d6d8e1b462d66007ed4a01a38ad3343 100644 (file)
 # The format of the tag is "%Y-%m-%d-${counter}" where ${counter} stays
 # at "01" unless you have multiple updates on the same day :)
 variables:
-  UBUNTU_TAG: 2019-01-31-01
+  UBUNTU_TAG: 2019-02-12-01
   UBUNTU_IMAGE: "$CI_REGISTRY_IMAGE/ubuntu:$UBUNTU_TAG"
   UBUNTU_IMAGE_MAIN: "registry.freedesktop.org/mesa/mesa/ubuntu:$UBUNTU_TAG"
 
+cache:
+  paths:
+    - ccache
 
 stages:
   - containers-build
@@ -63,10 +66,21 @@ containers:ubuntu:
   artifacts:
     when: on_failure
     untracked: true
+  # Use ccache transparently, and print stats before/after
+  before_script:
+    - export PATH="/usr/lib/ccache:$PATH"
+    - export CCACHE_BASEDIR="$PWD"
+    - export CCACHE_DIR="$PWD/ccache"
+    - export CCACHE_COMPILERCHECK=content
+    - ccache --zero-stats || true
+    - ccache --show-stats || true
+  after_script:
+    - export CCACHE_DIR="$PWD/ccache"
+    - ccache --show-stats
 
 .meson-build:
   extends: .build
-  before_script:
+  script:
     # We need to control the version of llvm-config we're using, so we'll
     # generate a native file to do so. This requires meson >=0.49
     - if test -n "$LLVM_VERSION"; then
@@ -88,7 +102,6 @@ containers:ubuntu:
             -D vulkan-drivers=${VULKAN_DRIVERS:-[]}
     - cd _build
     - meson configure
-  script:
     - ninja -j4
     - ninja test
 
@@ -96,7 +109,7 @@ containers:ubuntu:
   extends: .build
   variables:
     MAKEFLAGS: "-j4"
-  before_script:
+  script:
     - if test -n "$LLVM_VERSION"; then
         export LLVM_CONFIG="llvm-config-${LLVM_VERSION}";
       fi
@@ -112,7 +125,6 @@ containers:ubuntu:
         --with-gallium-drivers=$GALLIUM_DRIVERS
         --with-vulkan-drivers=$VULKAN_DRIVERS
         --disable-llvm-shared-libs
-  script:
     - make
     - eval $MAKE_CHECK_COMMAND
 
index dff5dccba37f9c78cb19c1e941f02855692cb486..77c15216951242a2155a3885b379998447dc0eaa 100644 (file)
@@ -158,5 +158,8 @@ RUN pip2 install 'scons>=2.4'
 RUN pip2 install mako
 RUN pip3 install mako
 
+# Use ccache to speed up builds
+RUN apt-get install -y ccache
+
 # Cleanup workdir
 WORKDIR /