From a5372e006ff33178ef1da371ddfaa79293410a8d Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Fri, 18 Dec 2020 09:04:21 -0600 Subject: [PATCH 1/2] github: Add github actions This PR adds the github actions for this repository. Fixes #1205 Signed-off-by: Gabriela Cervantes --- .github/workflows/static-checks.yaml | 71 ++++++++++++++++++++++++++++ .travis.yml | 64 ------------------------- 2 files changed, 71 insertions(+), 64 deletions(-) create mode 100644 .github/workflows/static-checks.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/static-checks.yaml b/.github/workflows/static-checks.yaml new file mode 100644 index 0000000000..b583bc5bec --- /dev/null +++ b/.github/workflows/static-checks.yaml @@ -0,0 +1,71 @@ +on: ["pull_request"] +name: Static checks +jobs: + test: + strategy: + matrix: + go-version: [1.13.x, 1.14.x, 1.15.x] + os: [ubuntu-18.04] + runs-on: ${{ matrix.os }} + 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 }} + RUST_BACKTRACE: "1" + RUST_AGENT: "yes" + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - 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: | + kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers + pushd ${kata_repo}/ci/ + GOPATH=$(go env GOPATH) ./setup.sh + - name: Install rust + run: | + kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers + pushd ${kata_repo}/ci/ + GOPATH=$(go env GOPATH) ./install_rust.sh + - name: Agent + run: | + kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers + pushd ${kata_repo}/src/agent + GOPATH=$(go env GOPATH) make + - name: Install agent + run: | + kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers + pushd ${kata_repo}/src/agent + GOPATH=$(go env GOPATH) make check + - name: Make clippy + run: | + kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers + pushd ${kata_repo}/src/agent + rustup target add x86_64-unknown-linux-musl + rustup component add rustfmt + rustup component add clippy + GOPATH=$(go env GOPATH) make clippy + - name: Static checks + run: | + kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers + pushd ${kata_repo}/ci/ + GOPATH=$(go env GOPATH) ./static-checks.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 36bfe742d5..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright (c) 2019 Ant Financial -# -# SPDX-License-Identifier: Apache-2.0 -# - -dist: bionic -os: linux - -# set cache directories manually, because -# we are using a non-standard directory struct -# cargo root is in srs/agent -# -# If needed, caches can be cleared -# by ways documented in -# https://docs.travis-ci.com/user/caching#clearing-caches -language: rust -rust: - - 1.47.0 -cache: - cargo: true - directories: - - src/agent/target - -before_install: - - git remote set-branches --add origin "${TRAVIS_BRANCH}" - - git fetch - - export RUST_BACKTRACE=1 - - export target_branch=$TRAVIS_BRANCH - - "ci/setup.sh" - -# we use install to run check agent -# so that it is easy to skip for non-amd64 platform -install: - - export PATH=$PATH:"$HOME/.cargo/bin" - - export RUST_AGENT=yes - - rustup target add x86_64-unknown-linux-musl - - sudo ln -sf /usr/bin/g++ /bin/musl-g++ - - rustup component add rustfmt - - rustup component add clippy - - make -C ${TRAVIS_BUILD_DIR}/src/agent clippy - - "ci/static-checks.sh" - -before_script: - - "ci/install_go.sh" - - make -C ${TRAVIS_BUILD_DIR}/src/runtime - - make -C ${TRAVIS_BUILD_DIR}/src/runtime test - - sudo -E PATH=$PATH GOPATH=$GOPATH make -C ${TRAVIS_BUILD_DIR}/src/runtime test - -script: - - make -C ${TRAVIS_BUILD_DIR}/src/agent - - make -C ${TRAVIS_BUILD_DIR}/src/agent check - - sudo -E PATH=$PATH make -C ${TRAVIS_BUILD_DIR}/src/agent check - -jobs: - include: - - name: x86_64 test - os: linux - - name: ppc64le test - os: linux-ppc64le - install: skip - script: skip - allow_failures: - - name: ppc64le test - fast_finish: true From ebd9fcc2c3a93b64c8e147f0c4678ce72989f37e Mon Sep 17 00:00:00 2001 From: Archana Shinde Date: Tue, 22 Dec 2020 11:12:00 -0800 Subject: [PATCH 2/2] actions: Run static checks before make agent Run static checks prior to building the agent.Checks fail if run after since the compilation process produces new rust code. Signed-off-by: Archana Shinde --- .github/workflows/static-checks.yaml | 49 +++++++++++++--------------- src/agent/VERSION | 2 +- src/runtime/VERSION | 2 +- tools/osbuilder/VERSION | 2 +- 4 files changed, 26 insertions(+), 29 deletions(-) mode change 120000 => 100644 src/agent/VERSION mode change 120000 => 100644 src/runtime/VERSION mode change 120000 => 100644 tools/osbuilder/VERSION diff --git a/.github/workflows/static-checks.yaml b/.github/workflows/static-checks.yaml index b583bc5bec..2c4d666ebe 100644 --- a/.github/workflows/static-checks.yaml +++ b/.github/workflows/static-checks.yaml @@ -15,11 +15,14 @@ jobs: TRAVIS_PULL_REQUEST_SHA : ${{ github.event.pull_request.head.sha }} RUST_BACKTRACE: "1" RUST_AGENT: "yes" + target_branch: ${TRAVIS_BRANCH} steps: - name: Install Go uses: actions/setup-go@v2 with: go-version: ${{ matrix.go-version }} + env: + GOPATH: ${{ runner.workspace }}/kata-containers - name: Setup GOPATH run: | gopath_org=$(go env GOPATH)/src/github.com/kata-containers/ @@ -29,43 +32,37 @@ jobs: echo "TRAVIS_PULL_REQUEST_BRANCH: ${TRAVIS_PULL_REQUEST_BRANCH}" echo "TRAVIS_PULL_REQUEST_SHA: ${TRAVIS_PULL_REQUEST_SHA}" echo "TRAVIS: ${TRAVIS}" + - name: Set env + run: | + echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV + echo "${{ github.workspace }}/bin" >> $GITHUB_PATH - name: Checkout code uses: actions/checkout@v2 with: fetch-depth: 0 + path: ./src/github.com/${{ github.repository }} - name: Setup travis references run: | echo "TRAVIS_BRANCH=${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = \"/\" } ; { print $3 }')}" + target_branch=${TRAVIS_BRANCH} - name: Setup run: | - kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers - pushd ${kata_repo}/ci/ - GOPATH=$(go env GOPATH) ./setup.sh - - name: Install rust + cd ${GOPATH}/src/github.com/kata-containers/kata-containers && ./ci/setup.sh + env: + GOPATH: ${{ runner.workspace }}/kata-containers + - name: Building rust run: | - kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers - pushd ${kata_repo}/ci/ - GOPATH=$(go env GOPATH) ./install_rust.sh - - name: Agent - run: | - kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers - pushd ${kata_repo}/src/agent - GOPATH=$(go env GOPATH) make - - name: Install agent - run: | - kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers - pushd ${kata_repo}/src/agent - GOPATH=$(go env GOPATH) make check + cd ${GOPATH}/src/github.com/kata-containers/kata-containers && ./ci/install_rust.sh + PATH=$PATH:"$HOME/.cargo/bin" - name: Make clippy run: | - kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers - pushd ${kata_repo}/src/agent - rustup target add x86_64-unknown-linux-musl - rustup component add rustfmt - rustup component add clippy - GOPATH=$(go env GOPATH) make clippy + cd ${GOPATH}/src/github.com/kata-containers/kata-containers/src/agent && rustup target add x86_64-unknown-linux-musl && rustup component add rustfmt && rustup component add clippy && make clippy - name: Static checks run: | - kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers - pushd ${kata_repo}/ci/ - GOPATH=$(go env GOPATH) ./static-checks.sh + cd ${GOPATH}/src/github.com/kata-containers/kata-containers && ./ci/static-checks.sh + - name: Build agent + run: | + cd ${GOPATH}/src/github.com/kata-containers/kata-containers/src/agent && make + - name: Run agent unit tests + run: | + cd ${GOPATH}/src/github.com/kata-containers/kata-containers/src/agent && make check diff --git a/src/agent/VERSION b/src/agent/VERSION deleted file mode 120000 index 558194c5a5..0000000000 --- a/src/agent/VERSION +++ /dev/null @@ -1 +0,0 @@ -../../VERSION \ No newline at end of file diff --git a/src/agent/VERSION b/src/agent/VERSION new file mode 100644 index 0000000000..227cea2156 --- /dev/null +++ b/src/agent/VERSION @@ -0,0 +1 @@ +2.0.0 diff --git a/src/runtime/VERSION b/src/runtime/VERSION deleted file mode 120000 index 558194c5a5..0000000000 --- a/src/runtime/VERSION +++ /dev/null @@ -1 +0,0 @@ -../../VERSION \ No newline at end of file diff --git a/src/runtime/VERSION b/src/runtime/VERSION new file mode 100644 index 0000000000..227cea2156 --- /dev/null +++ b/src/runtime/VERSION @@ -0,0 +1 @@ +2.0.0 diff --git a/tools/osbuilder/VERSION b/tools/osbuilder/VERSION deleted file mode 120000 index 558194c5a5..0000000000 --- a/tools/osbuilder/VERSION +++ /dev/null @@ -1 +0,0 @@ -../../VERSION \ No newline at end of file diff --git a/tools/osbuilder/VERSION b/tools/osbuilder/VERSION new file mode 100644 index 0000000000..227cea2156 --- /dev/null +++ b/tools/osbuilder/VERSION @@ -0,0 +1 @@ +2.0.0