diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index fa4551d..a9e594e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,3 +1,4 @@ +--- name: Rust on: @@ -11,14 +12,42 @@ env: jobs: build: + name: Build and Test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + steps: + - uses: actions/checkout@v4 + - name: Check format + run: cargo fmt --check + - name: Build + run: cargo build --verbose + - uses: taiki-e/install-action@nextest + - name: Run tests + run: cargo nextest run --verbose --all-features + - name: Run doctests + run: cargo test --doc --verbose --all-features + codecov: + name: Code Coverage runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose --features=serde - - name: Run doctests - run: cargo test --doc --verbose --features=serde + - uses: actions/checkout@v4 + - name: Build + run: cargo build --verbose + - uses: dtolnay/rust-toolchain@stable + with: + components: llvm-tools-preview + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: Install nextest + uses: taiki-e/install-action@nextest + - name: Generate code coverage + run: cargo llvm-cov nextest --all-features --workspace --lcov --output-path lcov.info + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: lcov.info + fail_ci_if_error: true diff --git a/.gitignore b/.gitignore index 8eb581d..b8705c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target /Cargo.lock /.idea +/lcov.info diff --git a/Cargo.toml b/Cargo.toml index 0f79bef..e149794 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,12 +13,12 @@ rust-version = "1.67.1" [features] default = ["fast-rng"] -arbitrary = ["uuid/arbitrary", "arbitrary/derive"] # Add support for arbitrary types -random = ["uuid/v4"] # Create random ShortGuid IDs -fast-rng = ["random", "uuid/fast-rng"] # Use a faster (but still sufficiently random) RNG -serde = ["dep:serde", "uuid/serde"] # Serialization and deserialization support -# zerocopy = ["dep:zerocopy", "uuid/zerocopy"] # Zerocopy support -bytemuck = ["dep:bytemuck", "uuid/bytemuck"] # Bytemuck support +arbitrary = ["uuid/arbitrary", "arbitrary/derive"] # Add support for arbitrary types +random = ["uuid/v4"] # Create random ShortGuid IDs +fast-rng = ["random", "uuid/fast-rng"] # Use a faster (but still sufficiently random) RNG +serde = ["dep:serde", "uuid/serde"] # Serialization and deserialization support +# zerocopy = ["dep:zerocopy", "uuid/zerocopy"] # Zerocopy support +bytemuck = ["dep:bytemuck", "uuid/bytemuck"] # Bytemuck support borsh = ["dep:borsh", "dep:borsh-derive", "uuid/borsh"] # Borsh support [[example]] diff --git a/README.md b/README.md index fbaf66f..5440b1e 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ # ShortGuid -Short URL-safe Base64 encoded UUIDs. +[![codecov](https://codecov.io/gh/nyris/shortguid-rs/graph/badge.svg?token=YOM7OCX28D)](https://codecov.io/gh/nyris/shortguid-rs) + +Short URL-safe Base64 encoded UUIDs. --- -ShortGuids transparently represent UUID types but use only 22 characters +ShortGuids transparently represent UUID types but use only 22 characters in their string representation, as opposed to 36 characters for a dashed UUID or 32 without dashes. diff --git a/src/lib.rs b/src/lib.rs index babdc9b..5ba42c9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ //! # shortguid -//! +//! //! Provides short, URL-safe UUID representations. //! //! ```