mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 08:17:37 +00:00
actions: enable unit tests in PR check
Right now we only run UTs for agent. We need to run it for *ALL* components. Fixes: #1538 Signed-off-by: Peng Tao <bergwolf@hyper.sh> (backport: https://github.com/kata-containers/kata-containers/pull/1539) Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
This commit is contained in:
parent
c750ce13af
commit
c60951f51e
61
.github/workflows/static-checks.yaml
vendored
61
.github/workflows/static-checks.yaml
vendored
@ -8,64 +8,59 @@ jobs:
|
|||||||
os: [ubuntu-20.04]
|
os: [ubuntu-20.04]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
env:
|
env:
|
||||||
GO111MODULE: off
|
|
||||||
TRAVIS: "true"
|
TRAVIS: "true"
|
||||||
TRAVIS_BRANCH: ${{ github.base_ref }}
|
TRAVIS_BRANCH: ${{ github.base_ref }}
|
||||||
TRAVIS_PULL_REQUEST_BRANCH: ${{ github.head_ref }}
|
TRAVIS_PULL_REQUEST_BRANCH: ${{ github.head_ref }}
|
||||||
TRAVIS_PULL_REQUEST_SHA : ${{ github.event.pull_request.head.sha }}
|
TRAVIS_PULL_REQUEST_SHA : ${{ github.event.pull_request.head.sha }}
|
||||||
RUST_BACKTRACE: "1"
|
RUST_BACKTRACE: "1"
|
||||||
RUST_AGENT: "yes"
|
target_branch: ${TRAVIS_BRANCH}
|
||||||
steps:
|
steps:
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go-version }}
|
go-version: ${{ matrix.go-version }}
|
||||||
|
env:
|
||||||
|
GOPATH: ${{ runner.workspace }}/kata-containers
|
||||||
- name: Setup GOPATH
|
- name: Setup GOPATH
|
||||||
run: |
|
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_BRANCH: ${TRAVIS_BRANCH}"
|
||||||
echo "TRAVIS_PULL_REQUEST_BRANCH: ${TRAVIS_PULL_REQUEST_BRANCH}"
|
echo "TRAVIS_PULL_REQUEST_BRANCH: ${TRAVIS_PULL_REQUEST_BRANCH}"
|
||||||
echo "TRAVIS_PULL_REQUEST_SHA: ${TRAVIS_PULL_REQUEST_SHA}"
|
echo "TRAVIS_PULL_REQUEST_SHA: ${TRAVIS_PULL_REQUEST_SHA}"
|
||||||
echo "TRAVIS: ${TRAVIS}"
|
echo "TRAVIS: ${TRAVIS}"
|
||||||
|
- name: Set env
|
||||||
|
run: |
|
||||||
|
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
|
||||||
|
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
path: ./src/github.com/${{ github.repository }}
|
||||||
- name: Setup travis references
|
- name: Setup travis references
|
||||||
run: |
|
run: |
|
||||||
echo "TRAVIS_BRANCH=${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = \"/\" } ; { print $3 }')}"
|
echo "TRAVIS_BRANCH=${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = \"/\" } ; { print $3 }')}"
|
||||||
|
target_branch=${TRAVIS_BRANCH}
|
||||||
- name: Setup
|
- name: Setup
|
||||||
run: |
|
run: |
|
||||||
kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers
|
cd ${GOPATH}/src/github.com/${{ github.repository }} && ./ci/setup.sh
|
||||||
pushd ${kata_repo}/ci/
|
env:
|
||||||
GOPATH=$(go env GOPATH) ./setup.sh
|
GOPATH: ${{ runner.workspace }}/kata-containers
|
||||||
- name: Install rust
|
- name: Building rust
|
||||||
run: |
|
run: |
|
||||||
kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers
|
cd ${GOPATH}/src/github.com/${{ github.repository }} && ./ci/install_rust.sh
|
||||||
pushd ${kata_repo}/ci/
|
PATH=$PATH:"$HOME/.cargo/bin"
|
||||||
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 target add x86_64-unknown-linux-musl
|
||||||
rustup component add rustfmt
|
rustup component add rustfmt clippy
|
||||||
rustup component add clippy
|
# Must build before static checks as we depend on some generated code in runtime and agent
|
||||||
GOPATH=$(go env GOPATH) make clippy
|
- name: Build
|
||||||
- name: Static checks
|
|
||||||
run: |
|
run: |
|
||||||
kata_repo=$(go env GOPATH)/src/github.com/kata-containers/kata-containers
|
cd ${GOPATH}/src/github.com/${{ github.repository }} && make
|
||||||
pushd ${kata_repo}/ci/
|
- name: Static Checks
|
||||||
GOPATH=$(go env GOPATH) ./static-checks.sh
|
run: |
|
||||||
|
cd ${GOPATH}/src/github.com/${{ github.repository }} && ./ci/static-checks.sh
|
||||||
|
- name: Run Compiler Checks
|
||||||
|
run: |
|
||||||
|
cd ${GOPATH}/src/github.com/${{ github.repository }} && make check
|
||||||
|
- name: Run Unit Tests
|
||||||
|
run: |
|
||||||
|
cd ${GOPATH}/src/github.com/${{ github.repository }} && make test
|
||||||
|
@ -140,6 +140,10 @@ clippy: $(GENERATED_CODE)
|
|||||||
-Aclippy::redundant_allocation \
|
-Aclippy::redundant_allocation \
|
||||||
-D warnings
|
-D warnings
|
||||||
|
|
||||||
|
format:
|
||||||
|
cargo fmt -- --check
|
||||||
|
|
||||||
|
|
||||||
##TARGET install: install agent
|
##TARGET install: install agent
|
||||||
install: install-services
|
install: install-services
|
||||||
@install -D $(TARGET_PATH) $(DESTDIR)/$(BINDIR)/$(TARGET)
|
@install -D $(TARGET_PATH) $(DESTDIR)/$(BINDIR)/$(TARGET)
|
||||||
@ -155,7 +159,7 @@ test:
|
|||||||
@cargo test --all --target $(TRIPLE)
|
@cargo test --all --target $(TRIPLE)
|
||||||
|
|
||||||
##TARGET check: run test
|
##TARGET check: run test
|
||||||
check: test
|
check: clippy format
|
||||||
|
|
||||||
##TARGET run: build and run agent
|
##TARGET run: build and run agent
|
||||||
run:
|
run:
|
||||||
|
@ -638,7 +638,6 @@ go-test: $(GENERATED_FILES)
|
|||||||
go test -v -mod=vendor ./...
|
go test -v -mod=vendor ./...
|
||||||
|
|
||||||
check-go-static:
|
check-go-static:
|
||||||
$(QUIET_CHECK)../../ci/static-checks.sh
|
|
||||||
$(QUIET_CHECK)../../ci/go-no-os-exit.sh ./cli
|
$(QUIET_CHECK)../../ci/go-no-os-exit.sh ./cli
|
||||||
$(QUIET_CHECK)../../ci/go-no-os-exit.sh ./virtcontainers
|
$(QUIET_CHECK)../../ci/go-no-os-exit.sh ./virtcontainers
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user