Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add coverage #2

Merged
merged 2 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading