mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-25 11:13:15 +00:00
ci: Rework static checks
The static checks were using the version from kata-containers, an old version of go and had a bunch of travis references that don't seem to be required any longer, so try updating this and removing the redundant code. Whether all these checks are useful is debatable, but at least now they should be up-to-date. Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
parent
00128d3b92
commit
587c0d1b99
25
.ci/lib.sh
25
.ci/lib.sh
@ -1,25 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2019 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
|
||||
}
|
||||
|
||||
run_static_checks()
|
||||
{
|
||||
clone_tests_repo
|
||||
bash "$tests_repo_dir/.ci/static-checks.sh" "github.com/kata-containers/community"
|
||||
}
|
11
.ci/run.sh
11
.ci/run.sh
@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2019 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
# No explicit tests currently
|
||||
true
|
17
.ci/setup.sh
17
.ci/setup.sh
@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2019 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
cidir=$(dirname "$0")
|
||||
source "${cidir}/lib.sh"
|
||||
|
||||
clone_tests_repo
|
||||
|
||||
pushd "${tests_repo_dir}"
|
||||
.ci/setup.sh
|
||||
popd
|
@ -1,12 +1,33 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2019 Intel Corporation
|
||||
# Copyright (c) 2024 IBM Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -e
|
||||
|
||||
cidir=$(dirname "$0")
|
||||
source "${cidir}/lib.sh"
|
||||
export kata_repo="${kata_repo:-github.com/kata-containers/kata-containers}"
|
||||
export kata_repo_dir="$GOPATH/src/$kata_repo"
|
||||
export kata_default_branch="${kata_default_branch:-main}"
|
||||
|
||||
|
||||
clone_kata_repo() {
|
||||
if [ ! -d "${kata_repo_dir}" ]; then
|
||||
mkdir -p "${kata_repo_dir}"
|
||||
git clone "https://${kata_repo}.git" "${kata_repo_dir}"
|
||||
pushd "${kata_repo_dir}" || exit
|
||||
# Checkout to default branch
|
||||
git checkout "${kata_default_branch}"
|
||||
popd || exit
|
||||
fi
|
||||
}
|
||||
|
||||
run_static_checks()
|
||||
{
|
||||
clone_kata_repo
|
||||
INSTALL_IN_GOPATH=false bash "${kata_repo_dir}/ci/install_yq.sh"
|
||||
bash "${kata_repo_dir}/tests/install_go.sh" -f -p
|
||||
bash "${kata_repo_dir}/tests/static-checks.sh" "github.com/kata-containers/community"
|
||||
}
|
||||
|
||||
run_static_checks
|
||||
|
54
.github/workflows/main.yml
vendored
54
.github/workflows/main.yml
vendored
@ -1,42 +1,22 @@
|
||||
on: ["pull_request"]
|
||||
name: Static checks
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
static-checks:
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
GO111MODULE: off
|
||||
TRAVIS: "true"
|
||||
TRAVIS_BRANCH: ${{ github.base_ref }}
|
||||
TRAVIS_PULL_REQUEST_BRANCH: ${{ github.head_ref }}
|
||||
TRAVIS_PULL_REQUEST_SHA : ${{ github.event.pull_request.head.sha }}
|
||||
GOPATH: ${{ github.workspace }}
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.19.3
|
||||
- name: Setup GOPATH
|
||||
run: |
|
||||
gopath_org=$(go env GOPATH)/src/github.com/kata-containers/
|
||||
mkdir -p ${gopath_org}
|
||||
ln -s ${PWD} ${gopath_org}
|
||||
echo "TRAVIS_BRANCH: ${TRAVIS_BRANCH}"
|
||||
echo "TRAVIS_PULL_REQUEST_BRANCH: ${TRAVIS_PULL_REQUEST_BRANCH}"
|
||||
echo "TRAVIS_PULL_REQUEST_SHA: ${TRAVIS_PULL_REQUEST_SHA}"
|
||||
echo "TRAVIS: ${TRAVIS}"
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup travis references
|
||||
run: |
|
||||
echo "TRAVIS_BRANCH=${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = \"/\" } ; { print $3 }')}"
|
||||
- name: Setup
|
||||
run: |
|
||||
community_repo=$(go env GOPATH)/src/github.com/kata-containers/community
|
||||
pushd ${community_repo}
|
||||
GOPATH=$(go env GOPATH) .ci/setup.sh
|
||||
- name: Running static checks
|
||||
run: |
|
||||
community_repo=$(go env GOPATH)/src/github.com/kata-containers/community
|
||||
pushd ${community_repo}
|
||||
GOPATH=$(go env GOPATH) .ci/static-checks.sh
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
path: ./src/github.com/${{ github.repository }}
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get -y install moreutils hunspell hunspell-en-gb hunspell-en-us pandoc
|
||||
|
||||
- name: Running static checks
|
||||
run: |
|
||||
export PATH=${GOPATH}/bin:${PATH}
|
||||
./src/github.com/${{ github.repository }}/.ci/static-checks.sh
|
||||
|
Loading…
Reference in New Issue
Block a user