diff --git a/.drone.star b/.drone.star new file mode 100644 index 00000000..8be42452 --- /dev/null +++ b/.drone.star @@ -0,0 +1,122 @@ +# Use, modification, and distribution are +# subject to the Boost Software License, Version 1.0. (See accompanying +# file LICENSE.txt) +# +# Copyright Rene Rivera 2020. + +# Configuration for https://cloud.drone.io/. + +# For Drone CI we use the Starlark scripting language to reduce duplication. +# As the yaml syntax for Drone CI is rather limited. + +def main(ctx): + addon_base = { "apt": { "packages": [ "software-properties-common", "libffi-dev", "libstdc++6", "binutils-gold", "gdb" ] } } + + return [ + linux_cxx("GCC 6.0, Debug + Coverage", "g++-6", packages=" ".join(addon_base["apt"]["packages"]) + " g++-6 libssl-dev", image="ubuntu:16.04", buildtype="boost", environment={ "VARIANT": "beast_coverage", "TOOLSET": "gcc", "COMPILER": "g++-6", "CXXSTD": "14", "DRONE_BEFORE_INSTALL" : "beast_coverage" }, stepenvironment={"CODECOV_TOKEN": {"from_secret": "codecov_token"}}, privileged=True), + linux_cxx("Default clang++ with libc++", "clang++-libc++", packages=" ".join(addon_base["apt"]["packages"]), image="ubuntu:16.04", buildtype="boost", environment={ "B2_TOOLSET": "clang-7", "B2_CXXSTD": "17,2a", "VARIANT": "debug", "TOOLSET": "clang", "COMPILER": "clang++-libc++", "CXXSTD": "11", "CXX_FLAGS": "-stdlib=libc++ -stdlib=libc++", "TRAVISCLANG" : "yes" }), + linux_cxx("GCC Valgrind", "g++", packages=" ".join(addon_base["apt"]["packages"]) + " g++-7 libssl-dev valgrind", image="ubuntu:20.04", buildtype="boost", environment={ "VARIANT": "beast_valgrind", "TOOLSET": "gcc", "COMPILER": "g++", "CXXSTD": "11" }), + linux_cxx("Default g++", "g++", packages=" ".join(addon_base["apt"]["packages"]), image="ubuntu:16.04", buildtype="boost", environment={ "VARIANT": "release", "TOOLSET": "gcc", "COMPILER": "g++", "CXXSTD": "11" }), + linux_cxx("GCC 8, C++17, libstdc++, release", "g++-8", packages=" ".join(addon_base["apt"]["packages"]) + " g++-8", image="ubuntu:16.04", buildtype="boost", environment={ "VARIANT": "release", "TOOLSET": "gcc", "COMPILER": "g++-8", "CXXSTD" : "17" }), + linux_cxx("Clang 3.8, UBasan", "clang++-3.8", packages=" ".join(addon_base["apt"]["packages"]) + " clang-3.8 libssl-dev", llvm_os="precise", llvm_ver="3.8", image="ubuntu:16.04", buildtype="boost", environment={"VARIANT": "beast_ubasan", "TOOLSET": "clang", "COMPILER": "clang++-3.8", "CXXSTD": "11", "UBSAN_OPTIONS": 'print_stacktrace=1', "DRONE_BEFORE_INSTALL": "UBasan" }), + linux_cxx("docs", "", packages="docbook docbook-xml docbook-xsl xsltproc libsaxonhe-java default-jre-headless flex libfl-dev bison unzip", image="ubuntu:16.04", buildtype="docs", environment={"COMMENT": "docs"}) + ] + +# Generate pipeline for Linux platform compilers. +def linux_cxx(name, cxx, cxxflags="", packages="", llvm_os="", llvm_ver="", arch="amd64", image="ubuntu:16.04", buildtype="boost", environment={}, stepenvironment={}, privileged=False): + environment_global = { + "CXX": cxx, + "CXXFLAGS": cxxflags, + "PACKAGES": packages, + "LLVM_OS": llvm_os, + "LLVM_VER": llvm_ver, + "B2_CI_VERSION": 1, + # see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties + # - B2_ADDRESS_MODEL=64,32 + # - B2_LINK=shared,static + # - B2_THREADING=threading=multi,single + "B2_VARIANT" : "release", + "B2_FLAGS" : "warnings=extra warnings-as-errors=on" + } + environment_current=environment_global + environment_current.update(environment) + + return { + "name": "Linux %s" % name, + "kind": "pipeline", + "type": "docker", + "trigger": { "branch": [ "master","develop", "drone", "bugfix/*", "feature/*", "fix/*", "pr/*" ] }, + "platform": { + "os": "linux", + "arch": arch + }, + # Create env vars per generation arguments. + "environment": environment_current, + "steps": [ + { + "name": "Everything", + "image": image, + "privileged": privileged, + "environment": stepenvironment, + "commands": [ + + "echo '==================================> SETUP'", + "uname -a", + "apt-get -o Acquire::Retries=3 update && DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata && apt-get -o Acquire::Retries=3 install -y sudo software-properties-common wget curl apt-transport-https git cmake make apt-file sudo libssl-dev git build-essential autotools-dev autoconf && rm -rf /var/lib/apt/lists/*", + "for i in {1..3}; do apt-add-repository ppa:git-core/ppa && break || sleep 2; done", + "apt-get -o Acquire::Retries=3 update && apt-get -o Acquire::Retries=3 -y install git", + "echo '==================================> PACKAGES'", + "./.drone/linux-cxx-install.sh", + + "echo '==================================> INSTALL AND COMPILE'", + "./.drone/%s-script.sh" % buildtype, + ] + } + ] + } + +def windows_cxx(name, cxx="g++", cxxflags="", packages="", llvm_os="", llvm_ver="", arch="amd64", image="ubuntu:16.04", buildtype="boost", environment={}, privileged=False): + environment_global = { + "CXX": cxx, + "CXXFLAGS": cxxflags, + "PACKAGES": packages, + "LLVM_OS": llvm_os, + "LLVM_VER": llvm_ver, + "B2_CI_VERSION": 1, + # see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties + # - B2_ADDRESS_MODEL=64,32 + # - B2_LINK=shared,static + # - B2_THREADING=threading=multi,single + "B2_VARIANT" : "release", + "B2_FLAGS" : "warnings=extra warnings-as-errors=on" + } + environment_current=environment_global + environment_current.update(environment) + + return { + "name": "Windows %s" % name, + "kind": "pipeline", + "type": "docker", + "trigger": { "branch": [ "master","develop", "drone", "bugfix/*", "feature/*", "fix/*", "pr/*" ] }, + "platform": { + "os": "windows", + "arch": arch + }, + # Create env vars per generation arguments. + "environment": environment_current, + "steps": [ + { + "name": "Everything", + "image": image, + "privileged": privileged, + "commands": [ + "echo '==================================> SETUP'", + "echo '==================================> PACKAGES'", + "bash.exe ./.drone/windows-msvc-install.sh", + + "echo '==================================> INSTALL AND COMPILE'", + "bash.exe ./.drone/%s-script.sh" % buildtype, + ] + } + ] + } diff --git a/.drone/README.md b/.drone/README.md new file mode 100644 index 00000000..de76c5f8 --- /dev/null +++ b/.drone/README.md @@ -0,0 +1,3 @@ + +.drone.star and other drone scripts originally based on https://github.com/bfgroup/ci_playground + diff --git a/.drone/boost-script.sh b/.drone/boost-script.sh new file mode 100755 index 00000000..82bc82a5 --- /dev/null +++ b/.drone/boost-script.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +set -ex + +export TRAVIS_BUILD_DIR=$(pwd) +export TRAVIS_BRANCH=$DRONE_BRANCH + +echo '==================================> BEFORE_INSTALL' + +if [ "$DRONE_BEFORE_INSTALL" = "beast_coverage" ]; then + pip install --user https://github.com/codecov/codecov-python/archive/master.zip + wget http://downloads.sourceforge.net/ltp/lcov-1.14.tar.gz + tar -xvf lcov-1.14.tar.gz + cd lcov-1.14 + make install + cd .. +fi + +if [ "$DRONE_BEFORE_INSTALL" = "UBasan" ]; then + export PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH +fi + +echo '==================================> INSTALL' + +cd .. +$TRAVIS_BUILD_DIR/tools/get-boost.sh $TRAVIS_BRANCH $TRAVIS_BUILD_DIR +cd boost-root +export PATH=$PATH:"`pwd`" +export BOOST_ROOT=$(pwd) +./bootstrap.sh +cp libs/beast/tools/user-config.jam ~/user-config.jam +echo "using $TOOLSET : : $COMPILER : $CXX_FLAGS ;" >> ~/user-config.jam + +echo '==================================> COMPILE' + +cd ../boost-root +libs/beast/tools/retry.sh libs/beast/tools/build-and-test.sh diff --git a/.drone/docs-script.sh b/.drone/docs-script.sh new file mode 100755 index 00000000..cd7ef3c3 --- /dev/null +++ b/.drone/docs-script.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -ex + +export BOOST_CI_SRC_FOLDER=$(pwd) + +echo '==================================> INSTALL' +pwd +cd .. +mkdir -p $HOME/cache && cd $HOME/cache +if [ ! -d doxygen ]; then git clone -b 'Release_1_8_15' --depth 1 https://github.com/doxygen/doxygen.git && echo "not-cached" ; else echo "cached" ; fi +cd doxygen +cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release +cd build +sudo make install +cd ../.. +if [ ! -f saxonhe.zip ]; then wget -O saxonhe.zip https://sourceforge.net/projects/saxon/files/Saxon-HE/9.9/SaxonHE9-9-1-4J.zip/download && echo "not-cached" ; else echo "cached" ; fi +unzip -o saxonhe.zip +sudo rm /usr/share/java/Saxon-HE.jar +sudo cp saxon9he.jar /usr/share/java/Saxon-HE.jar +cd .. +BOOST_BRANCH=develop && [ "$DRONE_BRANCH" == "master" ] && BOOST_BRANCH=master || true +git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root --depth 1 +cd boost-root +export BOOST_ROOT=$(pwd) +git submodule update --init libs/context +git submodule update --init tools/boostbook +git submodule update --init tools/boostdep +git submodule update --init tools/docca +git submodule update --init tools/quickbook +rsync -av $BOOST_CI_SRC_FOLDER/ libs/json +python tools/boostdep/depinst/depinst.py ../tools/quickbook +./bootstrap.sh +./b2 headers + +echo '==================================> COMPILE' + +echo "using doxygen ; using boostbook ; using saxonhe ;" > tools/build/src/user-config.jam +./b2 -j3 libs/json/doc//boostrelease diff --git a/.drone/linux-cxx-install.sh b/.drone/linux-cxx-install.sh new file mode 100755 index 00000000..5020717a --- /dev/null +++ b/.drone/linux-cxx-install.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +set -ex +echo ">>>>> APT: REPO.." +for i in {1..3}; do sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" && break || sleep 2; done +if test -n "${LLVM_OS}" ; then + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + if test -n "${LLVM_VER}" ; then + sudo -E apt-add-repository "deb http://apt.llvm.org/${LLVM_OS}/ llvm-toolchain-${LLVM_OS}-${LLVM_VER} main" + else + # Snapshot (i.e. trunk) build of clang + sudo -E apt-add-repository "deb http://apt.llvm.org/${LLVM_OS}/ llvm-toolchain-${LLVM_OS} main" + fi +elif [[ $CXX =~ ^clang || $TOOLSET =~ ^clang || $B2_TOOLSET =~ ^clang ]]; then + # Default Travis Installation of clang-7 + LLVM_OS=$(awk -F= '$1=="VERSION_CODENAME" { print $2 ;}' /etc/os-release) + LLVM_VER="7" + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo -E apt-add-repository "deb http://apt.llvm.org/${LLVM_OS}/ llvm-toolchain-${LLVM_OS}-${LLVM_VER} main" + sudo -E apt-get -o Acquire::Retries=3 update + sudo -E apt-get -o Acquire::Retries=3 -y --no-install-suggests --no-install-recommends install libstdc++-8-dev clang-7 libc++-7-dev libc++-helpers libc++abi-7-dev + ln -s /usr/bin/clang-7 /usr/bin/clang + ln -s /usr/bin/clang /usr/bin/clang++ +fi + +echo ">>>>> APT: UPDATE.." +sudo -E apt-get -o Acquire::Retries=3 update +echo ">>>>> APT: INSTALL ${PACKAGES}.." +sudo -E apt-get -o Acquire::Retries=3 -y --no-install-suggests --no-install-recommends install ${PACKAGES} + +MAJOR_VERSION=$(lsb_release -r -s | cut -c 1-2) +if [ "$MAJOR_VERSION" -lt "20" ]; then + sudo -E apt-get -o Acquire::Retries=3 -y install python python-pip +fi + +if [ "$MAJOR_VERSION" -gt "18" ]; then + sudo -E apt-get -o Acquire::Retries=3 -y install python3 python3-pip + ln -s /usr/bin/python3 /usr/bin/python + ln -s /usr/bin/pip3 /usr/bin/pip +fi diff --git a/tools/build-and-test.sh b/tools/build-and-test.sh index 7d95f6f3..5ab8ee75 100755 --- a/tools/build-and-test.sh +++ b/tools/build-and-test.sh @@ -149,7 +149,12 @@ if [[ $VARIANT == "beast_coverage" ]]; then lcov -a baseline.info -a testrun-all.info -o lcov-diff.info > /dev/null lcov -e "lcov-diff.info" "$INC_DIR/*" -o lcov.info > /dev/null lcov --remove "lcov.info" "$INC_DIR/_experimental/*" -o lcov.info > /dev/null - ~/.local/bin/codecov -X gcov -f lcov.info + echo "Change working directory for codecov:" + pwd + pushd . + cd libs/beast + ~/.local/bin/codecov -X gcov -f ../../lcov.info + popd find "$BOOST_ROOT" -name "*.gcda" | xargs rm -f elif [[ $VARIANT == "beast_valgrind" ]]; then