Skip to contentSkip to conversation

gitlab-ci: add cache to decrease build times

PATCH Superseded Q. Gylstorff 2 participants 6 messages Sep 30, 2020 – Oct 14, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitlab-ci: add cache to decrease build times

From: Quirin Gylstorff <[email protected]>

Add the variable CCACHE_DIR to the build to move the ccache from ~/.ccache to the current directory and upload the cache from each build.

Each job uses a separate cache.

---
 .gitlab-ci.yml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
.gitlab-ci.yml +5 -1
index 59bd1d355..fa0795acd 100644
@@ -18,6 +18,7 @@ variables:
   GIT_STRATEGY: clone
   KDIR: "/tmp/kernel"
   USE_CCACHE: "1"
+  CCACHE_DIR: "./.ccache"
   CCACHE_MAXSIZE: "400M"
   IPIPE_MIRROR_URL: "https://gitlab.denx.de/Xenomai"
   PACKAGES: "gcc-8 gcc-8-aarch64-linux-gnu libc6-dev-arm64-cross \
@@ -162,7 +163,10 @@ variables:
     - ./configure --enable-smp ${CONFIGURE_OPTS}
     - make -j $(nproc)
     - ccache -s
-
+  cache:
+    key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
+    paths:
+      - $CCACHE_DIR
 
 arm-4.19-release:
   extends: .build
Signature · 1 line
2.20.1
#1 lore raw

Hi,

Here is some data to the caching.

during my test it reduced the build times from around 45min to around 25min. The size of the cache is for each build is around 500k.

Quirin

Quoted 37 lines · Q. Gylstorff

From: Quirin Gylstorff <[email protected]>

Add the variable CCACHE_DIR to the build to move the ccache from ~/.ccache to the current directory and upload the cache from each build.

Each job uses a separate cache.

---
  .gitlab-ci.yml | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
.gitlab-ci.yml +5 -1
index 59bd1d355..fa0795acd 100644
@@ -18,6 +18,7 @@ variables:
    GIT_STRATEGY: clone
    KDIR: "/tmp/kernel"
    USE_CCACHE: "1"
+  CCACHE_DIR: "./.ccache"
    CCACHE_MAXSIZE: "400M"
    IPIPE_MIRROR_URL: "https://gitlab.denx.de/Xenomai"
    PACKAGES: "gcc-8 gcc-8-aarch64-linux-gnu libc6-dev-arm64-cross \
@@ -162,7 +163,10 @@ variables:
      - ./configure --enable-smp ${CONFIGURE_OPTS}
      - make -j $(nproc)
      - ccache -s
-
+  cache:
+    key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
+    paths:
+      - $CCACHE_DIR
 
  arm-4.19-release:
    extends: .build
#2 lore raw
Quoted 6 lines · Gylstorff Quirin

Hi,

Here is some data to the caching.

during my test it reduced the build times from around 45min to around 25min.

In travis, a warm rebuild was ~10 min. in the end.

Quoted 1 line

The size of the cache is for each build is around 500k.

500K? It used to be 200-300 MB in travis. Sounds a bit inconsistent.

Jan

Quoted 42 lines

Quirin

Quoted 37 lines · Q. Gylstorff

From: Quirin Gylstorff <[email protected]>

Add the variable CCACHE_DIR to the build to move the ccache from ~/.ccache
to the current directory and upload the cache from each build.

Each job uses a separate cache.

---
  .gitlab-ci.yml | 6 +++++-

  1 file changed, 5 insertions(+), 1 deletion(-)
.gitlab-ci.yml +0 -0
index 59bd1d355..fa0795acd 100644
@@ -18,6 +18,7 @@ variables:

    GIT_STRATEGY: clone
    KDIR: "/tmp/kernel"
    USE_CCACHE: "1"
+  CCACHE_DIR: "./.ccache"
    CCACHE_MAXSIZE: "400M"
    IPIPE_MIRROR_URL: "https://gitlab.denx.de/Xenomai"
    PACKAGES: "gcc-8 gcc-8-aarch64-linux-gnu libc6-dev-arm64-cross \

.gitlab-ci.yml +0 -0
@@ -162,7 +163,10 @@ variables:
       - ./configure --enable-smp ${CONFIGURE_OPTS}
       - make -j $(nproc)

      - ccache -s
-
+  cache:
+    key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
+    paths:
+      - $CCACHE_DIR
    arm-4.19-release:
    extends: .build

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#3 lore raw
Quoted 8 lines · Jan Kiszka
Quoted 6 lines · Gylstorff Quirin

Hi,

