diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml
new file mode 100644
index 0000000..c5df5a0
--- /dev/null
+++ b/.github/workflows/audit.yml
@@ -0,0 +1,18 @@
+
+name: Security audit
+on:
+ push:
+ # For PR we only want to fail if dependencies were changed.
+ paths:
+ - "**/Cargo.toml"
+ # Run the audit job once a day on main.
+ schedule:
+ - cron: "0 0 * * *"
+jobs:
+ security_audit:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: rustsec/audit-check@v1.4.1
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 923a569..8437c1d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -5,6 +5,8 @@ on:
branches:
- main
- release-*
+ tags:
+ - v[0-9]+.[0-9]+.[0-9]+
pull_request:
branches:
- main
@@ -12,53 +14,85 @@ on:
workflow_dispatch:
concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
jobs:
- build:
+ lint:
runs-on: ubuntu-latest
env:
RUST_LOG: info
-
steps:
- uses: actions/checkout@v4
name: Checkout Repository
- - name: Install Protoc
- uses: arduino/setup-protoc@v3
-
- - uses: dtolnay/rust-toolchain@stable
-
- uses: Swatinem/rust-cache@v2
name: Enable Rust Caching
+ with:
+ cache-on-failure: true
- name: Format Check
run: cargo fmt -- --check
- - name: Audit
- run: cargo audit --ignore RUSTSEC-2023-0018 --ignore RUSTSEC-2023-0052 --ignore RUSTSEC-2023-0065
+ - name: Clippy
+ uses: actions-rs-plus/clippy-check@v1
+ with:
+ token: ${{ github.token }}
+ args: --workspace --all-features --all-targets -- -D warnings
- - name: Lint
- run: |
- cargo clippy --workspace --release
+ - name: Clippy without default features
+ uses: actions-rs-plus/clippy-check@v1
+ with:
+ token: ${{ github.token }}
+ args: --workspace --no-default-features --all-targets -- -D warnings
+
+ build:
+ runs-on: ubuntu-latest
+ env:
+ RUST_LOG: info
+ steps:
+ - uses: actions/checkout@v4
+ name: Checkout Repository
+
+ - uses: Swatinem/rust-cache@v2
+ name: Enable Rust Caching
- name: Build
- # Build in release without `testing` feature.
- run: |
- cargo build --workspace --release
+ run: cargo build --all-features --all-targets --release
+
+ test:
+ runs-on: ubuntu-latest
+ env:
+ RUST_LOG: info
+ steps:
+ - uses: actions/checkout@v4
+ name: Checkout Repository
+
+ - uses: Swatinem/rust-cache@v2
+ name: Enable Rust Caching
+
+ - name: Build tests
+ run: cargo test --workspace --release --all-features --no-run
- name: Test
- # Build test binary with `testing` feature
- run: |
- cargo test --workspace --release --all-features --no-run
- cargo test --workspace --release --all-features --verbose -- --test-threads 2
+ run: cargo test --workspace --release --all-features --verbose -- --test-threads 2
timeout-minutes: 60
+ docs:
+ runs-on: ubuntu-latest
+ env:
+ RUST_LOG: info
+ steps:
+ - uses: actions/checkout@v4
+ name: Checkout Repository
+
+ - uses: Swatinem/rust-cache@v2
+ name: Enable Rust Caching
+
- name: Generate Documentation
run: |
- cargo doc --no-deps --lib --release
- echo '' > target/doc/index.html
+ cargo doc --no-deps --lib --release --all-features
+ echo '' > target/doc/index.html
- name: Deploy Documentation
uses: peaceiris/actions-gh-pages@v3
@@ -66,4 +100,34 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
- cname: versioned-binary-serialization.docs.espressosys.com
+ cname: commit.docs.espressosys.com
+
+ semver-check:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ name: Checkout Repository
+
+ - uses: Swatinem/rust-cache@v2
+ name: Enable Rust Caching
+
+ - name: Check semver
+ uses: obi1kenobi/cargo-semver-checks-action@v2
+
+ publish:
+ needs:
+ - build
+ - test
+ - lint
+ - docs
+ - semver-check
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: katyo/publish-crates@v2
+ with:
+ # Only do an actual publish if this is a push to a release tag. Otherwise, do a dry run.
+ dry-run: ${{ !(github.event_name == 'push' && github.ref_type == 'tag') }}
+ ignore-unpublished-changes: true
+ registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
+
diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml
index 172fefb..91725ca 100644
--- a/.github/workflows/build_windows.yml
+++ b/.github/workflows/build_windows.yml
@@ -35,9 +35,6 @@ jobs:
steps:
- uses: dtolnay/rust-toolchain@stable
- - name: Install Protoc
- uses: arduino/setup-protoc@v3
-
- name: Checkout Repository
uses: actions/checkout@v4
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
deleted file mode 100644
index d759840..0000000
--- a/.github/workflows/lint.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-name: Lint
-
-on:
- push:
- branches:
- - main
- - release-*
- pull_request:
- branches:
- - main
- - release-*
- workflow_dispatch:
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
-
-
-jobs:
- lint:
- runs-on: ubuntu-latest
- strategy:
- matrix:
- # Lint with many combinations of feature flags
- features:
- # No optional features
- - ''
- env:
- RUST_LOG: info
- steps:
- - uses: actions/checkout@v4
- name: Checkout Repository
-
- - name: Install Protoc
- uses: arduino/setup-protoc@v3
-
- - uses: dtolnay/rust-toolchain@stable
-
- - uses: Swatinem/rust-cache@v2
- name: Enable Rust Caching
-
- - uses: actions-rs/clippy-check@v1
- name: Clippy
- with:
- token: ${{ github.token }}
- args: --workspace --no-default-features --features "${{ matrix.features }}" -- -D warnings
diff --git a/Cargo.toml b/Cargo.toml
index e5793ae..c800a57 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,10 @@
[package]
-name = "versioned-binary-serialization"
-version = "0.1.2"
+name = "vbs"
+version = "0.1.3"
edition = "2021"
+rust-version = "1.75.0"
+authors = ["Espresso Systems "]
+repository = "https://github.com/EspressoSystems/versioned-binary-serialization.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
diff --git a/README.md b/README.md
index 2a03095..b557ae5 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,14 @@
-# versioned-binary-serialization
\ No newline at end of file
+# vbs
+
+Provides the following:
+- a trait `StaticVersionType` for constraining to a version (major.minor) at compile-time.
+ - sealed to a struct `StaticVersion`.
+ - for the purposes of version enforcement, patch versions are not treated as a type change.
+- a struct `Version` for runtime operations against a version, without requiring dyn
+ - used to \[de\]serialize a version in a strictly defined and immutable form, so that updates to the serialization format iteself can be a version controlled property.
+ - does not include patch level, prerelease identifiers, or build metadata; this is not intended to be a general purpose `semver` crate.
+- a trait `BinarySerializer`, an adaptor that can be implemented around any data format that adapts the `serde` data model.
+ - by default, serializes a version prefix before each top-level serialization, and verifies version compatibility when deserializing the serialized message.
+ - supports unversioned `[de]serialize_no_version` operations, which, by default, should simply be the same as calling `type.serialize(serializer)` for the embedded serializer.
+- implementations against existing data formats
+ - currently, only [bincode](https://crates.io/crates/bincode)
\ No newline at end of file