From dbac1b7c8db640ef8d6f7d6cdba6a32d94e32dc2 Mon Sep 17 00:00:00 2001
From: Jerome Humbert <djeedai@gmail.com>
Date: Fri, 18 Feb 2022 23:17:18 +0000
Subject: [PATCH] Add coveralls (#4)

Add code coverage via coveralls.io
---
 .github/workflows/ci.yaml | 46 +++++++++++++++++++++++++++++++++++++++
 README.md                 |  1 +
 2 files changed, 47 insertions(+)

diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index f702721..5d415a4 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -48,3 +48,49 @@ jobs:
         run: cargo test
         env:
           CARGO_INCREMENTAL: 0
+
+  coverage:
+    name: Coverage
+    runs-on: ubuntu-latest
+    permissions:
+      actions: read
+      checks: write
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/cache@v2
+        with:
+          path: |
+            ~/.cargo/.crates.toml
+            ~/.cargo/.crates2.json
+            ~/.cargo/bin/
+            ~/.cargo/registry/index/
+            ~/.cargo/registry/cache/
+            ~/.cargo/git/db/
+            target/
+          key: ${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }}
+      - uses: actions-rs/toolchain@v1
+        with:
+          toolchain: stable
+          override: true
+      - name: Install Bevy dependencies
+        run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libxcb-shape0-dev libxcb-xfixes0-dev
+        if: runner.os == 'linux'
+      - name: Install graphic drivers
+        run: |
+          sudo apt-get update -y -qq
+          sudo add-apt-repository ppa:oibaf/graphics-drivers -y
+          sudo apt-get update
+          sudo apt install -y xvfb libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
+        if: runner.os == 'linux'
+      - name: Install cargo-tarpaulin
+        run: |
+          RUST_BACKTRACE=1 cargo install --version 0.19.1 cargo-tarpaulin
+      - name: Generate code coverage
+        run: |
+          RUST_BACKTRACE=1 cargo tarpaulin --verbose --timeout 120 --out Lcov --workspace
+          ls -la
+      - name: Upload code coverage
+        uses: coverallsapp/github-action@master
+        with:
+          path-to-lcov: 'lcov.info'
+          github-token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/README.md b/README.md
index 335ba82..95a0809 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,7 @@
 [![Doc](https://docs.rs/bevy_tweening/badge.svg)](https://docs.rs/bevy_tweening)
 [![Crate](https://img.shields.io/crates/v/bevy_tweening.svg)](https://crates.io/crates/bevy_tweening)
 [![Build Status](https://github.com/djeedai/bevy_tweening/actions/workflows/ci.yaml/badge.svg)](https://github.com/djeedai/bevy_tweening/actions/workflows/ci.yaml)
+[![Coverage Status](https://coveralls.io/repos/github/djeedai/bevy_tweening/badge.svg?branch=main)](https://coveralls.io/github/djeedai/bevy_tweening?branch=main)
 [![Bevy tracking](https://img.shields.io/badge/Bevy%20tracking-v0.6-lightblue)](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking)
 
 Tweening animation plugin for the Bevy game engine.
-- 
GitLab