[network-manager-applet/th/tmp: 1/2] gitlab-ci: move logic from gitlab-ci.yml to script



commit 05aeeb8038b4a94cfbc2ff45b2833cd493de0a89
Author: Thomas Haller <thaller redhat com>
Date:   Sat Mar 7 10:03:53 2020 +0100

    gitlab-ci: move logic from gitlab-ci.yml to script

 .gitlab-ci.yml       | 162 ++++++++++-----------------------------------------
 scripts/gitlab-ci.sh |  68 +++++++++++++++++++++
 2 files changed, 100 insertions(+), 130 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ecbda96e..41b5ac93 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,61 +4,28 @@
 # If things don't seem to work, this can help:
 # https://gitlab.gnome.org/GNOME/network-manager-applet/-/ci/lint
 
-.fedora_minimal: &fedora_minimal
-  before_script:
-    - dnf -y install
-      file
-      findutils
-      gcc
-      libtool
-      desktop-file-utils
-      gettext-devel
-      glib2-devel
-      gtk3-devel
-      libgudev1-devel
-      libnotify-devel
-      libsecret-devel
-      NetworkManager-libnm-devel
-      pkgconfig
-      /usr/bin/autopoint
-      fedora-repos-rawhide
-    - dnf -y install --nogpgcheck --enablerepo=rawhide
-      libnma-devel
-
-.fedora_full: &fedora_full
-  before_script:
-    - dnf -y install
-      file
-      findutils
-      gcc
-      libtool
-      desktop-file-utils
-      gettext-devel
-      glib2-devel
-      gtk3-devel
-      libgudev1-devel
-      libnotify-devel
-      libsecret-devel
-      NetworkManager-libnm-devel
-      pkgconfig
-      /usr/bin/autopoint
-      redhat-rpm-config
-      jansson-devel
-      ModemManager-glib-devel
-      libselinux-devel
-      fedora-repos-rawhide
-    - dnf -y install --nogpgcheck --enablerepo=rawhide
-      libnma-devel
-
 .dist: &dist
   dependencies:
     - fedora30_dist
-  variables:
-    GIT_STRATEGY: none
 
-.fedora_meson_minimal: &fedora_meson_minimal
-  <<: *fedora_minimal
+fedora30_dist:
+  image: fedora:30
+  stage: build
+  before_script:
+    - ./scripts/gitlab-ci.sh fedora_install_full
+  script:
+    - dnf -y install
+      autoconf automake make
+    - sh autogen.sh
+    - make -j$(nproc) distcheck
+  artifacts:
+    paths:
+      - "*.xz"
+
+fedora_meson_minimal:
   <<: *dist
+  before_script:
+    - ./scripts/gitlab-ci.sh fedora_install_minimal
   script:
     - tar xJf network-manager-applet-*.tar.xz
     - dnf -y install meson
@@ -74,10 +41,13 @@
     - ninja -v -C build test
     - ninja -v -C build install
     - ninja -v -C build uninstall
+  image: fedora:latest
+  stage: test
 
-.fedora_meson_full: &fedora_meson_full
-  <<: *fedora_full
+fedora_meson_full:
   <<: *dist
+  before_script:
+    - ./scripts/gitlab-ci.sh fedora_install_full
   script:
     - dnf -y install meson
     - tar xJf network-manager-applet-*.tar.xz
@@ -93,10 +63,13 @@
     - ninja -v -C build test
     - ninja -v -C build install
     - ninja -v -C build uninstall
+  image: fedora:latest
+  stage: test
 
-.fedora_autotools_minimal: &fedora_autotools_minimal
-  <<: *fedora_minimal
+fedora_autotools_minimal:
   <<: *dist
+  before_script:
+    - ./scripts/gitlab-ci.sh fedora_install_minimal
   script:
     - dnf -y install make
     - tar xJf network-manager-applet-*.tar.xz
@@ -115,10 +88,13 @@
     - make -j$(nproc) check
     - make -j$(nproc) install
     - make -j$(nproc) uninstall
+  image: fedora:latest
+  stage: test
 
-.fedora_autotools_full: &fedora_autotools_full
-  <<: *fedora_full
+fedora_autotools_full:
   <<: *dist
