[glibmm/glibmm-2-68] CI: Copy .gitlab-ci.yml from the master branch



commit 09d6ccb0c167b2db765364dcc3099df36df4e258
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Mon Oct 4 18:35:37 2021 +0200

    CI: Copy .gitlab-ci.yml from the master branch
    
    Switch to debian:testing.
    Build with g++-11 instead of g++-9.
    g++-9 is not available in debian:testing any more.
    
    Don't rebuild libsigc++ if it can be pulled from the cache.
    Build it only once if it must be rebuilt.

 .gitlab-ci.yml | 221 +++++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 145 insertions(+), 76 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2d9d0f17..e1987b83 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,127 +1,196 @@
-# Currently we have to track two versions of gcc: gcc-9 and gcc-10.
+# Currently we track two versions of gcc: gcc-10 and gcc-11.
 
-image: ubuntu:devel
+image: debian:testing
 
 stages:
+  - deps
   - build
   - deploy
 
 variables:
-  DEPENDENCIES: g++
-                g++-9
-                gettext
-                git
-                yelp-tools
-                gtk-doc-tools
-                make
-                autoconf
-                python3-pygments
-                python3-setuptools
-                libglib2.0-dev
-                mm-common
-                libxml-libxml-perl
-                meson
-                ninja-build
-                glib-networking
-                clang
+  MESON_DEPS: g++
+              gettext
+              git
+              yelp-tools
+              gtk-doc-tools
+              python3-pygments
+              python3-setuptools
+              libglib2.0-dev
+              mm-common
+              libxml-libxml-perl
+              meson
+              ninja-build
+              glib-networking
   GIO_EXTRA_MODULES: "/usr/lib/x86_64-linux-gnu/gio/modules"
   GIT_SUBMODULE_STRATEGY: normal
 
-before_script:
-  - export DEBIAN_FRONTEND=noninteractive
-  - apt update && apt -y upgrade && apt -y install $DEPENDENCIES
-  - git clone --branch 3.0.6 https://github.com/libsigcplusplus/libsigcplusplus libsigc
-  - cd libsigc
-  - mkdir _build && cd _build
-  - meson --prefix=/usr --libdir=lib -Dwarnings=fatal -Dbuildtype=release
-  - meson compile
-  - meson install
-  - cd ../..
+.build_default:
+  before_script:
+    - export DEBIAN_FRONTEND=noninteractive
+    - apt update && apt -y upgrade && apt -y install $DEPENDENCIES
+
+# Clear the cache manually.
+clear_cache:
+  stage: deps
+  when: manual
+  script:
+    - echo Clearing the build-deps cache
+  cache:
+    key: build-deps
+    paths:
+      - libsigc/
+    policy: push
+
+build_deps:
+  extends: .build_default
+  stage: deps
+  variables:
+    DEPENDENCIES: $MESON_DEPS
+  script:
+    # Build and cache dependencies that can't be installed with apt.
+    # Build libsigc++3
+    - if test ! -d libsigc; then
+    - git clone --branch 3.0.7 --depth 1 https://github.com/libsigcplusplus/libsigcplusplus.git libsigc
+    - cd libsigc
+    - mkdir _build && cd _build
+    - meson --prefix=/usr --libdir=lib -Dwarnings=fatal -Dbuild-examples=false -Dbuildtype=release
+    - meson compile
+    - cd ../..
+    - fi
+  cache:
+    key: build-deps
+    paths:
+      - libsigc/
+    policy: pull-push
 
 autotools_build:
+  extends: .build_default
   stage: build
+  variables:
+    DEPENDENCIES: $MESON_DEPS make autoconf
   script:
-  - ./autogen.sh --enable-warnings=fatal --prefix=/usr
-  - make
-  - make check
-  - make install
+    - ninja -C libsigc/_build install
+    - ./autogen.sh --enable-warnings=fatal --prefix=/usr
+    - make
+    - make check
+    - make install
+  cache:
+    key: build-deps
+    paths:
+      - libsigc/
+    policy: pull
   allow_failure: true
 
 debug_build:
+  extends: .build_default
   stage: build
+  variables:
+    DEPENDENCIES: $MESON_DEPS
   script:
-  - mkdir _build && cd _build
-# -Ddebug=true + -Doptimization=0 correspond to -Dbuildtype=debug
-  - meson --prefix=/usr --libdir=lib -Ddebug=true -Doptimization=0 -Dwarnings=fatal
-  - meson compile
-  - meson test
-  - meson install
+    - ninja -C libsigc/_build install
+    - mkdir _build && cd _build
+    # -Ddebug=true + -Doptimization=0 correspond to -Dbuildtype=debug
+    - meson --prefix=/usr --libdir=lib -Ddebug=true -Doptimization=0 -Dwarnings=fatal
+    - meson compile
+    - meson test
+    - meson install
+  cache:
+    key: build-deps
+    paths:
+      - libsigc/
+    policy: pull
   artifacts:
     when: on_failure
     paths:
