[libgweather/ebassi/gtk4] ci: Restructure the pipeline




commit 4b4c7b22b1adb92b05273493742a96ab2d6bc2d6
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Oct 12 13:48:02 2021 +0100

    ci: Restructure the pipeline
    
    - Add base recipes to be reused for different jobs
    - Split the ABI check into its own stage
    - Build the API reference in its own stage
    - Publish the API reference with GitLab Pages

 .gitlab-ci.yml | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 162 insertions(+), 6 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e6387602..2abfafc7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,7 +1,15 @@
 variables:
-    LAST_ABI_BREAK: f1f0bdd9ab47ff8ddba17e2125802c928226da64
 
-build-fedora:
+stages:
+  - build
+  - analysis
+  - docs
+  - deploy
+
+# Recipe for setting up the build
+# @PROJECT_DEPS: the dependencies of the project (on Fedora)
+# @MESON_VERSION: the version of Meson required by the project
+.build-setup:
   image: fedora:latest
   before_script:
     # Undo delangification present in the Fedora Docker images
@@ -9,9 +17,157 @@ build-fedora:
     - dnf reinstall -y glib2 glibc || dnf update -y glib2 glibc
     # Add French locale support for tests
     - dnf install -y glibc-langpack-fr
-    - dnf install -y redhat-rpm-config meson libxml2-devel vala gettext itstool gtk3-devel 
geocode-glib-devel gobject-introspection-devel libsoup-devel libabigail git python3-gobject pylint
+    - dnf install -y ${PROJECT_DEPS}
+    - pip3 install --user meson==${MESON_VERSION}
+    - export PATH="$PATH:$HOME/.local/bin"
+
+# Default build recipe
+# @PROJECT_DEPS: the dependencies of the project (on Fedora)
+# @MESON_VERSION: the version of Meson required by the project
+# @MESON_EXTRA_FLAGS: extra arguments for the meson setup invocation
+.build-default:
+  image: fedora:latest
+  before_script:
+    # Undo delangification present in the Fedora Docker images
+    - rm -f /etc/rpm/macros.image-language-conf
+    - dnf reinstall -y glib2 glibc || dnf update -y glib2 glibc
+    # Add French locale support for tests
+    - dnf install -y glibc-langpack-fr
+    - dnf install -y ${PROJECT_DEPS}
+    - pip3 install --user meson==${MESON_VERSION}
+    - export PATH="$PATH:$HOME/.local/bin"
   script:
-    - meson _build
-    - ninja -C _build install
-    - ninja -C _build test
+    - meson setup ${MESON_EXTRA_FLAGS} --prefix /usr _build .
+    - meson compile -C _build
+    - meson test -C _build
+  artifacts:
+    when: always
+    name: "libgweather-${CI_COMMIT_REF_NAME}"
+    paths:
+      - "${CI_PROJECT_DIR}/_build/meson-logs"
+
+# Inherit to build the API reference via gi-docgen
+# @PROJECT_DEPS: the dependencies of the project (on Fedora)
+# @MESON_VERSION: the version of Meson required by the project
+# @MESON_EXTRA_FLAGS: extra arguments for the meson setup invocation
+# @DOCS_FLAGS: doc-related arguments for the meson setup invocation
+# @DOCS_PATH: the docs output directory under the build directory
+.gidocgen-build:
+  image: fedora:latest
+  before_script:
+    - export PATH="$HOME/.local/bin:$PATH"
+    - dnf install -y python3 python3-pip python3-wheel gobject-introspection-devel graphviz ninja-build 
redhat-rpm-config
+    - dnf install -y ${PROJECT_DEPS}
+    - pip3 install --user meson==${MESON_VERSION} gi-docgen jinja2 Markdown markupsafe pygments toml 
typogrify
+  script:
+    - meson setup ${MESON_EXTRA_FLAGS} ${DOCS_FLAGS} _docs .
+    - meson compile -C _docs
+    - |
+      pushd "_docs/${DOCS_PATH}" > /dev/null
+      tar cfJ ${CI_PROJECT_NAME}-docs.tar.xz .
+      popd > /dev/null
+    - mv _docs/${DOCS_PATH}/${CI_PROJECT_NAME}-docs.tar.xz .
+  artifacts:
+    when: always
+    name: 'Documentation'
+    expose_as: 'Download the API reference'
+    paths:
+      - ${CI_PROJECT_NAME}-docs.tar.xz
+
+fedora-x86_64:
+  extends: .build-default
+  stage: build
+  needs: []
+  variables:
+    PROJECT_DEPS:
+      gcc
+      geocode-glib-devel
+      gettext
+      git
+      glib2-devel
+      gobject-introspection-devel
+      gtk3-devel
+      itstool
+      libsoup-devel
+      libxml2-devel
+      ninja-build
+      pylint
+      python3
+      python3-gobject
+      python3-pip
+      python3-wheel
+      redhat-rpm-config
+      vala
+    MESON_VERSION: "0.55.3"
+    MESON_EXTRA_FLAGS: "--buildtype=debug -Dwerror=true -Dgtk_doc=false"
+
+abi-check:
+  extends: .build-setup
+  stage: analysis
+  needs: []
+  variables:
+    PROJECT_DEPS:
+      gcc
+      geocode-glib-devel
+      gettext
+      git
+      glib2-devel
+      gobject-introspection-devel
+      gtk3-devel
+      itstool
+      libsoup-devel
+      libxml2-devel
+      ninja-build
+      python3
+      python3-gobject
+      python3-pip
+      python3-wheel
+      redhat-rpm-config
+      vala
+    MESON_VERSION: "0.55.3"
+    LAST_ABI_BREAK: f1f0bdd9ab47ff8ddba17e2125802c928226da64
+  script:
+    - meson setup --prefix /usr -Dgtk_doc=false _build .
+    - meson compile -C _build
     - ./.ci/check-abi ${LAST_ABI_BREAK} $(git rev-parse HEAD)
+
+reference:
+  stage: docs
+  needs: []
+  extends: .gidocgen-build
+  variables:
+    PROJECT_DEPS:
+      gcc
+      geocode-glib-devel
+      gettext
+      git
+      glib2-devel
+      gobject-introspection-devel
+      gtk3-devel
+      itstool
+      libsoup-devel
+      libxml2-devel
+      ninja-build
+      pylint
+      python3
+      python3-gobject
+      python3-pip
+      python3-wheel
+      redhat-rpm-config
+      vala
+    MESON_VERSION: "0.55.3"
+    DOCS_FLAGS: -Dgtk_doc=true
+    DOCS_PATH: doc/libgweather-3.0
+
+pages:
+  stage: deploy
+  needs: ['reference']
+  script:
+    - mkdir public && cd public
+    - tar xfJ ../${CI_PROJECT_NAME}-docs.tar
+  artifacts:
+    paths:
+      - public
+  only:
+    - master
+    - main


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