Skip to content

Commit

Permalink
Add checking protos to gh CI
Browse files Browse the repository at this point in the history
  • Loading branch information
pashinov committed Aug 23, 2023
1 parent f5aa1a8 commit efa7de3
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,29 @@ jobs:
with:
command: check

check-protos:
name: Check protos
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Install protobuf
run: sudo apt update && sudo apt-get -y install protobuf-compiler

- name: Generate Rust code from .proto files
run: cargo run -p gen-protos

- name: Check for uncommitted changes
run: git diff --exit-code

test:
name: Test Suite
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ edition = "2021"

[workspace]
members = [
"gen-protoc",
"gen-protos",
"nekoton-abi",
"nekoton-contracts",
"nekoton-derive",
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ cargo add nekoton
- Rust 1.62+
- `wasm-pack` 0.9.1+ (to test build for wasm target)

### Modifying protobuffers

Occasionally, you may need to change the `.proto` files that define request/response
data format. In this case, you will need to add a few steps to the above
workflow.

- Install the `protoc` compiler.
- Run `cargo run -p gen-protos` regularly (or after every edit to a `.proto`
file). The `gen-protos` binary will use the `prost-build` library to compile the
`.proto` files into `.rs` files.
- If you are adding a new `.proto` file, you will need to edit the list of
these files in `gen-protos/src/main.rs`.

The `.rs` files generated from `.proto` files are included in the repository,
and there is a Github CI check that will complain if they do not match.

## Contributing

We welcome contributions to the project! If you notice any issues or errors, feel free to open an issue or submit a pull request.
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit efa7de3

Please sign in to comment.