Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for crates io publishing #37

Merged
merged 3 commits into from
Mar 27, 2024
Merged
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
18 changes: 18 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
112 changes: 88 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,129 @@ on:
branches:
- main
- release-*
tags:
- v[0-9]+.[0-9]+.[0-9]+
pull_request:
branches:
- main
- release-*
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 '<meta http-equiv="refresh" content="0; url=versioned-binary-serialization">' > target/doc/index.html
cargo doc --no-deps --lib --release --all-features
echo '<meta http-equiv="refresh" content="0; url=vbs">' > target/doc/index.html

- name: Deploy Documentation
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
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 }}

3 changes: 0 additions & 3 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
46 changes: 0 additions & 46 deletions .github/workflows/lint.yml

This file was deleted.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
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

Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
# versioned-binary-serialization
# vbs

Provides the following:
- a trait `StaticVersionType` for constraining to a version (major.minor) at compile-time.
- sealed to a struct `StaticVersion<const MAJOR: u16, const MINOR: u16>`.
- 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)
Loading