From 33c88872a99ca126d2df87b0a306301a55a35689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20F=2E=20A=2E=20de=20Pr=C3=A1?= Date: Sat, 4 May 2024 18:56:48 -0300 Subject: [PATCH 1/2] chore: add coverage --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ Makefile | 4 ++-- README.md | 7 +++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 799dfb7..38e0f36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,3 +104,29 @@ jobs: - name: Run test run: cargo test --all-targets --locked + + coverage: + name: Coverage + + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Install toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: llvm-tools + + - name: Install llvm-cov + uses: taiki-e/install-action@v2.33.16 + with: + tool: cargo-llvm-cov + - run: cargo llvm-cov --all-features --lcov --output-path lcov.info + + - name: Upload coverage to coveralls + uses: coverallsapp/github-action@v2.2.3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: lcov.info diff --git a/Makefile b/Makefile index 24513f1..fc432c5 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ all: install fix test build install: cargo install git-cliff --locked - cargo install cargo-tarpaulin --locked + cargo install cargo-llvm-cov --locked pre-commit install pre-commit: @@ -30,7 +30,7 @@ test: cargo test --all-targets --locked test-cov: - cargo tarpaulin --all-targets --locked + cargo llvm-cov --all --locked build: cargo build --all-targets --locked diff --git a/README.md b/README.md index b168e22..60648ab 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,17 @@ GitHub Workflow Status + + Coveralls Status + docs.rs - Crates.io + crates.io - MIT License Shield + MIT License

From d317a1c95720bd7396a0a426b7d6a8689e4c046b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20F=2E=20A=2E=20de=20Pr=C3=A1?= Date: Sat, 4 May 2024 19:05:39 -0300 Subject: [PATCH 2/2] chore: fix clippy issues --- tinlib/src/cartridge/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tinlib/src/cartridge/mod.rs b/tinlib/src/cartridge/mod.rs index eb30a43..f8c3ad5 100644 --- a/tinlib/src/cartridge/mod.rs +++ b/tinlib/src/cartridge/mod.rs @@ -109,19 +109,19 @@ impl Cartridge { break; } ChunkType::Cover => { - cart.cover = chunk.data().clone(); + cart.cover.clone_from(chunk.data()); } ChunkType::Code => { cart.code = String::from_utf8(chunk.data().clone())?; } ChunkType::Font => { - cart.font = chunk.data().clone(); + cart.font.clone_from(chunk.data()); } ChunkType::Palette => { - cart.palette = chunk.data().clone(); + cart.palette.clone_from(chunk.data()); } ChunkType::Map => { - cart.map = chunk.data().clone(); + cart.map.clone_from(chunk.data()); } } }