[gnome-shell] ci: Use ci-templates for building image



commit e026e3bc9fd03b1606d1ad777827825a61890c52
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Fri Nov 6 18:59:19 2020 +0100

    ci: Use ci-templates for building image
    
    This rebuilds the automaticaly whenever the image tag changes. Whenever
    something in the image needs to change, alter the installation script
    and change the tag to the current date.
    
    This removes the -s (strict) argument from js68, as it doesn't exist in
    js78.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1492>

 .gitlab-ci.yml                      | 58 +++++++++++++++++++++++++++++++++----
 .gitlab-ci/Dockerfile               | 24 ---------------
 .gitlab-ci/install-meson-project.sh | 34 ++++++++++++++++++++++
 3 files changed, 86 insertions(+), 30 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 78240e3920..7df73bbb0c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,9 @@
-include: 'https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml'
+include:
+    - remote: 'https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml'
+    - remote: 
'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/5888c7388134cbe4661600222fe9befb10441f6e/templates/fedora.yml'
 
 stages:
+ - prep
  - review
  - build
  - test
@@ -18,6 +21,41 @@ variables:
         - tags
         - merge_requests
 
+.gnome-shell.fedora:33:
+    variables:
+        FDO_DISTRIBUTION_VERSION: 33
+        FDO_DISTRIBUTION_TAG: '2020-11-17.0'
+        FDO_UPSTREAM_REPO: GNOME/gnome-shell
+        FDO_DISTRIBUTION_EXEC: |
+            # For syntax checks using js78
+            dnf install -y findutils mozjs78-devel &&
+
+            # For static analysis with eslint
+            dnf install -y nodejs &&
+            npm install -g eslint &&
+
+            dnf group install -y 'Development Tools' \
+                                 'C Development Tools and Libraries' &&
+            dnf install -y meson &&
+            dnf install -y 'pkgconfig(gio-2.0)' 'pkgconfig(gio-unix-2.0)' \
+                           'pkgconfig(gnome-autoar-0)' 'pkgconfig(json-glib-1.0)' &&
+
+            ./.gitlab-ci/install-meson-project.sh \
+                -Dman=false \
+                https://gitlab.gnome.org/GNOME/gnome-shell.git \
+                3.38.0 \
+                subprojects/extensions-tool/ \
+                ./generate-translations.sh &&
+
+            dnf clean all
+
+build-fedora-container:
+    extends:
+        - .fdo.container-build@fedora@x86_64
+        - .gnome-shell.fedora:33
+    stage: prep
+    <<: *only_default
+
 check_commit_log:
     image: registry.gitlab.gnome.org/gnome/mutter/master:v4
     stage: review
@@ -34,10 +72,12 @@ check_commit_log:
             junit: commit-message-junit-report.xml
 
 js_check:
-    image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v2
+    extends:
+        - .fdo.distribution-image@fedora
+        - .gnome-shell.fedora:33
     stage: review
     script:
-        - find js -name '*.js' -exec js68 -c -s '{}' ';' 2>&1 | tee $JS_LOG
+        - find js -name '*.js' -exec js78 -c '{}' ';' 2>&1 | tee $JS_LOG
         - (! grep -q . $JS_LOG)
     <<: *only_default
     artifacts:
@@ -46,7 +86,9 @@ js_check:
         when: on_failure
 
 eslint:
-    image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v2
+    extends:
+        - .fdo.distribution-image@fedora
+        - .gnome-shell.fedora:33
     stage: review
     script:
         - export NODE_PATH=$(npm root -g)
@@ -73,14 +115,18 @@ eslint_mr:
         when: always
 
 potfile_check:
-    image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v2
+    extends:
+        - .fdo.distribution-image@fedora
+        - .gnome-shell.fedora:33
     stage: review
     script:
         - ./.gitlab-ci/check-potfiles.sh
     <<: *only_default
 
 no_template_check:
-    image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v2
+    extends:
+        - .fdo.distribution-image@fedora
+        - .gnome-shell.fedora:33
     stage: review
     script:
         - ./.gitlab-ci/check-template-strings.sh
diff --git a/.gitlab-ci/install-meson-project.sh b/.gitlab-ci/install-meson-project.sh
new file mode 100755
index 0000000000..feea61149a
--- /dev/null
+++ b/.gitlab-ci/install-meson-project.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+set -e
+
+if [[ $# -lt 4 ]]; then
+  echo Usage: $0 [options] [repo-url] [commit] [subdir]
+  echo  Options:
+  echo    -Dkey=val
+  exit 1
+fi
+
+MESON_OPTIONS=()
+
+while [[ $1 =~ ^-D ]]; do
+  MESON_OPTIONS+=( "$1" )
+  shift
+done
+
+REPO_URL="$1"
+COMMIT="$2"
+SUBDIR="$3"
+PREPARE="$4"
+
+REPO_DIR="$(basename ${REPO_URL%.git})"
+
+git clone --depth 1 "$REPO_URL" -b "$COMMIT"
+pushd "$REPO_DIR"
+pushd "$SUBDIR"
+sh -c "$PREPARE"
+meson --prefix=/usr _build "${MESON_OPTIONS[@]}"
+ninja -C _build install
+popd
+popd
+rm -rf "$REPO_DIR"


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