From 895aad108e3c131189d4f6c80fcab2355e217edf Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Tue, 23 Jan 2018 14:48:25 +0000 Subject: [PATCH] CI: Enable checkcommits Require all PRs to contain a "Fixes #XXX" comment and a "Signed-off-by:" comment by running the central static checks script. Note that the static checks script will detect if the repository contains golang code and only run those checks if it does. Fixes #12. Signed-off-by: James O. D. Hunt --- .ci/lib.sh | 25 +++++++++++++++++++++++++ .ci/setup.sh | 3 +++ .ci/static-checks.sh | 12 ++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 .ci/lib.sh create mode 100755 .ci/static-checks.sh diff --git a/.ci/lib.sh b/.ci/lib.sh new file mode 100644 index 000000000..a3f163026 --- /dev/null +++ b/.ci/lib.sh @@ -0,0 +1,25 @@ +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +export tests_repo="github.com/kata-containers/tests" +export tests_repo_dir="$GOPATH/src/$tests_repo" + +clone_tests_repo() +{ + # KATA_CI_NO_NETWORK is (has to be) ignored if there is + # no existing clone. + if [ -d "$tests_repo_dir" -a -n "$KATA_CI_NO_NETWORK" ] + then + return + fi + + go get -d -u "$tests_repo" || true +} + +run_static_checks() +{ + clone_tests_repo + bash "$tests_repo_dir/.ci/static-checks.sh" +} diff --git a/.ci/setup.sh b/.ci/setup.sh index ec9b2fd97..43b886837 100755 --- a/.ci/setup.sh +++ b/.ci/setup.sh @@ -5,6 +5,9 @@ # SPDX-License-Identifier: Apache-2.0 # +cidir=$(dirname "$0") +bash "${cidir}/static-checks.sh" + #Note: If add clearlinux as supported CI use a stateless os-release file source /etc/os-release diff --git a/.ci/static-checks.sh b/.ci/static-checks.sh new file mode 100755 index 000000000..cfadeaf8a --- /dev/null +++ b/.ci/static-checks.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +set -e + +cidir=$(dirname "$0") +source "${cidir}/lib.sh" + +run_static_checks