[gnome-control-center] CI: print some info about the build env
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] CI: print some info about the build env
- Date: Mon, 14 May 2018 22:46:29 +0000 (UTC)
commit f4433b3766bab48b85ae0e42e3e704bb7f380663
Author: Claudio André <claudioandre br gmail com>
Date: Mon May 14 14:53:48 2018 -0300
CI: print some info about the build env
It is not possible to debug if the developer knows nothing about
the CI running environment.
.gitlab-ci.yml | 19 ++++++++++++++++-
tests/ci-helper.sh | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 79 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 516ae9577..6d17c8dab 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -18,13 +18,20 @@ build:
expire_in: 3h30min
script:
+ - echo "== Info =="
+ - tests/ci-helper.sh "INFO"
+ - tests/ci-helper.sh "GIT_INFO"
+
- echo "== Building =="
- meson . _build
- - ninja -C _build
+ - ninja -C _build 2>&1 | tee compilation.log
- echo "== Installing =="
- ninja -C _build install
+ - echo "== Report =="
+ - tests/ci-helper.sh "WARNINGS"
+
##
# Stage: Test
#
@@ -32,10 +39,20 @@ build:
##
test:
stage: test
+ artifacts:
+ name: log
+ when: always
+ paths:
+ - $(pwd)/*.log
+
dependencies:
- build
script:
+ - echo "== Info =="
+ - tests/ci-helper.sh "INFO"
+ - tests/ci-helper.sh "GIT_INFO"
+
- |
if [[ -n "${CI_COMMIT_TAG}" ]]; then
echo "== Distro Test =="
diff --git a/tests/ci-helper.sh b/tests/ci-helper.sh
new file mode 100755
index 000000000..f8409dd21
--- /dev/null
+++ b/tests/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 'The Commit'
+ git log --pretty=format:"%h %cd %s" -1; echo
+ do_print_labels
+
+elif [[ $1 == "WARNINGS" ]]; then
+ do_print_labels 'Warnings Report '
+ do_check_warnings
+ do_print_labels
+fi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]