From d1c66445c1d335d67df7256f3b1845ef65fb6f4c Mon Sep 17 00:00:00 2001 From: Devdutt Shenoi Date: Tue, 10 Dec 2024 18:20:47 +0530 Subject: [PATCH] ci: lint, test and coverage report (#1028) Signed-off-by: Devdutt Shenoi --- .github/workflows/coverage.yaml | 57 ++++++++++++++++++++++++++++++ .github/workflows/lint.yaml | 61 --------------------------------- 2 files changed, 57 insertions(+), 61 deletions(-) create mode 100644 .github/workflows/coverage.yaml delete mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml new file mode 100644 index 000000000..eb5a46da4 --- /dev/null +++ b/.github/workflows/coverage.yaml @@ -0,0 +1,57 @@ +on: + pull_request: + paths-ignore: + - "docs/**" + - "helm/**" + - "assets/**" + - "**.md" + push: + branches: + - main + +name: Lint, Test and Coverage Report +jobs: + coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - uses: Swatinem/rust-cache@v2 + with: + shared-key: ${{ runner.os }}-cargo + + - uses: taiki-e/install-action@v2 + with: + tool: cargo-hack, cargo-llvm-cov, nextest + + - name: Check with clippy + run: cargo hack clippy --verbose --each-feature --no-dev-deps -- -D warnings + + - name: Check docs + run: cargo hack doc --verbose --no-deps --each-feature --no-dev-deps + + - name: Doctests + run: cargo hack --each-feature test --doc + + - name: Tests + run: cargo hack --each-feature llvm-cov --no-report nextest + + - name: Genrate coverage report + run: cargo llvm-cov report --lcov --output-path coverage.lcov + + - name: Upload Coverage Report + uses: coverallsapp/github-action@v2.2.3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + file: ./coverage.lcov + parallel: true + flag-name: run-${{ matrix.os }}-cargo + + - name: Finish Coverage Report + uses: coverallsapp/github-action@v2.2.3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml deleted file mode 100644 index 4f2578cf5..000000000 --- a/.github/workflows/lint.yaml +++ /dev/null @@ -1,61 +0,0 @@ -name: Linter - -on: - pull_request: - paths-ignore: - - 'docs/**' - - 'helm/**' - - 'assets/**' - - '**.md' - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - - unit-tests: - name: Unit tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: test - - fmt: - name: Rust fmt check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - clippy: - name: Cargo Clippy check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add clippy - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings