Skip to content

Commit 6a379ea

Browse files
committed
CI fixes
1 parent 1f78401 commit 6a379ea

File tree

3 files changed

+89
-7
lines changed

3 files changed

+89
-7
lines changed

.github/workflows/CI.yml

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,25 @@ jobs:
3333
with:
3434
components: clippy
3535
- uses: taiki-e/install-action@protoc
36+
- name: Install Bazel
37+
uses: bazel-contrib/[email protected]
38+
with:
39+
# Avoid downloading Bazel every time.
40+
bazelisk-cache: true
41+
# Store build cache per workflow.
42+
disk-cache: ${{ github.workflow }}
43+
# Share repository cache between workflows.
44+
repository-cache: true
45+
module-root: ./compiler
46+
- name: Build and protoc plugin and add to PATH
47+
id: build_step
48+
# This runs all commands within the compiler/ directory
49+
working-directory: ./compiler
50+
run: |
51+
bazel build //src:protoc-gen-rust-grpc
52+
53+
# Add the output directory to the GitHub PATH for subsequent steps
54+
echo "$(pwd)/bazel-bin/src" >> $GITHUB_PATH
3655
- uses: Swatinem/rust-cache@v2
3756
- run: cargo clippy --workspace --all-features --all-targets
3857

@@ -55,6 +74,25 @@ jobs:
5574
- uses: taiki-e/install-action@cargo-hack
5675
- uses: taiki-e/install-action@cargo-udeps
5776
- uses: taiki-e/install-action@protoc
77+
- name: Install Bazel
78+
uses: bazel-contrib/[email protected]
79+
with:
80+
# Avoid downloading Bazel every time.
81+
bazelisk-cache: true
82+
# Store build cache per workflow.
83+
disk-cache: ${{ github.workflow }}
84+
# Share repository cache between workflows.
85+
repository-cache: true
86+
module-root: ./compiler
87+
- name: Build and protoc plugin and add to PATH
88+
id: build_step
89+
# This runs all commands within the compiler/ directory
90+
working-directory: ./compiler
91+
run: |
92+
bazel build //src:protoc-gen-rust-grpc
93+
94+
# Add the output directory to the GitHub PATH for subsequent steps
95+
echo "$(pwd)/bazel-bin/src" >> $GITHUB_PATH
5896
- uses: Swatinem/rust-cache@v2
5997
- run: cargo hack udeps --workspace --exclude-features=_tls-any,tls,tls-aws-lc,tls-ring --each-feature
6098
- run: cargo udeps --package tonic --features tls-ring,transport
@@ -76,6 +114,25 @@ jobs:
76114
- uses: hecrj/setup-rust-action@v2
77115
- uses: taiki-e/install-action@cargo-hack
78116
- uses: taiki-e/install-action@protoc
117+
- name: Install Bazel
118+
uses: bazel-contrib/[email protected]
119+
with:
120+
# Avoid downloading Bazel every time.
121+
bazelisk-cache: true
122+
# Store build cache per workflow.
123+
disk-cache: ${{ github.workflow }}
124+
# Share repository cache between workflows.
125+
repository-cache: true
126+
module-root: ./compiler
127+
- name: Build and protoc plugin and add to PATH
128+
id: build_step
129+
# This runs all commands within the compiler/ directory
130+
working-directory: ./compiler
131+
run: |
132+
bazel build //src:protoc-gen-rust-grpc
133+
134+
# Add the output directory to the GitHub PATH for subsequent steps
135+
echo "$(pwd)/bazel-bin/src" >> $GITHUB_PATH
79136
- uses: Swatinem/rust-cache@v2
80137
- name: Check features
81138
run: cargo hack check --workspace --no-private --each-feature --no-dev-deps
@@ -115,6 +172,25 @@ jobs:
115172
- uses: actions/checkout@v4
116173
- uses: hecrj/setup-rust-action@v2
117174
- uses: taiki-e/install-action@protoc
175+
- name: Install Bazel
176+
uses: bazel-contrib/[email protected]
177+
with:
178+
# Avoid downloading Bazel every time.
179+
bazelisk-cache: true
180+
# Store build cache per workflow.
181+
disk-cache: ${{ github.workflow }}
182+
# Share repository cache between workflows.
183+
repository-cache: true
184+
module-root: ./compiler
185+
- name: Build and protoc plugin and add to PATH
186+
id: build_step
187+
# This runs all commands within the compiler/ directory
188+
working-directory: ./compiler
189+
run: |
190+
bazel build //src:protoc-gen-rust-grpc
191+
192+
# Add the output directory to the GitHub PATH for subsequent steps
193+
echo "$(pwd)/bazel-bin/src" >> $GITHUB_PATH
118194
- uses: taiki-e/install-action@cargo-hack
119195
- uses: taiki-e/install-action@cargo-nextest
120196
- uses: Swatinem/rust-cache@v2
@@ -151,7 +227,7 @@ jobs:
151227
# Share repository cache between workflows.
152228
repository-cache: true
153229
module-root: ./compiler
154-
- name: Build and protoc plugin and dd to PATH
230+
- name: Build and protoc plugin and add to PATH
155231
id: build_step
156232
# This runs all commands within the compiler/ directory
157233
working-directory: ./compiler

grpc-build/src/lib.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ pub struct Dependency {
1111
pub proto_files: Vec<String>,
1212
}
1313

14-
impl Into<protobuf_codegen::Dependency> for &Dependency {
15-
fn into(self) -> protobuf_codegen::Dependency {
14+
impl From<&Dependency> for protobuf_codegen::Dependency {
15+
fn from(val: &Dependency) -> Self {
1616
protobuf_codegen::Dependency {
17-
crate_name: self.crate_name.clone(),
18-
proto_import_paths: self.proto_import_paths.clone(),
17+
crate_name: val.crate_name.clone(),
18+
proto_import_paths: val.proto_import_paths.clone(),
1919
// TODO: Is this useful to expose the following field? It's not used
2020
// by protobuf codegen.
2121
c_include_paths: Vec::new(),
22-
proto_files: self.proto_files.clone(),
22+
proto_files: val.proto_files.clone(),
2323
}
2424
}
2525
}
@@ -193,3 +193,9 @@ impl CodeGen {
193193
crate_mapping_path
194194
}
195195
}
196+
197+
impl Default for CodeGen {
198+
fn default() -> Self {
199+
Self::new()
200+
}
201+
}

grpc/src/codec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use bytes::{Buf, BufMut};
22
use protobuf::Message;
33
use std::marker::PhantomData;
44
use tonic::{
5-
codec::{BufferSettings, Codec, DecodeBuf, Decoder, EncodeBuf, Encoder},
5+
codec::{Codec, DecodeBuf, Decoder, EncodeBuf, Encoder},
66
Status,
77
};
88

0 commit comments

Comments
 (0)