From cdc8aaad6aa892b6031dfd358b2b6a20d9d49de1 Mon Sep 17 00:00:00 2001 From: Graham Whaley Date: Thu, 30 Apr 2020 11:48:08 +0100 Subject: [PATCH 1/2] kata-pkgsync: Fix spelling mistake Whilst enabling the static CI checks for this repo, it picked up a spelling mistake. We'll need to fix that before we can enable the CI. Signed-off-by: Graham Whaley --- cmd/kata-pkgsync/cli/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/kata-pkgsync/cli/main.go b/cmd/kata-pkgsync/cli/main.go index 11a04a9be..db4a6845c 100644 --- a/cmd/kata-pkgsync/cli/main.go +++ b/cmd/kata-pkgsync/cli/main.go @@ -258,7 +258,7 @@ func main() { logrus.WithFields(logrus.Fields{ "OBS project": proj.Name, "Packagecloud Repo": pc.Repo, - }).Infof("Sucessfully transferred %d files", totalXferred) + }).Infof("Successfully transferred %d files", totalXferred) } if !*pcDelete { From 997312e574aee0db007feb8f91e9cfbc5c075a2b Mon Sep 17 00:00:00 2001 From: Graham Whaley Date: Thu, 30 Apr 2020 13:26:29 +0100 Subject: [PATCH 2/2] CI: enable Travis for static checks Enable the Travis CI configuration to perform static CI checks on PRs to this repo. Fixes: #1031 Signed-off-by: Graham Whaley --- .ci/lib.sh | 34 ++++++++++++++++++++++++++++++++++ .ci/static-checks.sh | 15 +++++++-------- .travis.yml | 24 ++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 .ci/lib.sh create mode 100644 .travis.yml diff --git a/.ci/lib.sh b/.ci/lib.sh new file mode 100644 index 000000000..475658d9f --- /dev/null +++ b/.ci/lib.sh @@ -0,0 +1,34 @@ +# +# Copyright (c) 2018,2020 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +export tests_repo="${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 + if [ -n "${TRAVIS_BRANCH:-}" ]; then + ( cd "${tests_repo_dir}" && git checkout "${TRAVIS_BRANCH}" ) + fi +} + +run_static_checks() +{ + clone_tests_repo + bash "$tests_repo_dir/.ci/static-checks.sh" "github.com/kata-containers/packaging" +} + +run_go_test() +{ + clone_tests_repo + bash "$tests_repo_dir/.ci/go-test.sh" +} diff --git a/.ci/static-checks.sh b/.ci/static-checks.sh index d314c4954..54c1042ee 100755 --- a/.ci/static-checks.sh +++ b/.ci/static-checks.sh @@ -1,14 +1,13 @@ #!/bin/bash # -# Copyright (c) 2018 Intel Corporation +# Copyright (c) 2018,2020 Intel Corporation # # SPDX-License-Identifier: Apache-2.0 -# -set -o errexit -set -o nounset -set -o pipefail +set -e -# This script should run any static analysis check -# It is called by the CI setup -true +cidir=$(dirname "$0") +source "${cidir}/lib.sh" + +# Run static checks +run_static_checks diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..722f54b79 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,24 @@ +# +# Copyright 2017 HyperHQ Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +sudo: required +dist: bionic + +os: + - linux + - linux-ppc64le + +language: go +go_import_path: github.com/kata-containers/packaging + +env: + - target_branch=$TRAVIS_BRANCH + +before_script: + - ".ci/setup.sh" + +script: + - bash .ci/static-checks.sh github.com/kata-containers/packaging