+  before_script:
+    - ./scripts/gitlab-ci.sh fedora_install_full
   script:
     - dnf -y install make
     - tar xJf network-manager-applet-*.tar.xz
@@ -136,79 +112,5 @@
     - make -j$(nproc) check
     - make -j$(nproc) install
     - make -j$(nproc) uninstall
-
-fedora30_dist:
-  <<: *fedora_full
-  image: fedora:30
-  stage: build
-  script:
-    - dnf -y install
-      autoconf automake make
-    - sh autogen.sh
-    - make -j$(nproc) distcheck
-  artifacts:
-    paths:
-      - "*.xz"
-
-fedora_meson_minimal:
-  <<: *fedora_meson_minimal
-  image: fedora:latest
-  stage: test
-
-fedora_meson_full:
-  <<: *fedora_meson_full
   image: fedora:latest
   stage: test
-
-fedora_autotools_minimal:
-  <<: *fedora_autotools_minimal
-  image: fedora:latest
-  stage: test
-
-fedora_autotools_full:
-  <<: *fedora_autotools_full
-  image: fedora:latest
-  stage: test
-
-#centos7:
-#  <<: *dist
-#  before_script:
-#    - yum -y install
-#      file
-#      findutils
-#      gcc
-#      libtool
-#      desktop-file-utils
-#      gettext-devel
-#      glib2-devel
-#      gtk3-devel
-#      intltool
-#      libgudev1-devel
-#      libnotify-devel
-#      libsecret-devel
-#      NetworkManager-libnm-devel
-#      pkgconfig
-#      /usr/bin/autopoint
-#      redhat-rpm-config
-#      jansson-devel
-#      ModemManager-glib-devel
-#      libselinux-devel
-#      make
-#  script:
-#    - tar xJf network-manager-applet-*.tar.xz
-#    - cd network-manager-applet-*/
-#    - ./configure
-#      --disable-silent-rules
-#      --with-more-asserts=yes
-#      --enable-nls
-#      --enable-schemas-compile
-#      --enable-more-warnings
-#      --with-wwan
-#      --with-selinux
-#      --with-team
-#    - make -j$(nproc)
-#    - make -j$(nproc) check
-#    - make -j$(nproc) install
-#    - make -j$(nproc) uninstall
-#  image: centos:7
-#  stage: test
diff --git a/scripts/gitlab-ci.sh b/scripts/gitlab-ci.sh
new file mode 100755
index 00000000..b92bf76f
--- /dev/null
+++ b/scripts/gitlab-ci.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+die() {
+    echo ">>> FAIL: $@"
+    exit 1
+}
+
+fedora_pkg_minimal() {
+    echo \
+        /usr/bin/autopoint \
+        NetworkManager-libnm-devel \
+        desktop-file-utils \
+        fedora-repos-rawhide \
+        file \
+        findutils \
+        gcc \
+        gettext-devel \
+        glib2-devel \
+        gtk3-devel \
+        libgudev1-devel \
+        libnotify-devel \
+        libsecret-devel \
+        libtool \
+        pkgconfig \
+        ;
+}
+
+fedora_pkg_full() {
+    echo \
+        $(fedora_pkg_minimal) \
+        redhat-rpm-config \
+        jansson-devel \
+        ModemManager-glib-devel \
+        libselinux-devel \
+        ;
+}
+
+fedora_install_libnma() {
+    pushd /etc/yum.repos.d
+        $CMD curl 
'https://gitlab.gnome.org/thaller/network-manager-applet/-/raw/96bd01b5ef1a7e24bcf4bc945aa7465ac02915a8/libnma-local.tgz'
 --output ./libnma-local.tgz
+        $CMD tar -xvzf ./libnma-local.tgz
+        $CMD dnf -y install --nogpgcheck --enablerepo=libnma-local libnma-devel
+    popd
+}
+
+fedora_install_minimal() {
+    $CMD dnf -y install $(fedora_pkg_minimal)
+    fedora_install_libnma
+}
+
+fedora_install_full() {
+    $CMD dnf -y install $(fedora_pkg_full)
+    fedora_install_libnma
+}
+
+set -xe
+
+case "$*" in
+    fedora_install_minimal)
+        fedora_install_minimal
+        ;;
+    fedora_install_full)
+        fedora_install_full
+        ;;
+    *)
+        die "Invalid argument"
+        ;;
+esac


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