[gnome-settings-daemon/wip/claudio/CI: 1/7] CI: Improve continuous integration speed
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/wip/claudio/CI: 1/7] CI: Improve continuous integration speed
- Date: Mon, 4 Feb 2019 12:54:25 +0000 (UTC)
commit c662d1502fb70b478c153db68f4c4d99c84a87ed
Author: Claudio André <claudioandre br gmail com>
Date: Thu Jul 12 16:51:59 2018 -0300
CI: Improve continuous integration speed
The expected gain is 5 minutes.
.gitlab-ci.yml | 83 +++++++++++++++++++++++++++++------------------
build-aux/ci/ci-helper.sh | 61 ++++++++++++++++++++++++++++++++++
2 files changed, 112 insertions(+), 32 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cf476f95..5eec8941 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,23 +1,35 @@
-image: fedora:rawhide
+image: registry.gitlab.gnome.org/gnome/gnome-settings-daemon:fedora.dev
stages:
- build
- test
- - deploy
-variables:
- DEPENDENCIES: alsa-lib-devel colord-devel cups-devel fontconfig-devel geoclue2-devel geocode-glib-devel
- gettext git glib2-devel gnome-desktop3-devel gnome-session gobject-introspection
- gsettings-desktop-schemas-devel gtk3-devel lcms2-devel libcanberra-devel libgtop2-devel
- libgudev-devel libgweather-devel libnotify-devel librsvg2-devel libX11-devel libXi-devel
- libXtst-devel libwacom-devel meson NetworkManager-libnm-devel nss-devel perl-interpreter
- polkit-devel pulseaudio-libs-devel pygobject3 python3-dbusmock upower-devel wayland-devel
- which xorg-x11-drv-wacom-devel xorg-x11-server-Xvfb xorg-x11-utils mutter
- mesa-dri-drivers umockdev
+.Log files: &log_files [./*.log, _build/meson-logs/]
+.Build logs: &save_build_logs
+ artifacts:
+ name: log
+ when: always
+ paths: *log_files
-before_script:
- - dnf update -y --nogpgcheck && dnf install -y --nogpgcheck $DEPENDENCIES
+.Git Untracked files: &save_untracked_files
+ artifacts:
+ name: untracked
+ paths: [$(pwd)]
+ expire_in: 3h30min
+.Show Info: &environment_information
+ build-aux/ci/ci-helper.sh "INFO" &&
+ build-aux/ci/ci-helper.sh "GIT_INFO"
+
+.Build procedure: &build_procedure
+ echo "== Building ==" &&
+ rm -rf _build/ &&
+ meson . _build ${BUILD_OPTS} &&
+ ninja -C _build 2>&1 | tee compilation.log
+
+.Run Tests: &run_tests
+ echo "== Testing ==" &&
+ ninja -C _build test
##
# Stage: Build
@@ -27,12 +39,21 @@ before_script:
# any of them.
##
build:
+ <<: *save_untracked_files
stage: build
+
script:
- - meson . _build
- - ninja -C _build
+ - *environment_information
+ - *build_procedure
+
+ - echo "== Installing =="
- ninja -C _build install
+ - echo "== Report =="
+ - build-aux/ci/ci-helper.sh "WARNINGS"
+
+ # Save all but git-related files
+ - rm -rf .git .gitignore .gitmodules
##
# Stage: Test
@@ -40,24 +61,22 @@ build:
# Runs the unit tests.
##
test:
+ <<: *save_build_logs
stage: test
- script:
- - meson . _build
- - ninja -C _build
- - meson test -C _build --verbose --no-stdsplit
+ dependencies:
+ - build
-##
-# Stage: Deploy
-#
-# Checks if the released version is in a good shape.
-##
-deploy:
- stage: deploy
script:
- - meson . _build
- - ninja -C _build
- - meson test -C _build
- - ninja dist -C _build
- only:
- - tags
\ No newline at end of file
+ - *environment_information
+
+ - |
+ if [[ -n "${CI_COMMIT_TAG}" ]]; then
+ *run_tests
+
+ echo "== Distro Test =="
+ ninja dist -C _build
+ else
+ echo "== Testing =="
+ meson test -C _build --verbose --no-stdsplit
+ fi
diff --git a/build-aux/ci/ci-helper.sh b/build-aux/ci/ci-helper.sh
new file mode 100755
index 00000000..ddecded2
--- /dev/null
+++ b/build-aux/ci/ci-helper.sh
@@ -0,0 +1,61 @@
+#!/bin/bash -e
+
+function do_print_labels(){
+
+ if [[ -n "${1}" ]]; then
+ label_len=${#1}
+ span=$(((54 - $label_len) / 2))
+
+ echo
+ echo "= ======================================================== ="
+ printf "%s %${span}s %s %${span}s %s\n" "=" "" "$1" "" "="
+ echo "= ======================================================== ="
+ else
+ echo "= ========================= Done ========================= ="
+ echo
+ fi
+}
+
+function do_show_info(){
+
+ local compiler=gcc
+
+ echo -n "Processors: "; grep -c ^processor /proc/cpuinfo
+ grep ^MemTotal /proc/meminfo
+ id; uname -a
+ printenv
+ echo '-----------------------------------------'
+ cat /etc/*-release
+ echo '-----------------------------------------'
+
+ if [[ ! -z $CC ]]; then
+ compiler=$CC
+ fi
+ echo 'Compiler version'
+ $compiler --version
+ echo '-----------------------------------------'
+ $compiler -dM -E -x c /dev/null
+ echo '-----------------------------------------'
+}
+
+function do_check_warnings(){
+
+ cat compilation.log | grep "warning:" | awk '{total+=1}END{print "Total number of warnings: "total}'
+}
+
+# ----------- -----------
+if [[ $1 == "INFO" ]]; then
+ do_print_labels 'Build environment '
+ do_show_info
+ do_print_labels
+
+elif [[ $1 == "GIT_INFO" ]]; then
+ do_print_labels 'Commit'
+ git log --pretty=format:"%h %cd %s" -1; echo
+ do_print_labels
+
+elif [[ $1 == "WARNINGS" ]]; then
+ do_print_labels 'Warning Report '
+ do_check_warnings
+ do_print_labels
+fi
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]