Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
50 changes: 26 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,43 @@ jobs:
test_dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Install Dependencies
run: |
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build
- name: Test
run: cargo test
- name: Check capnp schema should match the generated code
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -y capnproto libcapnp-dev
- name: Build
run: cargo build
- name: Test
run: cargo test
make capnp-build
git diff --exit-code
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should prove that capnproto does not need to be included


test_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Install Dependencies
run: |
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Install Dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -y capnproto libcapnp-dev
- name: Build
run: cargo build --release
- name: Test
run: cargo test --release
- name: Build
run: cargo build --release
- name: Test
run: cargo test --release

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Install Dependencies
run: |
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Install Dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -y capnproto libcapnp-dev
- name: Rustfmt
run: cargo fmt --check
- name: Clippy
run: cargo clippy -- -Dwarnings
- name: Rustfmt
run: cargo fmt --check
- name: Clippy
run: cargo clippy -- -Dwarnings
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![CI](https://github.com/enviodev/hypersync-client-rust/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/enviodev/hypersync-client-rust/actions/workflows/ci.yaml)
<a href="https://crates.io/crates/hypersync-client">
<img src="https://img.shields.io/crates/v/hypersync-client.svg?style=flat-square"
<img src="https://img.shields.io/crates/v/hypersync-client.svg?style=flat-square"
alt="Crates.io version" />
</a>

Expand All @@ -12,7 +12,7 @@ Rust crate for [Envio's](https://envio.dev/) HyperSync client.

### Dependencies

Need to install capnproto tool in order to build the library.
In order to update the capnp schema on hypersync-net-types, you will need to install the `capnproto` tool.

#### Linux

Expand All @@ -31,3 +31,14 @@ choco install capnproto
```bash
brew install capnp
```

## Building

To build the schema, run the following command:

```bash
cd hypersync-net-types
make capnp-build
```

This triggers the build script in hypersync-net-types, which will generate the `hypersync_net_types_capnp.rs` file in the `src` directory.
2 changes: 2 additions & 0 deletions hypersync-format/src/types/fixed_size_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ impl<const N: usize> fmt::Debug for FixedSizeData<N> {
#[cfg(test)]
mod tests {
type FixedSizeData = super::FixedSizeData<4>;
type FSD4 = FixedSizeData;
use derive_more::FromStr;
use hex_literal::hex;
use serde_test::{assert_tokens, Token};

Expand Down
3 changes: 0 additions & 3 deletions hypersync-net-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@ serde = { version = "1", features = ["derive"] }
arrayvec = { version = "0.7", features = ["serde"] }

hypersync-format = { path = "../hypersync-format", version = "0.4" }

[build-dependencies]
capnpc = "0.19"
19 changes: 19 additions & 0 deletions hypersync-net-types/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# hypersync-net-types

This crate contains the capnp schema for the hypersync network protocol.

## Building

To build the schema, run the following command:

```bash
make capnp-build
```

This will generate the `hypersync_net_types_capnp.rs` file in the `src` directory.

The build script will not run on every build, so you will need to run it manually if you make changes to the schema.

The ci tests will fail if the schema is not up to date.

This is to avoid the need to have a capnp compiler installed on the consumers of this crate.
6 changes: 0 additions & 6 deletions hypersync-net-types/build.rs

This file was deleted.

6 changes: 6 additions & 0 deletions hypersync-net-types/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.PHONY: capnp-build

capnp-build:
cargo install capnpc
capnp compile -orust:src hypersync_net_types.capnp
rustfmt -- src/hypersync_net_types_capnp.rs
Loading
Loading