ci: add cargo clippy for agent

To run `cargo clippy`, this commit includes changes:

- add a new Makefile target to run `cargo clippy`
- move `make`/`make check` to last step to let a fast retrun if `fmt`/`clippy` failed

Fixes: #951

Signed-off-by: bin liu <bin@hyper.sh>
This commit is contained in:
bin liu 2020-10-16 15:54:45 +08:00
parent 2e13878880
commit df4ce9fab7
3 changed files with 14 additions and 6 deletions

View File

@ -15,7 +15,7 @@ os: linux
# https://docs.travis-ci.com/user/caching#clearing-caches
language: rust
rust:
- 1.44.1
- 1.47.0
cache:
cargo: true
directories:
@ -36,9 +36,9 @@ install:
- rustup target add x86_64-unknown-linux-musl
- sudo ln -sf /usr/bin/g++ /bin/musl-g++
- rustup component add rustfmt
- 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
- rustup component add clippy
- make -C ${TRAVIS_BUILD_DIR}/src/agent clippy
- "ci/static-checks.sh"
before_script:
- "ci/install_go.sh"
@ -47,7 +47,9 @@ before_script:
- sudo -E PATH=$PATH GOPATH=$GOPATH make -C ${TRAVIS_BUILD_DIR}/src/runtime test
script:
- "ci/static-checks.sh"
- 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:

View File

@ -121,6 +121,12 @@ optimize: $(SOURCES) | show-summary show-header
show-header:
@printf "%s - version %s (commit %s)\n\n" "$(TARGET)" "$(VERSION)" "$(COMMIT_MSG)"
clippy: $(GENERATED_CODE)
cargo clippy --all-targets --all-features --release \
-- \
-Aclippy::redundant_allocation \
-D warnings
$(GENERATED_FILES): %: %.in
@sed $(foreach r,$(GENERATED_REPLACEMENTS),-e 's|@$r@|$($r)|g') "$<" > "$@"

View File

@ -289,7 +289,7 @@ languages:
description: |
'newest-version' is the latest version known to work when
building Kata
newest-version: "1.44.1"
newest-version: "1.47.0"
specs:
description: "Details of important specifications"