github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/.ci/lib.sh (about)

     1  #
     2  # Copyright (c) 2018 Intel Corporation
     3  #
     4  # SPDX-License-Identifier: Apache-2.0
     5  
     6  export tests_repo="${tests_repo:-github.com/kata-containers/tests}"
     7  export tests_repo_dir="$GOPATH/src/$tests_repo"
     8  
     9  clone_tests_repo()
    10  {
    11  	# KATA_CI_NO_NETWORK is (has to be) ignored if there is
    12  	# no existing clone.
    13  	if [ -d "$tests_repo_dir" -a -n "$KATA_CI_NO_NETWORK" ]
    14  	then
    15  		return
    16  	fi
    17  
    18  	go get -d -u "$tests_repo" || true
    19  	if [ -n "${TRAVIS_BRANCH:-}" ]; then
    20  		( cd "${tests_repo_dir}" && git checkout "${TRAVIS_BRANCH}" )
    21  	fi
    22  }
    23  
    24  run_static_checks()
    25  {
    26  	clone_tests_repo
    27  	bash "$tests_repo_dir/.ci/static-checks.sh"  "github.com/kata-containers/runtime"
    28  }
    29  
    30  run_go_test()
    31  {
    32  	clone_tests_repo
    33  	bash "$tests_repo_dir/.ci/go-test.sh"
    34  }