[network-manager-applet/th/tmp: 1/2] gitlab-ci: move logic from gitlab-ci.yml to script
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/th/tmp: 1/2] gitlab-ci: move logic from gitlab-ci.yml to script
- Date: Sat, 7 Mar 2020 10:20:28 +0000 (UTC)
commit d56b5a489436561d7a2eb4cb50b7ad28d12d1cd7
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
I think a plain shell script makes it easier to implement the build
steps. It's easier to read and to extend.
Also, we already require libnma-1.8.28, but it's not yet packaged in
Fedora. In the meantime, download some pre-build RPMs from a separate
location.
.gitlab-ci.yml | 166 ++++++++++-----------------------------------------
scripts/gitlab-ci.sh | 93 +++++++++++++++++++++++++++++
2 files changed, 125 insertions(+), 134 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ecbda96e..ec762a73 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,64 +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 autotools
+ script:
+ - sh autogen.sh
+ - make -j$(nproc) distcheck
+ artifacts:
+ paths:
+ - "*.xz"
+
+fedora_meson_minimal:
<<: *dist
+ before_script:
+ - ./scripts/gitlab-ci.sh fedora_install_minimal meson
script:
- tar xJf network-manager-applet-*.tar.xz
- - dnf -y install meson
- meson
-Dwwan=false
-Dselinux=false
@@ -74,12 +38,15 @@
- ninja -v -C build test
- ninja -v -C build install
- ninja -v -C build uninstall
+ image: fedora:latest
+ stage: test
+ when: manual
-.fedora_meson_full: &fedora_meson_full
- <<: *fedora_full
+fedora_meson_full:
<<: *dist
+ before_script:
+ - ./scripts/gitlab-ci.sh fedora_install_full meson
script:
- - dnf -y install meson
- tar xJf network-manager-applet-*.tar.xz
- meson
-Dwwan=true
@@ -93,12 +60,14 @@
- 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 make
script:
- - dnf -y install make
- tar xJf network-manager-applet-*.tar.xz
- cd network-manager-applet-*/
- ./configure
@@ -115,12 +84,15 @@
- make -j$(nproc) check
- make -j$(nproc) install
- make -j$(nproc) uninstall
+ image: fedora:latest
+ stage: test
+ when: manual
-.fedora_autotools_full: &fedora_autotools_full
- <<: *fedora_full
+fedora_autotools_full:
<<: *dist
+ before_script:
+ - ./scripts/gitlab-ci.sh fedora_install_full make
script:
- - dnf -y install make
- tar xJf network-manager-applet-*.tar.xz
- cd network-manager-applet-*/
- ./configure
@@ -136,79 +108,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..af974429
--- /dev/null
+++ b/scripts/gitlab-ci.sh
@@ -0,0 +1,93 @@
+#!/bin/bash
+
+die() {
+ echo ">>> FAIL: $@"
+ exit 1
+}
+
+is_in_set() {
+ local v="$1"
+ shift
+ for w; do
+ [[ "$v" == "$w" ]] && return 0
+ done
+ return 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_pkg_build() {
+ case "$1" in
+ autotools)
+ echo autoconf automake make
+ ;;
+ make)
+ echo make
+ ;;
+ meson)
+ echo meson
+ ;;
+ "")
+ ;;
+ *)
+ die "Unknown build option \"$1\""
+ ;;
+ esac
+}
+
+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_pkg_build "$1")
+ fedora_install_libnma
+}
+
+fedora_install_full() {
+ $CMD dnf -y install $(fedora_pkg_full) $(fedora_pkg_build "$1")
+ fedora_install_libnma
+}
+
+
+set -xe
+
+if is_in_set "$1" fedora_install_minimal fedora_install_full; then
+ is_in_set "$2" autotools make meson || die "invalid argument \$2 (\"$2\")"
+ "$1" "$2"
+ exit 0
+fi
+
+die "Unknown command \"$1\""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]