[polari] ci: Build a custom image for non-flatpak jobs



commit 1aead25d4d0463876c8417428754c9e8726b0ff0
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Aug 28 15:59:09 2021 +0200

    ci: Build a custom image for non-flatpak jobs
    
    Unlike the gnome-shell image it replaces, this also includes our
    regular build dependencies. We'll use that to include a dist job
    that spits out a tarball.
    
    Part-of: <https://gitlab.gnome.org/GNOME/polari/-/merge_requests/220>

 .gitlab-ci.yml                      | 47 +++++++++++++++++++++++++++++++++----
 .gitlab-ci/install-meson-project.sh | 32 +++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 4 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 321333b1..9b982c12 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,9 +1,11 @@
 include:
   - remote: 'https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml'
+  - remote: 
'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/bbe5232986c9b98eb1efe62484e07216f7d1a4df/templates/fedora.yml'
   - remote: 
'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/6f86b8bcb0cd5168c32779c4fea9a893c4a0c046/templates/ci-fairy.yml'
 
 stages:
   - pre_review
+  - prepare
   - review
   - build
   - deploy
@@ -43,6 +45,33 @@ workflow:
     - if: '$CI_COMMIT_BRANCH =~ /^gnome-[0-9-]+$/'
     - when: 'manual'
 
+.polari.fedora:34:
+  variables:
+    FDO_DISTRIBUTION_VERSION: 34
+    FDO_DISTRIBUTION_TAG: '2021-08-31.1'
+    FDO_DISTRIBUTION_PACKAGES: >
+      meson gcc g++ pkgconf git gettext itstool
+      desktop-file-utils */appstream-util */json-glib-validate
+      findutils mozjs78-devel nodejs npm
+      pkgconfig(gtk+-3.0) pkgconfig(gjs-1.0)
+      pkgconfig(gobject-introspection-1.0)
+      pkgconfig(telepathy-glib)
+    FDO_DISTRIBUTION_EXEC: |
+      # For static analysis with eslint
+      npm install -g eslint eslint-plugin-jsdoc &&
+
+      ./.gitlab-ci/install-meson-project.sh \
+        -Dskip_dbus_tests=true \
+        https://gitlab.gnome.org/GNOME/gjs.git \
+        1.69.2 . &&
+
+      dnf clean all
+
+.prereview_req: &prereview_req
+  needs:
+    - check_commit_log
+    - check-merge-request
+
 check_commit_log:
   extends:
     - .fdo.ci-fairy
@@ -81,10 +110,20 @@ check-merge-request:
     reports:
       junit: check-merge-request-report.xml
 
+build-fedora-container:
+  extends:
+    - .fdo.container-build@fedora@x86_64
+    - .polari.fedora:34
+  stage: prepare
+  <<: *prereview_req
+
 eslint:
-  image: registry.gitlab.gnome.org/gnome/gnome-shell/fedora/34:2021-08-12.0
+  extends:
+    - .fdo.distribution-image@fedora
+    - .polari.fedora:34
   stage: review
-  needs: []
+  needs:
+    - build-fedora-container
   script:
     - eslint -o $LINT_LOG -f junit --resolve-plugins-relative-to $(npm root -g) src
   artifacts:
@@ -95,7 +134,7 @@ eslint:
 
 .flatpak-template:
   stage: build
-  needs: []
+  <<: *prereview_req
   variables:
     RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo";
     FLATPAK_MODULE: "polari"
@@ -127,7 +166,7 @@ check-flatpak-deps:
     name: ghcr.io/flathub/flatpak-external-data-checker
     entrypoint: [""]
   stage: housekeeping
-  needs: []
+  <<: *prereview_req
   script:
     - /app/flatpak-external-data-checker $MANIFEST_PATH
   rules:
diff --git a/.gitlab-ci/install-meson-project.sh b/.gitlab-ci/install-meson-project.sh
new file mode 100755
index 00000000..94060149
--- /dev/null
+++ b/.gitlab-ci/install-meson-project.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+set -e
+
+if [[ $# -lt 3 ]]; 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"
+
+REPO_DIR="$(basename ${REPO_URL%.git})"
+
+git clone --depth 1 "$REPO_URL" -b "$COMMIT"
+pushd "$REPO_DIR"
+pushd "$SUBDIR"
+meson --prefix=/usr _build "${MESON_OPTIONS[@]}"
+meson install -C _build
+popd
+popd
+rm -rf "$REPO_DIR"


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