[glib: 3/6] ci: Cache subprojects in docker images



commit b077c1403e162916c06d5df85050afbfd311afa1
Author: Xavier Claessens <xavier claessens collabora com>
Date:   Mon Jan 13 12:31:15 2020 -0500

    ci: Cache subprojects in docker images

 .gitlab-ci.yml                      | 19 ++++++++++++-------
 .gitlab-ci/android-ndk.Dockerfile   |  3 +++
 .gitlab-ci/cache-subprojects.sh     |  9 +++++++++
 .gitlab-ci/debian-stable.Dockerfile |  3 +++
 .gitlab-ci/fedora.Dockerfile        |  3 +++
 .gitlab-ci/mingw.Dockerfile         |  3 +++
 6 files changed, 33 insertions(+), 7 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 20fbf2fef..5c468cdd9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -24,6 +24,11 @@ variables:
   except:
     - tags
 
+.build:
+  extends: .only-default
+  before_script:
+    - cp -r $HOME/subprojects/* subprojects/
+
 style-check-diff:
   extends: .only-default
   image: $DEBIAN_IMAGE
@@ -33,7 +38,7 @@ style-check-diff:
     - .gitlab-ci/run-style-check-diff.sh
 
 fedora-x86_64:
-  extends: .only-default
+  extends: .build
   image: $FEDORA_IMAGE
   stage: build
   variables:
@@ -67,7 +72,7 @@ fedora-x86_64:
       - "_coverage"
 
 debian-stable-x86_64:
-  extends: .only-default
+  extends: .build
   image: $DEBIAN_IMAGE
   stage: build
   script:
@@ -95,7 +100,7 @@ debian-stable-x86_64:
       - "_build/${CI_JOB_NAME}-report.xml"
 
 installed-tests:
-  extends: .only-default
+  extends: .build
   image: $FEDORA_IMAGE
   stage: build
   script:
@@ -151,7 +156,7 @@ installed-tests:
       - "_build/installed-tests-report/"
 
 G_DISABLE_ASSERT:
-  extends: .only-default
+  extends: .build
   image: $FEDORA_IMAGE
   stage: build
   variables:
@@ -178,7 +183,7 @@ G_DISABLE_ASSERT:
       - "_build/${CI_JOB_NAME}-report.xml"
 
 valgrind:
-  extends: .only-default
+  extends: .build
   image: $FEDORA_IMAGE
   stage: analysis
   variables:
@@ -211,7 +216,7 @@ valgrind:
       - "_build/meson-logs"
 
 .cross-template: &cross-template
-  extends: .only-default
+  extends: .build
   stage: build
   artifacts:
     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
@@ -390,7 +395,7 @@ coverage:
   coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
 
 scan-build:
-  extends: .only-default
+  extends: .build
   image: $FEDORA_IMAGE
   stage: analysis
   script:
diff --git a/.gitlab-ci/android-ndk.Dockerfile b/.gitlab-ci/android-ndk.Dockerfile
index 9d85a9dfb..56b186cbb 100644
--- a/.gitlab-ci/android-ndk.Dockerfile
+++ b/.gitlab-ci/android-ndk.Dockerfile
@@ -72,4 +72,7 @@ RUN useradd -u $HOST_USER_ID -ms /bin/bash user
 USER user
 WORKDIR /home/user
 
+COPY cache-subprojects.sh .
+RUN ./cache-subprojects.sh
+
 ENV LANG C.UTF-8
diff --git a/.gitlab-ci/cache-subprojects.sh b/.gitlab-ci/cache-subprojects.sh
new file mode 100755
index 000000000..421631ed2
--- /dev/null
+++ b/.gitlab-ci/cache-subprojects.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+set -e
+
+git clone https://gitlab.gnome.org/GNOME/glib.git
+meson subprojects download --sourcedir glib
+rm glib/subprojects/*.wrap
+mv glib/subprojects/ .
+rm -rf glib
diff --git a/.gitlab-ci/debian-stable.Dockerfile b/.gitlab-ci/debian-stable.Dockerfile
index fe3d51f57..54d2d8c24 100644
--- a/.gitlab-ci/debian-stable.Dockerfile
+++ b/.gitlab-ci/debian-stable.Dockerfile
@@ -72,4 +72,7 @@ RUN useradd -u $HOST_USER_ID -ms /bin/bash user
 USER user
 WORKDIR /home/user
 
+COPY cache-subprojects.sh .
+RUN ./cache-subprojects.sh
+
 ENV LANG=C.UTF-8 LANGUAGE=C.UTF-8 LC_ALL=C.UTF-8
diff --git a/.gitlab-ci/fedora.Dockerfile b/.gitlab-ci/fedora.Dockerfile
index eee30d342..0d5a84cdd 100644
--- a/.gitlab-ci/fedora.Dockerfile
+++ b/.gitlab-ci/fedora.Dockerfile
@@ -67,4 +67,7 @@ RUN useradd -u $HOST_USER_ID -G wheel -ms /bin/bash user
 USER user
 WORKDIR /home/user
 
+COPY cache-subprojects.sh .
+RUN ./cache-subprojects.sh
+
 ENV LANG C.UTF-8
diff --git a/.gitlab-ci/mingw.Dockerfile b/.gitlab-ci/mingw.Dockerfile
index 19a061a1c..d89de8cfb 100644
--- a/.gitlab-ci/mingw.Dockerfile
+++ b/.gitlab-ci/mingw.Dockerfile
@@ -67,4 +67,7 @@ RUN useradd -u $HOST_USER_ID -ms /bin/bash user
 USER user
 WORKDIR /home/user
 
+COPY cache-subprojects.sh .
+RUN ./cache-subprojects.sh
+
 ENV LANG C.UTF-8


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]