From fe7f0ab2cee0f40d17e182cb3fb7107e6014e9a9 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sat, 20 Jun 2020 20:49:35 +0200 Subject: Clean up scripts related to CI and Docker --- ci/build | 30 ++++++++++++++++++------------ ci/build-and-verify-package | 11 +++++------ ci/build-and-verify-package-source | 17 ++++++++--------- 3 files changed, 31 insertions(+), 27 deletions(-) (limited to 'ci') diff --git a/ci/build b/ci/build index 3b42db63..9cc44297 100755 --- a/ci/build +++ b/ci/build @@ -1,15 +1,21 @@ -#!/bin/sh -ex -# This script is used by .travis.yml and build-in-docker +#!/bin/sh +# +# This script is used by .travis.yml and build-in-docker. -if [ -n "${SPECIAL}" ]; then - sh ci/${SPECIAL} +set -eu + +if [ -n "${VERBOSE:-}" ]; then + set -x +fi + +if [ -n "${SPECIAL:-}" ]; then + exec "ci/$SPECIAL" else - mkdir -p ${BUILDDIR:-build} - cd ${BUILDDIR:-build} - ${CMAKE_PREFIX:-} cmake ${CCACHE_LOC:-..} ${CMAKE_PARAMS:-} - # 4 threads seems a reasonable default for Travis - ${CMAKE_PREFIX:-} cmake --build . ${BUILDEXTRAFLAGS:-} -- -j4 - # Warning: Rare random failures when running with j4. - test "${RUN_TESTS:-1}" -eq "1" && ctest --output-on-failure -j1 + mkdir -p ${BUILDDIR:-build} + cd ${BUILDDIR:-build} + ${CMAKE_PREFIX:-} cmake "${CCACHE_LOC:-..}" ${CMAKE_PARAMS:-} + # 4 jobs seem to be a reasonable default for Travis. + ${CMAKE_PREFIX:-} cmake --build . ${BUILDEXTRAFLAGS:-} -- -j4 + # Warning: Rare random failures when running with -j4. + [ "${RUN_TESTS:-1}" -ne "1" ] || ctest --output-on-failure -j1 fi -exit 0 diff --git a/ci/build-and-verify-package b/ci/build-and-verify-package index bdf6acd8..3dfffa8f 100755 --- a/ci/build-and-verify-package +++ b/ci/build-and-verify-package @@ -1,20 +1,19 @@ -#!/bin/sh -ex +#!/bin/sh -echo "Warning: Binary package support is rather experimental\n" +set -eu +rm -rf build_package_dir_test mkdir -p build_package_dir_test cd build_package_dir_test -rm -rf * cmake .. cmake --build . --target package # get out of git directory just to be sure tmp_dir=$(mktemp -d) +trap "rm -rf $tmp_dir" EXIT tar -xzf ccache-binary.tar.gz -C $tmp_dir CCACHE=$tmp_dir/ccache-binary/bin/ccache ../test/run -rm -rf $tmp_dir - -echo "\n\nbinary package is fine and can be used!\n\n" +echo "Binary package is fine and can be used." diff --git a/ci/build-and-verify-package-source b/ci/build-and-verify-package-source index 221f813d..69152dfa 100755 --- a/ci/build-and-verify-package-source +++ b/ci/build-and-verify-package-source @@ -1,26 +1,25 @@ -#!/bin/sh -ex +#!/bin/sh -echo "Warning: Source package support is rather experimental\n" +set -eu +rm -rf build_package_source_dir_test mkdir -p build_package_source_dir_test cd build_package_source_dir_test -rm -rf * cmake .. cmake --build . --target package_source # get out of git directory # Unfortunately this random name will prevent ccache from caching results... -# ToDo: use '../../temp' instead? +# TODO: use '../../temp' instead? tmp_dir=$(mktemp -d) +trap "rm -rf $tmp_dir" EXIT -tar -xzf ccache-src.tar.gz -C $tmp_dir -cd $tmp_dir +tar -xf ccache-src.tar.gz -C $tmp_dir +cd $tmp_dir/ccache-src cmake . cmake --build . -- -j4 ctest --output-on-failure -j4 -rm -rf $tmp_dir - -echo "\n\nsource package is fine and can be used!\n\n" +echo "Source package is fine and can be used." -- cgit v1.2.1