From e0b5a56dece928d035040beeb5b5d3911fe80ebb Mon Sep 17 00:00:00 2001 From: Xynnn007 Date: Tue, 8 Oct 2024 10:33:21 +0800 Subject: [PATCH] ci: fix attestation-agent CI coverage This commit adds a Makefile option `lint` for attestation-agent to test the lint of all sub projects of AA. Before this patch, some ttrpc codes are not covered by CI. Signed-off-by: Xynnn007 --- .github/workflows/aa_basic.yml | 11 +++-------- attestation-agent/Makefile | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/aa_basic.yml b/.github/workflows/aa_basic.yml index 0eff512a0..8adb69cab 100644 --- a/.github/workflows/aa_basic.yml +++ b/.github/workflows/aa_basic.yml @@ -40,12 +40,10 @@ jobs: include: - instance: ubuntu-22.04 make_args: "" - cargo_test_opts: "--features openssl,rust-crypto,all-attesters,kbs,coco_as" - cargo_lint_opts: "--workspace" + cargo_test_opts: "--features openssl,rust-crypto,all-attesters,kbs,coco_as,ttrpc,grpc" - instance: s390x make_args: "ATTESTER=se-attester TEE_PLATFORM=se" cargo_test_opts: "--no-default-features --features openssl,passport,se-attester,kbs,coco_as" - cargo_lint_opts: "--no-default-features --features openssl,se-attester,kbs,coco_as -p attestation-agent -p attester -p coco_keyprovider -p kbc -p kbs_protocol -p crypto -p resource_uri" runs-on: ${{ matrix.instance }} steps: - name: Code checkout @@ -109,8 +107,5 @@ jobs: args: --all -- --check - name: Run rust lint check - uses: actions-rs/cargo@v1 - with: - command: clippy - # We are getting error in generated code due to derive_partial_eq_without_eq check, so ignore it for now - args: ${{ matrix.cargo_lint_opts }} -- -D warnings -A clippy::derive-partial-eq-without-eq + run: | + make lint diff --git a/attestation-agent/Makefile b/attestation-agent/Makefile index 5884ed4c7..ed2dce50b 100644 --- a/attestation-agent/Makefile +++ b/attestation-agent/Makefile @@ -108,12 +108,26 @@ else features := $(features),rust-crypto endif +ifeq ($(ARCH), s390x) + LINT_OPTION = lint-s390x +else + LINT_OPTION = lint-default +endif + build: cd attestation-agent && $(RUST_FLAGS) cargo build $(release) --no-default-features --features "$(features)" $(binary) $(LIBC_FLAG) mv $(TARGET_DIR)/$(binary_name) $(TARGET) TARGET := $(TARGET_DIR)/$(BIN_NAME) +lint: $(LINT_OPTION) + +lint-default: + cd attestation-agent && cargo clippy --features kbs,coco_as,bin,grpc,ttrpc,all-attesters + +lint-s390x: + cd attestation-agent && cargo clippy --no-default-features --features openssl,kbs,coco_as,bin,grpc,ttrpc + install: install -D -m0755 $(TARGET) $(DESTDIR)/$(BIN_NAME)