Add Gitlab CI config
This commit is contained in:
parent
b328640745
commit
7a3153966e
5 changed files with 279 additions and 0 deletions
123
.gitlab-ci.yml
Normal file
123
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,123 @@
|
|||
## Raiblocks CI config
|
||||
|
||||
image: ubuntu:zesty
|
||||
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
|
||||
variables:
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
|
||||
.linux_template: &linux_cfg
|
||||
variables:
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
|
||||
artifacts:
|
||||
expire_in: 2d
|
||||
paths:
|
||||
- build*/*.tar*
|
||||
- build*/*_test
|
||||
- csa_results
|
||||
|
||||
script:
|
||||
- ./ci/build.sh
|
||||
|
||||
after_script:
|
||||
- ./ci/test.sh
|
||||
|
||||
|
||||
Arch Linux:
|
||||
<<: *linux_cfg
|
||||
stage: build
|
||||
image: pritunl/archlinux:latest
|
||||
|
||||
before_script:
|
||||
- pacman --noconfirm -Syu base-devel qt5-tools xorg-server-xvfb clang clang-tools-extra cmake boost boost-libs ninja lsb-release
|
||||
|
||||
script:
|
||||
- mkdir -p csa_results/
|
||||
- scan-build -o csa_results/ ./ci/build.sh
|
||||
|
||||
|
||||
Ubuntu Linux Trusty:
|
||||
<<: *linux_cfg
|
||||
stage: build
|
||||
image: ubuntu:trusty
|
||||
variables:
|
||||
BOOST_ROOT: /usr/local/boost
|
||||
CC: gcc
|
||||
CXX: g++
|
||||
NO_SIMD: 1
|
||||
FLAVOR: trusty_no_simd
|
||||
|
||||
before_script:
|
||||
- ./ci/ubuntu_prep.sh
|
||||
- ./ci/bootstrap_boost.sh
|
||||
|
||||
|
||||
Ubuntu Linux Zesty:
|
||||
<<: *linux_cfg
|
||||
stage: build
|
||||
image: ubuntu:zesty
|
||||
variables:
|
||||
FLAVOR: zesty
|
||||
|
||||
before_script:
|
||||
- ./ci/ubuntu_prep.sh
|
||||
|
||||
|
||||
Ubuntu Linux:ASAN:
|
||||
<<: *linux_cfg
|
||||
stage: build
|
||||
variables:
|
||||
ASAN: 1
|
||||
|
||||
before_script:
|
||||
- ./ci/ubuntu_prep.sh
|
||||
|
||||
variables:
|
||||
FLAVOR: zesty_asan
|
||||
|
||||
|
||||
Ubuntu Linux:TSAN:
|
||||
<<: *linux_cfg
|
||||
stage: build
|
||||
variables:
|
||||
TSAN: 1
|
||||
|
||||
before_script:
|
||||
- ./ci/ubuntu_prep.sh
|
||||
|
||||
variables:
|
||||
FLAVOR: zesty_tsan
|
||||
|
||||
|
||||
# DISABLED: Shared runners avail for gitlab CI
|
||||
# don't include OS X
|
||||
.OS X:
|
||||
stage: build
|
||||
variables:
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
tags:
|
||||
- clang
|
||||
- osx
|
||||
|
||||
script:
|
||||
- ./ci/build.sh
|
||||
|
||||
# DISABLED for now
|
||||
.Alpine Linux:
|
||||
stage: build
|
||||
image: alpine:latest
|
||||
variables:
|
||||
BUSYBOX_BASH: 1
|
||||
|
||||
before_script:
|
||||
- apk add --update alpine-sdk autoconf automake libtool clang-dev cmake ninja qt5-qtbase-dev qt5-qttools-dev boost-dev ttf-freefont xvfb
|
||||
|
||||
script:
|
||||
- ./ci/build.sh
|
||||
|
15
ci/bootstrap_boost.sh
Executable file
15
ci/bootstrap_boost.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
BOOST_BASENAME=boost_1_63_0
|
||||
BOOST_ROOT=${BOOST_ROOT-/usr/local/boost}
|
||||
BOOST_URL=http://sourceforge.net/projects/boost/files/boost/1.63.0/${BOOST_BASENAME}.tar.gz/download
|
||||
|
||||
wget -O ${BOOST_BASENAME}.tar.gz ${BOOST_URL}
|
||||
tar xf ${BOOST_BASENAME}.tar.gz
|
||||
cd ${BOOST_BASENAME}
|
||||
./bootstrap.sh
|
||||
./b2 --prefix=${BOOST_ROOT} link=static install
|
||||
rm -rf ${BOOST_BASENAME}
|
||||
rm -f ${BOOST_BASENAME}.tar.gz
|
||||
cd ..
|
||||
mkdir app
|
77
ci/build.sh
Executable file
77
ci/build.sh
Executable file
|
@ -0,0 +1,77 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
DISTRO_CFG=""
|
||||
if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
||||
CPACK_TYPE="TBZ2"
|
||||
distro=$(lsb_release -i -s)
|
||||
DISTRO_CFG="-DRAIBLOCKS_DISTRO_NAME=${distro}"
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
CPACK_TYPE="DragNDrop"
|
||||
elif [[ "$OSTYPE" == "cygwin" ]]; then
|
||||
CPACK_TYPE="TBZ2"
|
||||
elif [[ "$OSTYPE" == "msys" ]]; then
|
||||
CPACK_TYPE="NSIS" #?
|
||||
elif [[ "$OSTYPE" == "win32" ]]; then
|
||||
CPACK_TYPE="NSIS"
|
||||
elif [[ "$OSTYPE" == "freebsd"* ]]; then
|
||||
CPACK_TYPE="TBZ2"
|
||||
DISTRO_CFG="-DRAIBLOCKS_DISTRO_NAME='freebsd'"
|
||||
else
|
||||
CPACK_TYPE="TBZ2"
|
||||
fi
|
||||
|
||||
if [[ ${NO_SIMD} -eq 1 ]]; then
|
||||
NOSIMD_CFG="-DRAIBLOCKS_SIMD_OPTIMIZATIONS=OFF"
|
||||
CRYPTOPP_CFG="-DCRYPTOPP_CUSTOM=ON"
|
||||
else
|
||||
NOSIMD_CFG=""
|
||||
CRYPTOPP_CFG=""
|
||||
fi
|
||||
|
||||
if [[ ${ASAN_INT} -eq 1 ]]; then
|
||||
SANITIZERS="-DRAIBLOCKS_ASAN_INT=ON"
|
||||
elif [[ ${ASAN} -eq 1 ]]; then
|
||||
SANITIZERS="-DRAIBLOCKS_ASAN=ON"
|
||||
elif [[ ${TSAN} -eq 1 ]]; then
|
||||
SANITIZERS="-DRAIBLOCKS_TSAN=ON"
|
||||
else
|
||||
SANITIZERS=""
|
||||
fi
|
||||
|
||||
if [[ ${BOOST_ROOT} -ne "" ]]; then
|
||||
BOOST_CFG="-DBOOST_ROOT='${BOOST_ROOT}'"
|
||||
else
|
||||
BOOST_CFG=""
|
||||
fi
|
||||
|
||||
BUSYBOX_BASH=${BUSYBOX_BASH-0}
|
||||
if [[ ${FLAVOR-_} == "_" ]]; then
|
||||
FLAVOR=""
|
||||
fi
|
||||
|
||||
set -o nounset
|
||||
|
||||
run_build() {
|
||||
build_dir=build_${FLAVOR}
|
||||
|
||||
mkdir ${build_dir}
|
||||
cd ${build_dir}
|
||||
cmake -GNinja \
|
||||
-DRAIBLOCKS_TEST=ON \
|
||||
-DRAIBLOCKS_GUI=ON \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
-DCMAKE_INSTALL_PREFIX="../install" \
|
||||
${CRYPTOPP_CFG} \
|
||||
${DISTRO_CFG} \
|
||||
${NOSIMD_CFG} \
|
||||
${BOOST_CFG} \
|
||||
${SANITIZERS} \
|
||||
..
|
||||
|
||||
cmake --build ${PWD} -- -v
|
||||
cmake --build ${PWD} -- install -v
|
||||
cpack -G ${CPACK_TYPE} ${PWD}
|
||||
}
|
||||
|
||||
run_build
|
50
ci/test.sh
Executable file
50
ci/test.sh
Executable file
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
BUSYBOX_BASH=${BUSYBOX_BASH-0}
|
||||
|
||||
if [[ ${FLAVOR-_} == "_" ]]; then
|
||||
FLAVOR=""
|
||||
fi
|
||||
|
||||
set -o nounset
|
||||
|
||||
|
||||
# Alpine doesn't offer an xvfb
|
||||
xvfb_run_() {
|
||||
INIT_DELAY_SEC=3
|
||||
|
||||
Xvfb :2 -screen 0 1024x768x24 &
|
||||
xvfb_pid=$!
|
||||
sleep ${INIT_DELAY_SEC}
|
||||
DISPLAY=:2 timeout ${TIMEOUT_TIME_ARG} ${TIMEOUT_SEC-1200} $@
|
||||
res=${?}
|
||||
kill ${xvfb_pid}
|
||||
|
||||
exit ${res}
|
||||
}
|
||||
|
||||
run_tests() {
|
||||
build_dir=build_${FLAVOR}
|
||||
|
||||
cd ./${build_dir}
|
||||
|
||||
# when busybox pretends to be bash it needs different args
|
||||
# for the timeout builtin
|
||||
if [[ "${BUSYBOX_BASH}" -eq 1 ]]; then
|
||||
TIMEOUT_TIME_ARG="-t"
|
||||
else
|
||||
TIMEOUT_TIME_ARG=""
|
||||
fi
|
||||
|
||||
timeout ${TIMEOUT_TIME_ARG} ${TIMEOUT_SEC-1200} ./core_test
|
||||
core_test_res=${?}
|
||||
|
||||
xvfb_run_ ./qt_test
|
||||
qt_test_res=${?}
|
||||
|
||||
echo "Core Test return code: ${core_test_res}"
|
||||
echo "QT Test return code: ${qt_test_res}"
|
||||
exit $((${core_test_res} + ${qt_test_res}))
|
||||
}
|
||||
|
||||
run_tests
|
14
ci/ubuntu_prep.sh
Executable file
14
ci/ubuntu_prep.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
apt-get update
|
||||
apt-get --yes --force-yes install git cmake ninja-build autotools-dev \
|
||||
build-essential g++ clang python-dev \
|
||||
libicu-dev libbz2-dev libboost-all-dev \
|
||||
locales wget curl apt-utils \
|
||||
lsb-release
|
||||
apt-get --yes --force-yes install xorg xvfb xauth xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic
|
||||
apt-get --yes --force-yes install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler
|
Loading…
Add table
Add a link
Reference in a new issue