-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgraded protobuf to support cross crate imports. (#24)
Upgraded protobuf to support cross crate imports. We need it to allow defining protos in zksync-era as well. Proto packages share a single common namespace, so I prefixed our packages with zksync.<crate name>. I couldn't name the crate "protobuf", because cargo deny has mistaken it for the public crate with the same name. I've named it "zksync_protobuf", to be consistent with zksync-era repo. CI protobuf compatibility check is now more complex, because we need to collect the descriptors from the cargo build artifacts. Currently it is implemented as a bash command, but can be upgraded to a proper github action in the future. --------- Co-authored-by: Bruno França <[email protected]>
- Loading branch information
1 parent
3330c83
commit 9b30037
Showing
77 changed files
with
1,266 additions
and
485 deletions.
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 |
---|---|---|
|
@@ -14,24 +14,46 @@ on: | |
branches: ["main"] | ||
|
||
env: | ||
PROTOS_DIR: "node/libs/schema/proto" | ||
CARGO_TERM_COLOR: always | ||
CARGO_INCREMENTAL: "0" | ||
RUSTFLAGS: "-Dwarnings -C linker=clang -C link-arg=-fuse-ld=lld -C link-arg=-Wl,-z,nostart-stop-gc" | ||
RUSTC_WRAPPER: "sccache" | ||
SCCACHE_GHA_ENABLED: "true" | ||
RUST_BACKTRACE: "1" | ||
|
||
jobs: | ||
compatibility: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# github.base_ref -> github.head_ref for pull_request | ||
# github.event.before -> github.event.after for push | ||
- uses: mozilla-actions/[email protected] | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.base_ref || github.event.before }} | ||
path: before | ||
- name: compile before | ||
run: cargo build --all-targets | ||
working-directory: ./before/node | ||
- name: build before.binpb | ||
run: > | ||
perl -ne 'print "$1\n" if /PROTOBUF_DESCRIPTOR="(.*)"/' | ||
`find ./before/node/target/debug/build/*/output` | ||
| xargs cat > ./before.binpb | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref || github.event.after }} | ||
path: after | ||
- name: compile after | ||
run: cargo build --all-targets | ||
working-directory: ./after/node | ||
- name: build after.binpb | ||
run: > | ||
perl -ne 'print "$1\n" if /PROTOBUF_DESCRIPTOR="(.*)"/' | ||
`find ./after/node/target/debug/build/*/output` | ||
| xargs cat > ./after.binpb | ||
- uses: bufbuild/buf-setup-action@v1 | ||
- uses: bufbuild/buf-breaking-action@v1 | ||
with: | ||
input: "after/$PROTOS_DIR" | ||
against: "before/$PROTOS_DIR" | ||
input: "./after.binpb" | ||
against: "./before.binpb" |
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 |
---|---|---|
|
@@ -28,7 +28,7 @@ jobs: | |
path: "protobuf" | ||
- uses: mozilla-actions/[email protected] | ||
- name: build test | ||
run: cargo build -p zksync_consensus_schema --bin conformance_test | ||
run: cargo build -p zksync_protobuf --bin conformance_test | ||
working-directory: "this/node" | ||
- name: Cache Bazel | ||
uses: actions/cache@v3 | ||
|
@@ -41,6 +41,6 @@ jobs: | |
- name: run test | ||
run: > | ||
bazel run //conformance:conformance_test_runner -- | ||
--failure_list "${{ github.workspace }}/this/node/libs/schema/src/bin/conformance_test_failure_list.txt" | ||
--failure_list "${{ github.workspace }}/this/node/libs/protobuf/src/bin/conformance_test/failure_list.txt" | ||
"${{ github.workspace }}/this/node/target/debug/conformance_test" | ||
working-directory: "protobuf" |
Oops, something went wrong.