Skip to content

Commit

Permalink
chore: add coverage (#2)
Browse files Browse the repository at this point in the history
* chore: add coverage

* chore: fix clippy issues

---------

Co-authored-by: Luiz F. A. de Prá <[email protected]>
  • Loading branch information
luizdepra and Luiz F. A. de Prá authored May 4, 2024
1 parent 9af09ec commit fc81cc6
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
with:
tool: cargo-llvm-cov
- run: cargo llvm-cov --all-features --lcov --output-path lcov.info

- name: Upload coverage to coveralls
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: lcov.info
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
<a href="https://github.com/TinTeam/SN-50/actions?query=workflow%3A%22Continuous+Integration%22">
<img src="https://img.shields.io/github/workflow/status/TinTeam/SN-50/Continuous Integration" alt="GitHub Workflow Status">
</a>
<a href="https://coveralls.io/github/TinTeam/SN-50">
<img src="https://img.shields.io/coverallsCoverage/github/TinTeam/SN-50?branch=main" alt="Coveralls Status">
</a>
<a href="https://crates.io/crates/sn-50">
<img src="https://docs.rs/sn-50/badge.svg" alt="docs.rs">
</a>
<a href="https://crates.io/crates/sn-50">
<img src="https://img.shields.io/crates/d/sn-50" alt="Crates.io"">
<img src="https://img.shields.io/crates/d/sn-50" alt="crates.io">
</a>
<a href="https://github.com/TinTeam/SN-50/blob/master/LICENSE.txt">
<img src="https://img.shields.io/github/license/TinTeam/SN-50.svg" alt="MIT License Shield">
<img src="https://img.shields.io/github/license/TinTeam/SN-50.svg" alt="MIT License">
</a>
</p>

Expand Down
8 changes: 4 additions & 4 deletions tinlib/src/cartridge/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}
Expand Down

0 comments on commit fc81cc6

Please sign in to comment.