From 9e47d9d377c3e963e686fd8f341d791ffea12b42 Mon Sep 17 00:00:00 2001 From: Markus Mayer Date: Sun, 5 May 2024 14:15:07 +0200 Subject: [PATCH 1/4] Run tests on Linux, MacOS and Windows --- .github/workflows/rust.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index fa4551d..0c4e1bb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,3 +1,4 @@ +--- name: Rust on: @@ -11,14 +12,15 @@ env: jobs: build: - - runs-on: ubuntu-latest - + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-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 + - name: Run tests + run: cargo test --verbose --features=serde + - name: Run doctests + run: cargo test --doc --verbose --features=serde From de969ae5ec6ecdafcf6c740a83e31c911f08e436 Mon Sep 17 00:00:00 2001 From: Markus Mayer Date: Sun, 5 May 2024 14:20:51 +0200 Subject: [PATCH 2/4] Update dependencies --- Cargo.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cabc21a..538acf3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,11 +31,11 @@ required-features = ["serde"] [dependencies] arbitrary = { version = "1.3.2", optional = true } -base64 = "0.21.5" -bytemuck = { version = "1.14.0", optional = true, features = ["derive"] } -serde = { version = "1.0.193", optional = true } -uuid = "1.6.1" -zerocopy = { version = "0.7.32", optional = true, features = ["derive"] } +base64 = "0.22.1" +bytemuck = { version = "1.15.0", optional = true, features = ["derive"] } +serde = { version = "1.0.200", optional = true } +uuid = "1.8.0" +zerocopy = { version = "0.7.33", optional = true, features = ["derive"] } [dev-dependencies] hex = "0.4.3" From cf668d40c983fe6564edb05b91bd925ec4377860 Mon Sep 17 00:00:00 2001 From: Markus Mayer Date: Fri, 10 May 2024 12:29:40 +0200 Subject: [PATCH 3/4] Add support for codecov --- .github/workflows/rust.yml | 33 ++++++++++++++++++++++++++++++--- .gitignore | 1 + src/lib.rs | 2 +- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0c4e1bb..a9e594e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -12,15 +12,42 @@ env: jobs: build: + name: Build and Test runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + 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 test --verbose --features=serde + run: cargo nextest run --verbose --all-features - name: Run doctests - run: cargo test --doc --verbose --features=serde + run: cargo test --doc --verbose --all-features + + codecov: + name: Code Coverage + runs-on: ubuntu-latest + steps: + - 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/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. //! //! ``` From d0758dc61e2c36de877a3af5b85520b8cab09fe8 Mon Sep 17 00:00:00 2001 From: Markus Mayer Date: Fri, 10 May 2024 12:34:28 +0200 Subject: [PATCH 4/4] Add badge for code coverage --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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.