Skip to content

Commit 49c0be2

Browse files
authored
Merge pull request #21 from artrixdotdev/ci/linting-and-tests
ci: Add build tests and linting
2 parents b1d662b + f543b6e commit 49c0be2

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-2
lines changed

.github/workflows/checks.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: ✅ Checks
2+
on:
3+
push:
4+
branches: [ "main" ]
5+
pull_request:
6+
branches: [ "main" ]
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
RUSTFLAGS: "-C target-cpu=native"
11+
CARGO_INCREMENTAL: 0
12+
RUST_BACKTRACE: 1
13+
14+
jobs:
15+
build_and_test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: 📥 Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: 🦀 Install Rust toolchain
22+
uses: dtolnay/rust-toolchain@stable
23+
with:
24+
components: clippy, rustfmt
25+
26+
- name: 💾 Rust Cache
27+
uses: Swatinem/rust-cache@v2
28+
with:
29+
shared-key: "build-cache"
30+
31+
- name: 🔨 Build
32+
run: cargo build --verbose
33+
34+
- name: 🧪 Run tests
35+
run: cargo test --verbose
36+
37+
lint:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: 📥 Checkout code
41+
uses: actions/checkout@v4
42+
43+
- name: 🦀 Install Rust toolchain
44+
uses: dtolnay/rust-toolchain@stable
45+
with:
46+
components: clippy, rustfmt
47+
48+
- name: 💾 Rust Cache
49+
uses: Swatinem/rust-cache@v2
50+
with:
51+
shared-key: "lint-cache"
52+
53+
- name: 🔍 Run linter
54+
run: cargo clippy --all-targets --all-features -- -D warnings
55+
56+
- name: 💅 Run format checker
57+
run: cargo fmt --check

lib/src/parser/file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl Serialize for Hashes {
110110

111111
struct HashesVisitor;
112112

113-
impl<'de> Visitor<'de> for HashesVisitor {
113+
impl Visitor<'_> for HashesVisitor {
114114
type Value = Hashes;
115115

116116
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {

lib/src/parser/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub use magnet::*;
1010
/// https://www.bittorrent.org/beps/bep_0012.html
1111
/// Example: udp://tracker.opentrackr.org:1337/announce
1212
#[derive(Debug, Deserialize)]
13-
pub struct AnnounceUri(String);
13+
pub struct AnnounceUri(pub String);
1414

1515
/// Always utilize MetaInfo instead of directly using TorrentFile or MagnetUri
1616
#[derive(Debug, Deserialize)]

0 commit comments

Comments
 (0)