Here is some data to the caching.

during my test it reduced the build times from around 45min to around 25min.

Quoted 6 lines

In travis, a warm rebuild was ~10 min. in the endGood to know. I will look into the runner config.

Quoted 1 line

The size of the cache is for each build is around 500k.

500K? It used to be 200-300 MB in travis. Sounds a bit inconsistent.

Here is a log from ccache

https://gitlab.com/Quirin.Gy/xenomai/-/jobs/765078542.

Config change due to the switch to Debian.

Ignore the build time. This runner has only half a core for building.

Quirin

Quoted 47 lines

Jan

Quoted 42 lines

Quirin

Quoted 37 lines · Q. Gylstorff

From: Quirin Gylstorff <[email protected]>

Add the variable CCACHE_DIR to the build to move the ccache from ~/.ccache
to the current directory and upload the cache from each build.

Each job uses a separate cache.

---
   .gitlab-ci.yml | 6 +++++-
   1 file changed, 5 insertions(+), 1 deletion(-)
.gitlab-ci.yml +5 -1
index 59bd1d355..fa0795acd 100644
@@ -18,6 +18,7 @@ variables:
     GIT_STRATEGY: clone
     KDIR: "/tmp/kernel"
     USE_CCACHE: "1"
+  CCACHE_DIR: "./.ccache"
     CCACHE_MAXSIZE: "400M"
     IPIPE_MIRROR_URL: "https://gitlab.denx.de/Xenomai"
     PACKAGES: "gcc-8 gcc-8-aarch64-linux-gnu libc6-dev-arm64-cross \
@@ -162,7 +163,10 @@ variables:
       - ./configure --enable-smp ${CONFIGURE_OPTS}
       - make -j $(nproc)
       - ccache -s
-
+  cache:
+    key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
+    paths:
+      - $CCACHE_DIR
     arm-4.19-release:
     extends: .build
 
Signature · 14 lines
With best regards,
Quirin Gylstorff

Siemens AG
T RDA IOT SES-DE
Otto-Hahn-Ring 6
81739 Muenchen, Germany
Mobile: +49 173 3746683
mailto:[email protected]
www.siemens.com

Siemens Aktiengesellschaft: Chairman of the Supervisory Board: Jim Hagemann Snabe; Managing Board: Joe Kaeser, Chairman, President and Chief Executive Officer; Roland Busch, Klaus Helmrich, Cedrik Neike, Matthias Rebellius, Ralf P. Thomas, Judith Wiese; Registered offices: Berlin and Munich, Germany; Commercial registries: Berlin-Charlottenburg, HRB 12300, Munich, HRB 6684; WEEE-Reg.-No. DE 23691322

Important notice: This e-mail and any attachment thereof contain corporate proprietary information. If you have received it by mistake, please notify us immediately by reply e-mail and delete this e-mail and its attachments from your system. Thank you.
#4 lore raw
Quoted 17 lines · Gylstorff Quirin
Quoted 14 lines · Jan Kiszka
Quoted 6 lines · Gylstorff Quirin

Hi,

Here is some data to the caching.

during my test it reduced the build times from around 45min to around 25min.

In travis, a warm rebuild was ~10 min. in the endGood to know. I will look into the runner config.

Quoted 1 line

The size of the cache is for each build is around 500k.

Quoted 7 lines
Quoted 1 line

500K? It used to be 200-300 MB in travis. Sounds a bit inconsistent.

Here is a log from ccache

https://gitlab.com/Quirin.Gy/xenomai/-/jobs/765078542.

Config change due to the switch to Debian.

But 500K really means we are not caching. Well, we are caching the userspace build but not the more interesting kernel build.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#5 lore raw
Quoted 20 lines · Jan Kiszka
Quoted 19 lines · Gylstorff Quirin
Quoted 15 lines · Jan Kiszka
Quoted 6 lines · Gylstorff Quirin

Hi,

Here is some data to the caching.

during my test it reduced the build times from around 45min to around 25min.

In travis, a warm rebuild was ~10 min. in the endGood to know. I will look into the runner config.

Quoted 1 line

The size of the cache is for each build is around 500k.

500K? It used to be 200-300 MB in travis. Sounds a bit inconsistent.

Quoted 8 lines
Quoted 5 lines

Here is a log from ccache

https://gitlab.com/Quirin.Gy/xenomai/-/jobs/765078542.

Config change due to the switch to Debian.

But 500K really means we are not caching. Well, we are caching the userspace build but not the more interesting kernel build.

OK I will look into it and see where I lost the settings for the kernel build.

Quoted 3 lines

Jan