-    - _build/meson-logs/testlog.txt
-    - _build/meson-logs/meson-log.txt
+      - _build/meson-logs/testlog.txt
+      - _build/meson-logs/meson-log.txt
     expire_in: 1 week
 
-release_gcc_9_build:
+release_gcc_10_build:
+  extends: .build_default
   stage: build
+  variables:
+    DEPENDENCIES: $MESON_DEPS g++-10
   script:
-  - mkdir _build && cd _build
-# -Ddebug=false + -Doptimization=3 correspond to -Dbuildtype=release
-  - CC=gcc-9 CXX=g++-9 meson --prefix=/usr --libdir=lib -Ddebug=false -Doptimization=3 -Dwarnings=fatal
-  - meson compile
-  - meson test
-  - meson install
+    - ninja -C libsigc/_build install
+    - mkdir _build && cd _build
+    # -Ddebug=false + -Doptimization=3 correspond to -Dbuildtype=release
+    - CC=gcc-10 CXX=g++-10 meson --prefix=/usr --libdir=lib -Ddebug=false -Doptimization=3 -Dwarnings=fatal
+    - meson compile
+    - meson test
+    - meson install
+  cache:
+    key: build-deps
+    paths:
+      - libsigc/
+    policy: pull
   artifacts:
-    when: on_failure
+    when: always
     paths:
-    - _build/meson-logs/testlog.txt
-    - _build/meson-logs/meson-log.txt
-    expire_in: 1 week
+      - _build/docs/reference
 
-release_gcc_10_build:
+release_gcc_11_build:
+  extends: .build_default
   stage: build
+  variables:
+    DEPENDENCIES: $MESON_DEPS g++-11
   script:
-  - mkdir _build && cd _build
-# -Ddebug=false + -Doptimization=3 correspond to -Dbuildtype=release
-  - CC=gcc-10 CXX=g++-10 meson --prefix=/usr --libdir=lib -Ddebug=false -Doptimization=3 -Dwarnings=fatal
-  - meson compile
-  - meson test
-  - meson install
+    - ninja -C libsigc/_build install
+    - mkdir _build && cd _build
+    # -Ddebug=false + -Doptimization=3 correspond to -Dbuildtype=release
+    - CC=gcc-11 CXX=g++-11 meson --prefix=/usr --libdir=lib -Ddebug=false -Doptimization=3 -Dwarnings=fatal
+    - meson compile
+    - meson test
+    - meson install
   allow_failure: true
+  cache:
+    key: build-deps
+    paths:
+      - libsigc/
+    policy: pull
   artifacts:
     when: on_failure
     paths:
-    - _build/meson-logs/testlog.txt
-    - _build/meson-logs/meson-log.txt
+      - _build/meson-logs/testlog.txt
+      - _build/meson-logs/meson-log.txt
     expire_in: 1 week
 
 release_clang_build:
+  extends: .build_default
   stage: build
+  variables:
+    DEPENDENCIES: $MESON_DEPS clang
   script:
-  - mkdir _build && cd _build
-# -Ddebug=false + -Doptimization=3 correspond to -Dbuildtype=release
-  - CC=clang CXX=clang++ meson --prefix=/usr --libdir=lib -Ddebug=false -Doptimization=3 -Dwarnings=fatal
-  - meson compile
-  - meson test
-  - meson install
+    - ninja -C libsigc/_build install
+    - mkdir _build && cd _build
+    # -Ddebug=false + -Doptimization=3 correspond to -Dbuildtype=release
+    - CC=clang CXX=clang++ meson --prefix=/usr --libdir=lib -Ddebug=false -Doptimization=3 -Dwarnings=fatal
+    - meson compile
+    - meson test
+    - meson install
   allow_failure: true
+  cache:
+    key: build-deps
+    paths:
+      - libsigc/
+    policy: pull
   artifacts:
     when: on_failure
     paths:
-    - _build/meson-logs/testlog.txt
-    - _build/meson-logs/meson-log.txt
+      - _build/meson-logs/testlog.txt
+      - _build/meson-logs/meson-log.txt
     expire_in: 1 week
 
+# Publish reference documentation at gnome.pages.gitlab.gnome.org/glibmm
 pages:
   stage: deploy
+  needs: [release_gcc_10_build]
   script:
-  - CC=gcc-9 CXX=g++-9 meson _build --prefix=/usr --libdir=lib -Ddebug=false -Doptimization=3 
-Dwarnings=fatal -Dmaintainer-mode=true
-  - cd _build
-  - ninja
-  - CC=gcc-9 CXX=g++-9 meson dist
-  - mkdir -p ../public/glibmm
-  - cp docs/reference/html/* ../public/glibmm
+    - mkdir public
+    - mv _build/docs/reference/html/* public
   artifacts:
     paths:
-    - public
+      - public
+  only:
+    refs:
+      - master


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