Improve CI and packaging:

* add travis build for min cmake supported
* add travis build for validator keys (uses xrpl_core)
* add travis build for ipv6 (mac only)
* add cmake target for validator keys via FetchContent
* use validator keys target in package build
This commit is contained in:
Mike Ellery
2019-08-27 08:23:11 -07:00
committed by Nik Bougalis
parent 5834fbbc5d
commit 008fc5155a
14 changed files with 197 additions and 104 deletions

View File

@@ -259,7 +259,7 @@ function (git_hash hash_val)
if (NOT GIT_FOUND)
return ()
endif ()
set (_hash "unknown")
set (_hash "")
set (_format "%H")
if (ARGC GREATER_EQUAL 2)
string (TOLOWER ${ARGV1} _short)
@@ -278,3 +278,21 @@ function (git_hash hash_val)
endif ()
set (${hash_val} "${_hash}" PARENT_SCOPE)
endfunction ()
function (git_branch branch_val)
if (NOT GIT_FOUND)
return ()
endif ()
set (_branch "")
execute_process (COMMAND ${GIT_EXECUTABLE} "rev-parse" "--abbrev-ref" "HEAD"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE _git_exit_code
OUTPUT_VARIABLE _temp_branch
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
if (_git_exit_code EQUAL 0)
set (_branch ${_temp_branch})
endif ()
set (${branch_val} "${_branch}" PARENT_SCOPE)
endfunction ()

View File

@@ -15,8 +15,13 @@ RUN chmod +x /tmp/centos_setup.sh && \
chmod +x /tmp/install_cmake.sh && \
chmod +x /tmp/extras.sh
RUN /tmp/centos_setup.sh
RUN /tmp/install_cmake.sh
RUN /tmp/install_cmake.sh 3.15.2 /opt/local/cmake-3.15
RUN ln -s /opt/local/cmake-3.15 /opt/local/cmake
ENV PATH="/opt/local/cmake/bin:$PATH"
# also install min supported cmake for testing
RUN if [ "${CI_USE}" = true ] ; then /tmp/install_cmake.sh 3.9.0 /opt/local/cmake-3.9; fi
RUN source scl_source enable devtoolset-7 python27 && \
/tmp/build_deps.sh
ENV BOOST_ROOT="/opt/local/boost/_INSTALLED_"

View File

@@ -11,7 +11,7 @@ RIPPLED_DPKG_VERSION=$(echo "${RIPPLED_VERSION}" | sed 's!-!~!g')
# version here (hardcoded to 1). Does it ever need to change?
RIPPLED_DPKG_FULL_VERSION="${RIPPLED_DPKG_VERSION}-1"
cd rippled
cd /opt/rippled_bld/pkg/rippled
if [[ -n $(git status --porcelain) ]]; then
git status
error "Unstaged changes in this repo - please commit first"

View File

@@ -25,20 +25,11 @@ override_dh_auto_configure:
override_dh_auto_build:
cd bld && \
cmake --build . --parallel -- -v
cmake --build . --target rippled --target validator-keys --parallel -- -v
override_dh_auto_install:
cd bld && DESTDIR=../debian/tmp cmake --build . --target install -- -v
rm -rf bld_vl
mkdir -p bld_vl
cd bld_vl && \
cmake ../../validator-keys-tool -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=${PWD}/debian/tmp/opt/ripple/ \
-Dstatic=true \
-DCMAKE_VERBOSE_MAKEFILE=ON && \
cmake --build . --parallel -- -v
install -D bld_vl/validator-keys debian/tmp/opt/ripple/bin/validator-keys
install -D bld/validator-keys/validator-keys debian/tmp/opt/ripple/bin/validator-keys
install -D Builds/containers/shared/update-rippled.sh debian/tmp/opt/ripple/bin/update-rippled.sh
install -D Builds/containers/shared/update-rippled-cron debian/tmp/opt/ripple/etc/update-rippled-cron
install -D Builds/containers/shared/rippled-logrotate debian/tmp/etc/logrotate.d/rippled

View File

@@ -25,14 +25,14 @@ if [[ $RPM_PATCH ]]; then
export RPM_PATCH
fi
cd rippled
cd /opt/rippled_bld/pkg/rippled
if [[ -n $(git status --porcelain) ]]; then
git status
error "Unstaged changes in this repo - please commit first"
fi
git archive --format tar.gz --prefix rippled/ -o ../rpmbuild/SOURCES/rippled.tar.gz HEAD
# TODO include validator-keys sources
cd ..
tar -zc --exclude-vcs -f ./rpmbuild/SOURCES/validator-keys.tar.gz validator-keys-tool/
source /opt/rh/devtoolset-8/enable

View File

@@ -11,7 +11,6 @@ Summary: rippled daemon
License: MIT
URL: http://ripple.com/
Source0: rippled.tar.gz
Source1: validator-keys.tar.gz
BuildRequires: protobuf-static openssl-static cmake zlib-static ninja-build
@@ -27,26 +26,14 @@ Requires: openssl-static, zlib-static
core library for development of standalone applications that sign transactions.
%prep
%setup -c -n rippled -a 1
%setup -c -n rippled
%build
cd rippled
mkdir -p bld.release
cd bld.release
cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_BUILD_TYPE=Release -Dstatic=true -DCMAKE_VERBOSE_MAKEFILE=ON -Dlocal_protobuf=ON
# build VK
cd ../../validator-keys-tool
mkdir -p bld.release
cd bld.release
# Install a copy of the rippled artifacts into a local VK build dir so that it
# can use them to build against (VK needs xrpl_core lib to build). We install
# into a local build dir instead of buildroot because we want VK to have
# relative paths embedded in debug info, otherwise check-buildroot (rpmbuild)
# will complain
mkdir xrpl_dir
DESTDIR="%{_builddir}/validator-keys-tool/bld.release/xrpl_dir" cmake --build ../../rippled/bld.release --target install -- -v
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=%{_builddir}/validator-keys-tool/bld.release/xrpl_dir/opt/ripple -Dstatic=true -DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build . --parallel -- -v
cmake --build . --parallel --target rippled --target validator-keys -- -v
%pre
test -e /etc/pki/tls || { mkdir -p /etc/pki; ln -s /usr/lib/ssl /etc/pki/tls; }
@@ -59,7 +46,7 @@ install -d ${RPM_BUILD_ROOT}/usr/local/bin
ln -s %{_prefix}/etc/rippled.cfg ${RPM_BUILD_ROOT}/etc/opt/ripple/rippled.cfg
ln -s %{_prefix}/etc/validators.txt ${RPM_BUILD_ROOT}/etc/opt/ripple/validators.txt
ln -s %{_prefix}/bin/rippled ${RPM_BUILD_ROOT}/usr/local/bin/rippled
install -D validator-keys-tool/bld.release/validator-keys ${RPM_BUILD_ROOT}%{_bindir}/validator-keys
install -D rippled/bld.release/validator-keys/validator-keys ${RPM_BUILD_ROOT}%{_bindir}/validator-keys
install -D ./rippled/Builds/containers/shared/rippled.service ${RPM_BUILD_ROOT}/usr/lib/systemd/system/rippled.service
install -D ./rippled/Builds/containers/packaging/rpm/50-rippled.preset ${RPM_BUILD_ROOT}/usr/lib/systemd/system-preset/50-rippled.preset
install -D ./rippled/Builds/containers/shared/update-rippled.sh ${RPM_BUILD_ROOT}%{_bindir}/update-rippled.sh
@@ -109,6 +96,9 @@ chown -R root:$GROUP_NAME %{_prefix}/etc/update-rippled-cron
%{_prefix}/lib/cmake/ripple
%changelog
* Wed Aug 28 2019 Mike Ellery <mellery451@gmail.com>
- Switch to subproject build for validator-keys
* Wed May 15 2019 Mike Ellery <mellery451@gmail.com>
- Make validator-keys use local rippled build for core lib

View File

@@ -1,16 +1,34 @@
#!/usr/bin/env bash
set -ex
set -e
cd /tmp
CM_INSTALLER=cmake-3.15.2-Linux-x86_64.sh
CM_VER_DIR=/opt/local/cmake-3.15
wget https://cmake.org/files/v3.15/$CM_INSTALLER
chmod a+x $CM_INSTALLER
mkdir -p $CM_VER_DIR
ln -s $CM_VER_DIR /opt/local/cmake
./$CM_INSTALLER --prefix=$CM_VER_DIR --exclude-subdir
rm -f /tmp/$CM_INSTALLER
IFS=. read cm_maj cm_min cm_rel <<<"$1"
: ${cm_rel:-0}
CMAKE_ROOT=${2:-"${HOME}/cmake"}
export PATH="/opt/local/cmake/bin:${PATH}"
function cmake_version ()
{
if [[ -d ${CMAKE_ROOT} ]] ; then
local perms=$(test $(uname) = "Linux" && echo "/111" || echo "+111")
local installed=$(find ${CMAKE_ROOT} -perm ${perms} -type f -name cmake)
if [[ "${installed}" != "" ]] ; then
echo "$(${installed} --version | head -1)"
fi
fi
}
installed=$(cmake_version)
if [[ "${installed}" != "" && ${installed} =~ ${cm_maj}.${cm_min}.${cm_rel} ]] ; then
echo "cmake already installed: ${installed}"
exit
fi
pkgname="cmake-${cm_maj}.${cm_min}.${cm_rel}-$(uname)-x86_64.tar.gz"
tmppkg="/tmp/cmake.tar.gz"
wget --quiet https://cmake.org/files/v${cm_maj}.${cm_min}/${pkgname} -O ${tmppkg}
mkdir -p ${CMAKE_ROOT}
cd ${CMAKE_ROOT}
tar --strip-components 1 -xf ${tmppkg}
rm -f ${tmppkg}
echo "installed: $(cmake_version)"

View File

@@ -8,13 +8,6 @@ function error {
cd /opt/rippled_bld/pkg/rippled
export RIPPLED_VERSION=$(egrep -i -o "\b(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9a-z\-]+(\.[0-9a-z\-]+)*)?(\+[0-9a-z\-]+(\.[0-9a-z\-]+)*)?\b" src/ripple/protocol/impl/BuildInfo.cpp)
cd ..
git clone https://github.com/ripple/validator-keys-tool.git
cd validator-keys-tool
git checkout origin/master
git submodule update --init --recursive
cd ..
: ${PKG_OUTDIR:=/opt/rippled_bld/pkg/out}
export PKG_OUTDIR
if [ ! -d ${PKG_OUTDIR} ]; then

View File

@@ -14,8 +14,13 @@ RUN chmod +x /tmp/ubuntu_setup.sh && \
chmod +x /tmp/install_boost.sh && \
chmod +x /tmp/install_cmake.sh
RUN /tmp/ubuntu_setup.sh
RUN /tmp/install_cmake.sh
RUN /tmp/install_cmake.sh 3.15.2 /opt/local/cmake-3.15
RUN ln -s /opt/local/cmake-3.15 /opt/local/cmake
ENV PATH="/opt/local/cmake/bin:$PATH"
# also install min supported cmake for testing
RUN if [ "${CI_USE}" = true ] ; then /tmp/install_cmake.sh 3.9.0 /opt/local/cmake-3.9; fi
RUN /tmp/build_deps.sh
ENV PLANTUML_JAR="/opt/plantuml/plantuml.jar"
ENV BOOST_ROOT="/opt/local/boost/_INSTALLED_"