diff --git a/.ci/test.sh b/.ci/test.sh new file mode 100755 index 000000000..051f2bba7 --- /dev/null +++ b/.ci/test.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +set -o errexit +set -o nounset +set -o pipefail + +CI=${CI:-} +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +readonly toplevel_mk="${script_dir}/../Makefile" +source "${script_dir}/lib.sh" + +make_target() { + target=$1 + dir=$2 + + pushd "${script_dir}/.." >> /dev/null + if [ -n "${CI}" ] && ! git whatchanged origin/master..HEAD "${dir}" | grep "${dir}" >> /dev/null; then + echo "Not changes in ${dir}" + return + fi + popd >> /dev/null + echo "Changes found in $dir" + make -f "${toplevel_mk}" ${target} +} + +make_target test-release-tools "release/" +make_target test-packaging-tools "obs-packaging/" +make_target test-static-build "static-build/" diff --git a/Makefile b/Makefile index 8fede28cd..059f5bba0 100644 --- a/Makefile +++ b/Makefile @@ -8,15 +8,14 @@ MK_DIR :=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) .PHONY: test test-release-tools -test: test-release-tools test-packaging-tools +test: + @$(MK_DIR)/.ci/test.sh test-release-tools: @$(MK_DIR)/release/tag_repos_test.sh +test-static-build: + @make -f $(MK_DIR)/static-build/qemu/Makefile + test-packaging-tools: -ifndef CI @$(MK_DIR)/build_from_docker.sh -else - @echo "Skip test-packaging-tools" - @echo "See: https://github.com/kata-containers/packaging/issues/68" -endif diff --git a/static-build/qemu/build-static-qemu.sh b/static-build/qemu/build-static-qemu.sh index 9fcdbbcdb..e5bb08fb0 100755 --- a/static-build/qemu/build-static-qemu.sh +++ b/static-build/qemu/build-static-qemu.sh @@ -44,6 +44,6 @@ docker build \ -t qemu-static docker run \ - -ti \ + -i \ -v "${PWD}":/share qemu-static \ mv /tmp/qemu-static/kata-qemu-static.tar.gz /share/