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

View File

@ -121,6 +121,12 @@ optimize: $(SOURCES) | show-summary show-header
show-header: show-header:
@printf "%s - version %s (commit %s)\n\n" "$(TARGET)" "$(VERSION)" "$(COMMIT_MSG)" @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 $(GENERATED_FILES): %: %.in
@sed $(foreach r,$(GENERATED_REPLACEMENTS),-e 's|@$r@|$($r)|g') "$<" > "$@" @sed $(foreach r,$(GENERATED_REPLACEMENTS),-e 's|@$r@|$($r)|g') "$<" > "$@"

View File

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