[gnome-software] ci: Cache subproject files in the CI images



commit 7a7cdc7b7db171fdc02a998923fd5a4a58e2e5ad
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Jul 7 11:58:48 2020 +0100

    ci: Cache subproject files in the CI images
    
    This avoids them being re-downloaded on every CI run, which saves time
    and bandwidth, and avoids the occasional spurious CI failure if they
    can’t be downloaded because of network connectivity problems.
    
    This requires bumping the Meson dependency on the Docker images to
    0.50.0 for `meson subprojects download` and the fix in
    https://github.com/mesonbuild/meson/commit/47b9c1a564756ac48a55da9a7c4d91787399c645.
    The dependency of gnome-software outside the CI environment is unchanged.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 .gitlab-ci.yml                      | 12 +++++++++---
 .gitlab-ci/cache-subprojects.sh     |  9 +++++++++
 .gitlab-ci/debian-stable.Dockerfile |  8 +++++++-
 .gitlab-ci/fedora.Dockerfile        |  8 +++++++-
 4 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index dfa097b7..7752464f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,10 +8,15 @@ cache:
 variables:
   MESON_TEST_TIMEOUT_MULTIPLIER: 2
   G_MESSAGES_DEBUG: all
-  MESON_COMMON_OPTIONS: "--buildtype debug --prefix /usr"
+  MESON_COMMON_OPTIONS: "--buildtype debug --wrap-mode=nodownload --prefix /usr"
+
+.build:
+  before_script:
+    - cp -r $HOME/subprojects/* subprojects/
 
 fedora-x86_64:
-  image: registry.gitlab.gnome.org/gnome/gnome-software/fedora:v1
+  extends: .build
+  image: registry.gitlab.gnome.org/gnome/gnome-software/fedora:v2
   stage: build
   except:
     - tags
@@ -36,7 +41,8 @@ fedora-x86_64:
       - "_build/${CI_JOB_NAME}-report.xml"
 
 debian-stable-x86_64:
-  image: registry.gitlab.gnome.org/gnome/gnome-software/debian-stable:v1
+  extends: .build
+  image: registry.gitlab.gnome.org/gnome/gnome-software/debian-stable:v2
   stage: build
   except:
     - tags
diff --git a/.gitlab-ci/cache-subprojects.sh b/.gitlab-ci/cache-subprojects.sh
new file mode 100755
index 00000000..6c70248b
--- /dev/null
+++ b/.gitlab-ci/cache-subprojects.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+set -e
+
+git clone https://gitlab.gnome.org/GNOME/gnome-software.git
+meson subprojects download --sourcedir gnome-software
+rm gnome-software/subprojects/*.wrap
+mv gnome-software/subprojects/ .
+rm -rf gnome-software
diff --git a/.gitlab-ci/debian-stable.Dockerfile b/.gitlab-ci/debian-stable.Dockerfile
index 1b34f065..38739db6 100644
--- a/.gitlab-ci/debian-stable.Dockerfile
+++ b/.gitlab-ci/debian-stable.Dockerfile
@@ -53,7 +53,7 @@ RUN apt-get update -qq && apt-get install --no-install-recommends -qq -y \
     xz-utils \
  && rm -rf /usr/share/doc/* /usr/share/man/*
 
-RUN pip3 install meson==0.47.0
+RUN pip3 install meson==0.50.0
 
 # Enable passwordless sudo for sudo users
 RUN sed -i -e '/%sudo/s/ALL$/NOPASSWD: ALL/' /etc/sudoers
@@ -62,4 +62,10 @@ ARG HOST_USER_ID=5555
 ENV HOST_USER_ID ${HOST_USER_ID}
 RUN useradd -u $HOST_USER_ID -G sudo -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 058bbc37..57ba8e7e 100644
--- a/.gitlab-ci/fedora.Dockerfile
+++ b/.gitlab-ci/fedora.Dockerfile
@@ -56,7 +56,7 @@ RUN dnf -y install \
     zlib-devel \
  && dnf clean all
 
-RUN pip3 install meson==0.47.0
+RUN pip3 install meson==0.50.0
 
 # Enable sudo for wheel users
 RUN sed -i -e 's/# %wheel/%wheel/' -e '0,/%wheel/{s/%wheel/# %wheel/}' /etc/sudoers
@@ -65,4 +65,10 @@ ARG HOST_USER_ID=5555
 ENV HOST_USER_ID ${HOST_USER_ID}
 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


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