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
78 changes: 47 additions & 31 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run tests
name: CI

on:
push:
Expand All @@ -10,54 +10,70 @@ env:
CARGO_TERM_COLOR: always

jobs:
build:
check:
name: Check & Test
runs-on: ubuntu-latest

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

- name: Toolchain
uses: actions-rs/toolchain@v1
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
components: rustfmt, clippy

# format is the only step that doesn't require updating the crates.io cache, so we do it first
# to minimize ci cost when bailing early
- name: Format
run: cargo fmt --all -- --check

- name: Outdated
run: cargo outdated -R --exit-code 1

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

- name: Check
run: cargo check
# Format check first - fast fail
- name: Check formatting
run: cargo fmt --all -- --check

- name: Clippy
run: cargo clippy -- -D warnings
run: cargo clippy -- -W warnings

- name: Build
run: cargo build --release

- name: Test
run: cargo test --release

- name: Tarpaulin
uses: actions-rs/tarpaulin@v0.1
with:
version: '0.22.0'
audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: WASM Sanity Build
- name: Security audit
run: cargo audit

wasm:
name: WASM Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Install wasm-pack
run: cargo install wasm-pack

- name: Build WASM
run: |
cd wasm
cargo install wasm-pack
wasm-pack build

- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{secrets.CODECOV_TOKEN}}
3 changes: 1 addition & 2 deletions src/core/common.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::data::{dat, Value};
use crate::data::Value;
use crate::error::{err, Error, Result};

use lazy_static::lazy_static;
Expand Down Expand Up @@ -294,7 +294,6 @@ pub fn sniff(raw: &[u8]) -> Result<SniffResult> {
#[cfg(test)]
mod test {
use crate::core::common;
use crate::data::dat;
use rstest::rstest;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/core/creder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
core::matter::tables as matter,
core::sadder::Sadder,
core::saider::Saider,
data::{dat, Value},
data::Value,
error::{err, Error, Result},
};

Expand Down
13 changes: 5 additions & 8 deletions src/core/pather.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,11 @@ impl Matter for Pather {
#[cfg(test)]
mod test {
use super::Pather;
use crate::{
core::{
bexter::Bext,
matter::{tables as matter, Matter},
saider::Saider,
serder::Serder,
},
data::dat,
use crate::core::{
bexter::Bext,
matter::{tables as matter, Matter},
saider::Saider,
serder::Serder,
};

#[test]
Expand Down
17 changes: 7 additions & 10 deletions src/core/prefixer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,16 +390,13 @@ impl Matter for Prefixer {

#[cfg(test)]
mod test {
use crate::{
core::{
common::{sizeify, versify, Ilkage, Serialage, CURRENT_VERSION},
diger::Diger,
matter::{tables as matter, Matter},
prefixer::Prefixer,
signer::Signer,
verfer::Verfer,
},
data::dat,
use crate::core::{
common::{sizeify, versify, Ilkage, Serialage, CURRENT_VERSION},
diger::Diger,
matter::{tables as matter, Matter},
prefixer::Prefixer,
signer::Signer,
verfer::Verfer,
};
use rstest::rstest;

Expand Down
2 changes: 1 addition & 1 deletion src/core/sadder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ mod test {
sadder::Sadder,
saider::Saider,
};
use crate::data::{dat, Value};
use crate::data::Value;

#[derive(Debug, Clone, PartialEq)]
struct TestSadder {
Expand Down
3 changes: 1 addition & 2 deletions src/core/saider.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::core::common::{deversify, dumps, sizeify, Ids, Serialage, DUMMY};
use crate::core::matter::{tables as matter, Matter};
use crate::crypto::hash;
use crate::data::{dat, Value};
use crate::data::Value;
use crate::error::{err, Error, Result};

#[derive(Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -299,7 +299,6 @@ mod test {
use crate::core::common::{versify, Identage, Ids, Serialage, Version};
use crate::core::matter::{tables as matter, Matter};
use crate::core::saider::Saider;
use crate::data::dat;
use rstest::rstest;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/core/serder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
tholder::Tholder,
verfer::Verfer,
},
data::{dat, Value},
data::Value,
error::{err, Error, Result},
};

Expand Down
2 changes: 1 addition & 1 deletion src/core/tholder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
matter::{tables as matter, Matter},
number::{tables as number, Number},
},
data::{dat, Array, Value},
data::{Array, Value},
error::{err, Error, Result},
};

Expand Down
2 changes: 1 addition & 1 deletion src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ pub use dat;

#[cfg(test)]
mod test {
use crate::data::{dat, Value};
use crate::data::Value;
use indexmap::IndexMap;

#[test]
Expand Down