Skip to content

Commit

Permalink
WIP: ci: Rework static checks
Browse files Browse the repository at this point in the history
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.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
  • Loading branch information
stevenhorsman committed Oct 10, 2024
1 parent 00128d3 commit 7465d19
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 78 deletions.
27 changes: 14 additions & 13 deletions .ci/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@
#
# SPDX-License-Identifier: Apache-2.0

export tests_repo="${tests_repo:-github.com/kata-containers/tests}"
export tests_repo_dir="$GOPATH/src/$tests_repo"
export kata_repo="${tests_repo:-github.com/kata-containers/kata-containers}"
export kata_repo_dir="$GOPATH/src/$kata_repo"
export kata_default_branch="${kata_default_branch:-main}"

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
clone_kata_repo() {
if [ ! -d "${kata_repo_dir}" ]; then
mkdir -p "${kata_repo_dir}"
git clone ${kata_repo} "${kata_repo_dir}" || true
pushd "${kata_repo_dir}" || exit
# Checkout to default branch
git checkout "${kata_default_branch}"
popd || exit
fi
}

run_static_checks()
{
clone_tests_repo
bash "$tests_repo_dir/.ci/static-checks.sh" "github.com/kata-containers/community"
clone_kata_repo
bash "${kata_repo_dir}/tests/static-checks.sh" "github.com/kata-containers/community"
}
11 changes: 0 additions & 11 deletions .ci/run.sh

This file was deleted.

17 changes: 0 additions & 17 deletions .ci/setup.sh

This file was deleted.

50 changes: 13 additions & 37 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,17 @@ on: ["pull_request"]
name: Static checks
jobs:
test:
runs-on: ubuntu-latest
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 }}
runs-on: ubuntu-22.04
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

- name: Install system dependencies
run: |
sudo apt-get -y install moreutils hunspell hunspell-en-gb hunspell-en-us pandoc
- name: Running static checks
run: |
.ci/static-checks.sh

0 comments on commit 7465d19

Please sign in to comment.