From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id C390E3097B for ; Wed, 19 Jun 2019 10:56:37 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y92G8m6WeVFr for ; Wed, 19 Jun 2019 10:56:37 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 0CF7930959 for ; Wed, 19 Jun 2019 10:56:36 -0400 (EDT) From: "Alexander V. Tikhonov" Subject: [tarantool-patches] [PATCH v4] Implement Gitlab-ci testing process Date: Wed, 19 Jun 2019 17:56:30 +0300 Message-Id: In-Reply-To: References: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Alexander Turenko Cc: "Alexander V. Tikhonov" , tarantool-patches@freelists.org Implemented Gitlba-ci testing process additionaly to travis-ci that is currently uses. New testing process was added to make able to control the high load of the testing processes to avoid of flaky fails on timouts, disks layouts and memory swapping. Created 2 stages for testing and deploying packages. Stage test consist of testing jobs for all branches at: Debian 9 (Stretch): release/debug gcc Debian 10 (Buster): release clang8 + lto OSX 14 (Mojave): release FreeBSD 12: release gcc and for release branch has additionally: OSX 13 (Sierra) release clang OSX 14 (Mojave) release clang + lto Deploy of packages is the same as in Travis-CI. Additional manual work is needed if the image's depends was changed at .travis.mk file - in this way need to do: make -f .gitlab.mk docker_bootstrap Fixes #4156 --- .gitlab-ci.yml | 297 +++++++++++++++++++++++++++++++++++++++++++++++++ .gitlab.mk | 57 ++++++++++ .travis.mk | 107 +++++++++++++----- .travis.yml | 3 + 4 files changed, 437 insertions(+), 27 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100644 .gitlab.mk diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..cdb19fcdc --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,297 @@ +stages: + - test + - deploy + +variables: + DEPS_VERSION: "master" + IMAGE_TEST: "${CI_REGISTRY}/${CI_PROJECT_PATH}/debian-stretch:${DEPS_VERSION}" + IMAGE_TEST_LTO: "${CI_REGISTRY}/${CI_PROJECT_PATH}/debian-buster:${DEPS_VERSION}" + DENABLE_LTO_ON: "-DENABLE_LTO=ON" + GITLAB_MAKE: "make -f .gitlab.mk" + +# Tests + +release: + image: ${IMAGE_TEST} + stage: test + tags: + - docker_test + script: + - ${GITLAB_MAKE} test_debian_no_deps + +debug: + image: ${IMAGE_TEST} + stage: test + tags: + - docker_test + script: + - ${GITLAB_MAKE} test_coverage_debian_no_deps + +release_clang: + image: ${IMAGE_TEST} + stage: test + tags: + - docker_test + variables: + CC: clang + CXX: clang++ + script: + - ${GITLAB_MAKE} test_debian_no_deps + +release_lto: + only: + refs: + - master + - /.*/ + image: ${IMAGE_TEST_LTO} + stage: test + tags: + - docker_test + variables: + CMAKE_EXTRA_PARAMS: ${DENABLE_LTO_ON} + script: + - ${GITLAB_MAKE} test_debian_no_deps + +release_lto_clang8: + only: + refs: + - master + - /.*/ + image: ${IMAGE_TEST_LTO} + stage: test + tags: + - docker_test + variables: + CC: clang-8 + CXX: clang++-8 + CMAKE_EXTRA_PARAMS: ${DENABLE_LTO_ON} + script: + - ${GITLAB_MAKE} test_debian_no_deps + +osx_13_release: + only: + refs: + - master + - /.*/ + stage: test + tags: + - vms_sierra + variables: + VMS_NAME: 'Sierra' + VMS_USER: 'tarantool' + VMS_PORT: '2212' + before_script: + - ${GITLAB_MAKE} vms_start + script: + - ${GITLAB_MAKE} vms_test_osx + after_script: + - ${GITLAB_MAKE} vms_shutdown + +osx_14_release: + stage: test + tags: + - vms_mojave + variables: + VMS_NAME: 'Mojave' + VMS_USER: 'tarantool' + VMS_PORT: '2222' + before_script: + - ${GITLAB_MAKE} vms_start + script: + - ${GITLAB_MAKE} vms_test_osx + after_script: + - ${GITLAB_MAKE} vms_shutdown + +osx_14_release_lto: + only: + refs: + - master + - /.*/ + stage: test + tags: + - vms_mojave + variables: + EXTRA_ENV: "export CMAKE_EXTRA_PARAMS=${DENABLE_LTO_ON} ;" + VMS_NAME: 'Mojave' + VMS_USER: 'tarantool' + VMS_PORT: '2222' + before_script: + - ${GITLAB_MAKE} vms_start + script: + - ${GITLAB_MAKE} vms_test_osx + after_script: + - ${GITLAB_MAKE} vms_shutdown + +freebsd_12_release: + stage: test + tags: + - vms_freebsd + variables: + VMS_NAME: 'Freebsd' + VMS_USER: 'vagrant' + VMS_PORT: '2232' + TRAVIS_MAKE: 'gmake -f .travis.mk' + before_script: + - ${GITLAB_MAKE} vms_start + script: + - ${GITLAB_MAKE} vms_test_freebsd + after_script: + - ${GITLAB_MAKE} vms_shutdown + +# Packs + +centos_6: + only: + refs: + - master + - /.*/ + image: packpack/packpack:el-6 + stage: deploy + tags: + - deploy + script: + - ${GITLAB_MAKE} package + +centos_7: + only: + refs: + - master + - /.*/ + image: packpack/packpack:el-7 + stage: deploy + tags: + - deploy_test + script: + - ${GITLAB_MAKE} package + +fedora_28: + only: + refs: + - master + - /.*/ + image: packpack/packpack:fedora-28 + stage: deploy + tags: + - deploy_test + script: + - ${GITLAB_MAKE} package + +fedora_29: + only: + refs: + - master + - /.*/ + image: packpack/packpack:fedora-29 + stage: deploy + tags: + - deploy_test + script: + - ${GITLAB_MAKE} package + +fedora_30: + only: + refs: + - master + - /.*/ + image: packpack/packpack:fedora-30 + stage: deploy + tags: + - deploy_test + script: + - ${GITLAB_MAKE} package + +ubuntu_14_04: + only: + refs: + - master + - /.*/ + image: packpack/packpack:ubuntu-trusty + stage: deploy + tags: + - deploy + script: + - ${GITLAB_MAKE} package + +ubuntu_16_04: + only: + refs: + - master + - /.*/ + image: packpack/packpack:ubuntu-xenial + stage: deploy + tags: + - deploy + script: + - ${GITLAB_MAKE} package + +ubuntu_18_04: + only: + refs: + - master + - /.*/ + image: packpack/packpack:ubuntu-bionic + stage: deploy + tags: + - deploy + script: + - ${GITLAB_MAKE} package + +ubuntu_18_10: + only: + refs: + - master + - /.*/ + image: packpack/packpack:ubuntu-cosmic + stage: deploy + tags: + - deploy + script: + - ${GITLAB_MAKE} package + +ubuntu_19_04: + only: + refs: + - master + - /.*/ + image: packpack/packpack:ubuntu-disco + stage: deploy + tags: + - deploy + script: + - ${GITLAB_MAKE} package + +debian_8: + only: + refs: + - master + - /.*/ + image: packpack/packpack:debian-jessie + stage: deploy + tags: + - deploy + script: + - ${GITLAB_MAKE} package + +debian_9: + only: + refs: + - master + - /.*/ + image: packpack/packpack:debian-stretch + stage: deploy + tags: + - deploy + script: + - ${GITLAB_MAKE} package + +debian_10: + only: + refs: + - master + - /.*/ + image: packpack/packpack:debian-buster + stage: deploy + tags: + - deploy + script: + - ${GITLAB_MAKE} package diff --git a/.gitlab.mk b/.gitlab.mk new file mode 100644 index 000000000..793d6ac80 --- /dev/null +++ b/.gitlab.mk @@ -0,0 +1,57 @@ +GITLAB_MAKE?=make -f .gitlab.mk +TRAVIS_MAKE?=make -f .travis.mk +GITLAB_REGISTRY?=registry.gitlab.com + +# docker images bootstrap +docker_set: + $(eval DOCKERFILE := "FROM packpack/packpack:debian-stretch\nCOPY .travis.mk .\nRUN make -f .travis.mk deps_debian") + $(eval IMAGE := ${GITLAB_REGISTRY}/tarantool/tarantool/debian-stretch:master) + +docker_set_lto: + $(eval DOCKERFILE := "FROM packpack/packpack:debian-buster\nCOPY .travis.mk .\nRUN make -f .travis.mk deps_buster_clang_8") + $(eval IMAGE := ${GITLAB_REGISTRY}/tarantool/tarantool/debian-buster:master) + +docker_build: + echo ${DOCKERFILE} | \ + docker build --network=host -t ${IMAGE} -f- . + docker push ${IMAGE} + +docker_bootstrap_nolto: docker_set docker_build +docker_bootstrap_lto: docker_set_lto docker_build +docker_bootstrap: + docker login -u $(USER) ${GITLAB_REGISTRY} + ${GITLAB_MAKE} docker_bootstrap_nolto + ${GITLAB_MAKE} docker_bootstrap_lto + +# build sources with different flags and test +git_submodule_update: + git submodule update --force --recursive --init 2>/dev/null || \ + git submodule update --recursive --init + +test_%_no_deps: git_submodule_update + ${TRAVIS_MAKE} $@ + +# build sources with different flags and test under VBox virtual machines +vms_start: + VBoxManage controlvm ${VMS_NAME} poweroff || true + VBoxManage snapshot ${VMS_NAME} restore ${VMS_NAME} + VBoxManage startvm ${VMS_NAME} --type headless + +vms_test_%: + ssh ${VMS_USER}@127.0.0.1 -p ${VMS_PORT} "/bin/bash -c \ + '${EXTRA_ENV} \ + export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin ; \ + cd tarantool && \ + git fetch -p && \ + git checkout --force ${CI_BUILD_REF} && \ + ${GITLAB_MAKE} git_submodule_update && \ + ${TRAVIS_MAKE} $(subst vms_,,$@)'" + +vms_shutdown: + VBoxManage controlvm ${VMS_NAME} poweroff + +# build packs and test +package: git_submodule_update + git clone https://github.com/packpack/packpack.git packpack + # to avoid of issue with too long names build path is short + make -f packpack/pack/Makefile -C . BUILDDIR=/builds/pack -j diff --git a/.travis.mk b/.travis.mk index 6d0c42207..dc3bdb5ab 100644 --- a/.travis.mk +++ b/.travis.mk @@ -3,6 +3,7 @@ # DOCKER_IMAGE?=packpack/packpack:debian-stretch +TEST_RUN_EXTRA_PARAMS?= all: package @@ -13,8 +14,8 @@ package: test: test_$(TRAVIS_OS_NAME) # Redirect some targets via docker -test_linux: docker_test_ubuntu -coverage: docker_coverage_ubuntu +test_linux: docker_test_debian +coverage: docker_coverage_debian docker_%: mkdir -p ~/.cache/ccache @@ -33,43 +34,42 @@ docker_%: ${DOCKER_IMAGE} \ make -f .travis.mk $(subst docker_,,$@) -deps_ubuntu: - sudo apt-get update && apt-get install -y -f \ +######### +# Linux # +######### + +deps_debian: + apt-get -y update && apt-get install -y -f \ build-essential cmake coreutils sed \ libreadline-dev libncurses5-dev libyaml-dev libssl-dev \ libcurl4-openssl-dev libunwind-dev libicu-dev \ python python-pip python-setuptools python-dev \ python-msgpack python-yaml python-argparse python-six python-gevent \ - lcov ruby clang llvm llvm-dev + lcov ruby clang llvm-dev + +deps_buster_clang_8: deps_debian + echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-8 main" > /etc/apt/sources.list.d/clang_8.list + echo "deb-src http://apt.llvm.org/buster/ llvm-toolchain-buster-8 main" >> /etc/apt/sources.list.d/clang_8.list + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - + apt-get -y update + apt-get -y install clang-8 llvm-8-dev -test_ubuntu: deps_ubuntu +build_debian: cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_WERROR=ON ${CMAKE_EXTRA_PARAMS} - make -j8 - cd test && /usr/bin/python test-run.py --force -j 1 + make -j -deps_osx: - brew update - brew install openssl readline curl icu4c --force - python2 -V || brew install python2 --force - curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | python - pip install -r test-run/requirements.txt +test_debian_no_deps: build_debian + cd test && /usr/bin/python test-run.py --force $(TEST_RUN_EXTRA_PARAMS) -test_osx: deps_osx - cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_WERROR=ON ${CMAKE_EXTRA_PARAMS} - # Increase the maximum number of open file descriptors on macOS - sudo sysctl -w kern.maxfiles=20480 || : - sudo sysctl -w kern.maxfilesperproc=20480 || : - sudo launchctl limit maxfiles 20480 || : - ulimit -S -n 20480 || : - ulimit -n - make -j8 - cd test && ./test-run.py --force -j 1 unit/ app/ app-tap/ box/ box-tap/ +test_debian: deps_debian test_debian_no_deps -coverage_ubuntu: deps_ubuntu +build_coverage_debian: cmake . -DCMAKE_BUILD_TYPE=Debug -DENABLE_GCOV=ON - make -j8 + make -j + +test_coverage_debian_no_deps: build_coverage_debian # Enable --long tests for coverage - cd test && /usr/bin/python test-run.py --force -j 1 --long + cd test && /usr/bin/python test-run.py --force $(TEST_RUN_EXTRA_PARAMS) --long lcov --compat-libtool --directory src/ --capture --output-file coverage.info.tmp lcov --compat-libtool --remove coverage.info.tmp 'tests/*' 'third_party/*' '/usr/*' \ --output-file coverage.info @@ -81,6 +81,59 @@ coverage_ubuntu: deps_ubuntu coveralls-lcov --service-name travis-ci --service-job-id $(TRAVIS_JOB_ID) --repo-token $(COVERALLS_TOKEN) coverage.info; \ fi; +coverage_debian: deps_debian test_coverage_debian_no_deps + +####### +# OSX # +####### + +deps_osx: + brew update + brew install openssl readline curl icu4c --force + python2 -V || brew install python2 --force + curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py >get-pip.py + python get-pip.py --user + pip install --user --ignore-installed -r test-run/requirements.txt + +build_osx: + cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_WERROR=ON ${CMAKE_EXTRA_PARAMS} + make -j + +test_osx_no_deps: build_osx + # Increase the maximum number of open file descriptors on macOS + sudo sysctl -w kern.maxfiles=20480 || : + sudo sysctl -w kern.maxfilesperproc=20480 || : + sudo launchctl limit maxfiles 20480 || : + ulimit -S -n 20480 || : + ulimit -n + cd test && ./test-run.py --force $(TEST_RUN_EXTRA_PARAMS) unit/ app/ app-tap/ box/ box-tap/ + +test_osx: deps_osx test_osx_no_deps + +########### +# FreeBSD # +########### + +deps_freebsd: + sudo pkg install -y git cmake gmake gcc coreutils \ + readline ncurses libyaml openssl curl libunwind icu \ + python27 py27-pip py27-setuptools py27-daemon \ + py27-yaml py27-argparse py27-six py27-gevent \ + gdb bash + +build_freebsd: + cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_WERROR=ON ${CMAKE_EXTRA_PARAMS} + gmake -j + +test_freebsd_no_deps: build_freebsd + cd test && /usr/bin/python test-run.py --force $(TEST_RUN_EXTRA_PARAMS) || true + +test_freebsd: deps_freebsd test_freebsd_no_deps + +#################### +# Sources tarballs # +#################### + source: git clone https://github.com/packpack/packpack.git packpack TARBALL_COMPRESSOR=gz packpack/packpack tarball diff --git a/.travis.yml b/.travis.yml index e94d02ef5..4b39dbd56 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,9 @@ cache: git: depth: 100500 +env: > + TEST_RUN_EXTRA_PARAMS="-j 1" + jobs: include: # Testing targets (just run tests on Debian Stretch or OS X). -- 2.17.1