diff options
author | Claudio André <claudioandre.br@gmail.com> | 2018-05-14 14:53:48 -0300 |
---|---|---|
committer | Claudio André <claudioandre.br@gmail.com> | 2018-05-14 19:39:45 -0300 |
commit | f4433b3766bab48b85ae0e42e3e704bb7f380663 (patch) | |
tree | defa17d07f29fcfd3fca95d8f8229d77e7e8bf81 | |
parent | 4a5a2c72802101771fb0dc86f86a71a450427487 (diff) | |
download | gnome-control-center-f4433b3766bab48b85ae0e42e3e704bb7f380663.tar.gz |
CI: print some info about the build env
It is not possible to debug if the developer knows nothing about
the CI running environment.
-rw-r--r-- | .gitlab-ci.yml | 19 | ||||
-rwxr-xr-x | tests/ci-helper.sh | 61 |
2 files changed, 79 insertions, 1 deletions
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 |