Skip to content

Commit fc81cc6

Browse files
luizdepraLuiz F. A. de Prá
andauthored
chore: add coverage (#2)
* chore: add coverage * chore: fix clippy issues --------- Co-authored-by: Luiz F. A. de Prá <rawaraknis@gmail.com>
1 parent 9af09ec commit fc81cc6

4 files changed

Lines changed: 37 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,29 @@ jobs:
104104

105105
- name: Run test
106106
run: cargo test --all-targets --locked
107+
108+
coverage:
109+
name: Coverage
110+
111+
runs-on: ubuntu-latest
112+
113+
steps:
114+
- name: Checkout sources
115+
uses: actions/checkout@v4
116+
117+
- name: Install toolchain
118+
uses: dtolnay/rust-toolchain@stable
119+
with:
120+
components: llvm-tools
121+
122+
- name: Install llvm-cov
123+
uses: taiki-e/install-action@v2.33.16
124+
with:
125+
tool: cargo-llvm-cov
126+
- run: cargo llvm-cov --all-features --lcov --output-path lcov.info
127+
128+
- name: Upload coverage to coveralls
129+
uses: coverallsapp/github-action@v2.2.3
130+
with:
131+
github-token: ${{ secrets.GITHUB_TOKEN }}
132+
path-to-lcov: lcov.info

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ all: install fix test build
44

55
install:
66
cargo install git-cliff --locked
7-
cargo install cargo-tarpaulin --locked
7+
cargo install cargo-llvm-cov --locked
88
pre-commit install
99

1010
pre-commit:
@@ -30,7 +30,7 @@ test:
3030
cargo test --all-targets --locked
3131

3232
test-cov:
33-
cargo tarpaulin --all-targets --locked
33+
cargo llvm-cov --all --locked
3434

3535
build:
3636
cargo build --all-targets --locked

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
<a href="https://github.com/TinTeam/SN-50/actions?query=workflow%3A%22Continuous+Integration%22">
44
<img src="https://img.shields.io/github/workflow/status/TinTeam/SN-50/Continuous Integration" alt="GitHub Workflow Status">
55
</a>
6+
<a href="https://coveralls.io/github/TinTeam/SN-50">
7+
<img src="https://img.shields.io/coverallsCoverage/github/TinTeam/SN-50?branch=main" alt="Coveralls Status">
8+
</a>
69
<a href="https://crates.io/crates/sn-50">
710
<img src="https://docs.rs/sn-50/badge.svg" alt="docs.rs">
811
</a>
912
<a href="https://crates.io/crates/sn-50">
10-
<img src="https://img.shields.io/crates/d/sn-50" alt="Crates.io"">
13+
<img src="https://img.shields.io/crates/d/sn-50" alt="crates.io">
1114
</a>
1215
<a href="https://github.com/TinTeam/SN-50/blob/master/LICENSE.txt">
13-
<img src="https://img.shields.io/github/license/TinTeam/SN-50.svg" alt="MIT License Shield">
16+
<img src="https://img.shields.io/github/license/TinTeam/SN-50.svg" alt="MIT License">
1417
</a>
1518
</p>
1619

tinlib/src/cartridge/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,19 @@ impl Cartridge {
109109
break;
110110
}
111111
ChunkType::Cover => {
112-
cart.cover = chunk.data().clone();
112+
cart.cover.clone_from(chunk.data());
113113
}
114114
ChunkType::Code => {
115115
cart.code = String::from_utf8(chunk.data().clone())?;
116116
}
117117
ChunkType::Font => {
118-
cart.font = chunk.data().clone();
118+
cart.font.clone_from(chunk.data());
119119
}
120120
ChunkType::Palette => {
121-
cart.palette = chunk.data().clone();
121+
cart.palette.clone_from(chunk.data());
122122
}
123123
ChunkType::Map => {
124-
cart.map = chunk.data().clone();
124+
cart.map.clone_from(chunk.data());
125125
}
126126
}
127127
}

0 commit comments

Comments
 (0)