diff options
author | Claudio André <claudioandre.br@gmail.com> | 2018-07-12 16:51:59 -0300 |
---|---|---|
committer | Benjamin Berg <bberg@redhat.com> | 2019-02-04 15:19:30 +0100 |
commit | df4e2bbd02494c0c7ffe9041c717f039ec6fc39b (patch) | |
tree | 8b77aae222bffac41bbf643f7adbf5df9bc9e410 | |
parent | 6c9f5ae27c5cfdcf4c43e44fd3d03fe0734cd6a5 (diff) | |
download | gnome-settings-daemon-df4e2bbd02494c0c7ffe9041c717f039ec6fc39b.tar.gz |
CI: Improve continuous integration speed
The expected gain is 5 minutes.
-rw-r--r-- | .gitlab-ci.yml | 83 | ||||
-rwxr-xr-x | 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 8f08b606..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 - 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 libcanberra-gtk3 +.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 --verbose - - ninja dist -C _build - only: - - tags + - *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 |