From 543ce152263fb783a71b67a6d6ed58165a11d645 Mon Sep 17 00:00:00 2001
From: muraca <mmuraca247@gmail.com>
Date: Wed, 5 Jul 2023 16:58:26 +0200
Subject: [PATCH] added code coverage to action

Signed-off-by: muraca <mmuraca247@gmail.com>
---
 .github/workflows/ci.yml | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f558e4c..f7bce5f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -6,7 +6,7 @@ on:
   pull_request:
     branches: [main]
 
-env: 
+env:
   CARGO_TERM_COLOR: always
   RUSTFLAGS: "-Dwarnings"
 
@@ -21,7 +21,7 @@ jobs:
           - nightly
     steps:
       - uses: actions/checkout@v3
-      
+
       - name: Init nigthly install for fmt
         run: rustup update nightly && rustup default nightly && rustup component add rustfmt
 
@@ -30,7 +30,7 @@ jobs:
 
       - name: Init install
         run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} && rustup component add clippy
-      
+
       - name: Clippy
         run: cargo clippy --all-targets --all-features
 
@@ -38,4 +38,20 @@ jobs:
         run: cargo build
 
       - name: Tests
-        run: cargo test
\ No newline at end of file
+        run: cargo test
+
+      - name: Install latest nextest release
+        uses: taiki-e/install-action@nextest
+
+      - name: Install cargo-llvm-cov
+        uses: taiki-e/install-action@cargo-llvm-cov
+
+      - name: Collect coverage data
+        run: cargo llvm-cov nextest --lcov --output-path lcov.info
+
+      - name: Report code coverage
+        uses: Nef10/lcov-reporter-action@v0.4.0
+        with:
+          lcov-file: lcov.info
+          pr-number: ${{ env.pr_number }}
+        if: github.event_name == 'pull_request'
-- 
GitLab