-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Init project * Make v1 module as public * Add check, lint action * Remove push * Add recursive submodules to ci * Small refactor * Fix dependencies to compile for wasm * Remove onw macro + add optional transport for client * Fix transport issue * Update protobuf * Update protobufs fix * Update README.md * Update .gitmodules * Update rust.yml * Update rust.yml
- Loading branch information
Showing
8 changed files
with
146 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
on: [pull_request] | ||
|
||
name: Rust | ||
|
||
jobs: | ||
check: | ||
name: Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v1 | ||
|
||
- name: Run cargo check | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
|
||
test: | ||
name: Test Suite | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v1 | ||
|
||
- name: Run cargo test | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
|
||
lints: | ||
name: Lints | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
components: rustfmt, clippy | ||
|
||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v1 | ||
|
||
- name: Run cargo fmt | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
|
||
- name: Run cargo clippy | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: -- -D warnings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[submodule "protobuf"] | ||
path = protobuf | ||
url = git@github.com:coin-shuffle/protobuf.git | ||
branch = v0.1.0-alpha |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[package] | ||
name = "coin-shuffle-protos" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[features] | ||
default = ["server", "client", "transport"] | ||
transport = ["tonic/transport", "tonic-build/transport"] | ||
server = ["transport"] | ||
client = [] | ||
|
||
[dependencies] | ||
prost = "0.11.5" | ||
tonic = { version = "0.8.3", default-features = false, features = [ | ||
"prost", | ||
"codegen", | ||
] } | ||
|
||
|
||
[build-dependencies] | ||
tonic-build = { version = "0.8.4", default-features = false, features = [ | ||
"prost", | ||
] } | ||
eyre = "0.6.8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# protos | ||
A crate for all `coin-shuffle` proto definitions in rust code | ||
|
||
A crate for all `coin-shuffle` proto definitions in rust code. | ||
|
||
Uses `protobuf` repo as protos source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use eyre::Context; | ||
|
||
fn main() -> eyre::Result<()> { | ||
tonic_build::configure() | ||
.build_client(cfg!(feature = "client")) | ||
.build_server(cfg!(feature = "server")) | ||
.compile( | ||
&[ | ||
proto_path("v1", "shuffle_service"), | ||
proto_path("v1", "events"), | ||
proto_path("v1", "types"), | ||
], | ||
&[COIN_SHUFFLE_PROTO], | ||
) | ||
.context("failed to build protos")?; | ||
|
||
Ok(()) | ||
} | ||
|
||
const COIN_SHUFFLE_PROTO: &str = "./protobuf/"; | ||
|
||
fn proto_path(version: &str, proto_file: &str) -> String { | ||
format!( | ||
"{}/coin_shuffle/{version}/{proto_file}.proto", | ||
COIN_SHUFFLE_PROTO | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod v1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tonic::include_proto!("coin_shuffle.v1"); |