Skip to content
Open
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
10 changes: 8 additions & 2 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
version: 2
updates:

- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"
timezone: "Europe/Warsaw"
timezone: "Europe/Berlin"
day: "friday"
time: "18:00"
open-pull-requests-limit: 5
labels:
- "chore"
commit-message:
prefix: "chore(deps)"
prefix-development: "chore(deps)"
include: "scope"
71 changes: 65 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,72 @@ on:
pull_request:

jobs:
# Test MSRV
msrv:
name: MSRV
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4

- name: Set up Rust MSRV
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.85.0

- name: Set up Cache
uses: Swatinem/rust-cache@v2

- name: Test MSRV
run: cargo check --all-features

# Test feature combinations
features:
name: Feature Testing
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4

- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Set up Cache
uses: Swatinem/rust-cache@v2

- name: Test no features
run: cargo test --no-default-features

- name: Test futures only
run: cargo test --no-default-features --features futures

- name: Test tokio only
run: cargo test --no-default-features --features tokio

- name: Test futures + tokio
run: cargo test --no-default-features --features "futures,tokio"

- name: Test all features
run: cargo test --all-features

ci:
name: CI
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
toolchain: [ stable ]
os: [ubuntu-latest, windows-latest, macos-latest]
toolchain: [stable]
runs-on: ${{ matrix.os }}
steps:

- name: Check out
uses: actions/checkout@v4

- name: Set up ${{ matrix.toolchain }} Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy, rustfmt

- name: Set up Cache
uses: Swatinem/rust-cache@v2
Expand All @@ -46,15 +96,24 @@ jobs:
- name: Run Cargo:clippy
run: cargo clippy --all-features -- -D warnings

- name: Run Cargo:test
- name: Run Cargo:test (default features)
run: cargo test --verbose

- name: Run Cargo:test (all features)
run: cargo test --verbose --all-features

- name: Run Cargo:tarpaulin
- name: Run examples (std features only)
if: matrix.os == 'ubuntu-latest'
run: |
cargo run --example counter
cargo run --example progress

- name: Run Cargo:tarpaulin
if: matrix.os == 'ubuntu-latest' && matrix.toolchain == 'stable'
run: cargo tarpaulin --verbose --all-features --out Xml --output-dir ./coverage

- name: Upload Codecov
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest' && matrix.toolchain == 'stable'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/security.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Security Audit

on:
schedule:
- cron: "0 2 * * *"
push:
branches:
- "main"
paths:
- "Cargo.toml"
- "Cargo.lock"
- "crates/**/Cargo.toml"
- "deny.toml"
- ".github/workflows/security.yaml"
pull_request:
branches:
- "main"
paths:
- "Cargo.toml"
- "Cargo.lock"
- "crates/**/Cargo.toml"
- "deny.toml"
- ".github/workflows/security.yaml"
workflow_dispatch:

jobs:
security:
name: Security Audit
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Install cargo-audit
run: cargo install cargo-audit

- name: Install cargo-machete
run: cargo install cargo-machete

- name: Install cargo-outdated
run: cargo install cargo-outdated

- name: Run cargo audit
run: cargo audit
continue-on-error: false

- name: Check for unused dependencies
run: cargo machete
continue-on-error: true

- name: Check for outdated dependencies
run: cargo outdated --exit-code 1
continue-on-error: true

- name: Display dependency tree
run: cargo tree
continue-on-error: true

- name: Display dependency tree with duplicates
run: cargo tree --duplicates
continue-on-error: true

- name: Display dependency tree with licenses
run: cargo tree --format "{p} {l}"
continue-on-error: true
16 changes: 13 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
# OS
Thumbs.db
.DS_Store
.ignore*/

# Editors
.vs/
.vscode/
.idea/
.fleet/
.zed/

# Lang: Rust
# Rust
debug/
target/
Cargo.lock
**/*.rs.bk
*.pdb

# Generated
*.backup
coverage/

# Output
build/
output/
dist/

# Environment
env/
.env
.env*
!.env.example

# Logs
logs/
Expand Down
13 changes: 5 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

[package]
name = "countio"
version = "0.2.19"
version = "0.3.0"
readme = "./README.md"

edition = "2021"
edition = "2024"
rust-version = "1.85"
authors = ["Oleh Martsokha <o.martsokha@gmail.com>"]
license = "MIT"

Expand All @@ -23,14 +24,10 @@ its async variants from futures and tokio.
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[lib]
path = "./lib.rs"

[features]
default = ["std"]
full = ["std", "tokio", "futures"]
default = []
full = ["tokio", "futures"]

std = []
tokio = ["dep:tokio"]
futures = ["dep:futures-io"]

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Spire
Copyright (c) 2024 Spire Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn main() -> Result<()> {
let mut buf = String::new();
let len = reader.read_line(&mut buf)?;

assert_eq!(len, reader.reader_bytes());
assert_eq!(len, reader.bytes_read());
Ok(())
}
```
Expand All @@ -61,7 +61,7 @@ fn main() -> Result<()> {
let len = writer.write(buf)?;
writer.flush()?;

assert_eq!(len, writer.writer_bytes());
assert_eq!(len, writer.bytes_written());
Ok(())
}
```
Expand Down
Loading
Loading