ci: vendor protoc (#152)

* ci: vendor protoc

* ci: remove protoc compiler install
This commit is contained in:
Nathan.fooo 2023-11-08 21:12:00 +08:00 committed by GitHub
parent b4b8303bae
commit d37fbbf486
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 58 additions and 12 deletions

View File

@ -19,9 +19,6 @@ jobs:
workspaces: |
AppFlowy-Cloud
- name: Install protobuf compiler
run: sudo apt-get install -y protobuf-compiler
- name: Check
working-directory: ./libs/client-api
run: cargo build

View File

@ -41,9 +41,6 @@ jobs:
run: |
docker compose up -d
- name: Install protobuf compiler
run: sudo apt-get install -y protobuf-compiler
- name: Run tests
run: |
cargo install sqlx-cli --version=${{ env.SQLX_VERSION }} --features ${{ env.SQLX_FEATURES }} --no-default-features --locked

View File

@ -28,9 +28,6 @@ jobs:
- name: Copy and rename dev.env to .env
run: cp dev.env .env
- name: Install protobuf compiler
run: sudo apt-get install -y protobuf-compiler
- name: Code Gen
working-directory: ./build
run: ./code_gen.sh

51
Cargo.lock generated
View File

@ -3312,6 +3312,56 @@ dependencies = [
"prost",
]
[[package]]
name = "protoc-bin-vendored"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "005ca8623e5633e298ad1f917d8be0a44bcf406bf3cde3b80e63003e49a3f27d"
dependencies = [
"protoc-bin-vendored-linux-aarch_64",
"protoc-bin-vendored-linux-ppcle_64",
"protoc-bin-vendored-linux-x86_32",
"protoc-bin-vendored-linux-x86_64",
"protoc-bin-vendored-macos-x86_64",
"protoc-bin-vendored-win32",
]
[[package]]
name = "protoc-bin-vendored-linux-aarch_64"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fb9fc9cce84c8694b6ea01cc6296617b288b703719b725b8c9c65f7c5874435"
[[package]]
name = "protoc-bin-vendored-linux-ppcle_64"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02d2a07dcf7173a04d49974930ccbfb7fd4d74df30ecfc8762cf2f895a094516"
[[package]]
name = "protoc-bin-vendored-linux-x86_32"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54fef0b04fcacba64d1d80eed74a20356d96847da8497a59b0a0a436c9165b0"
[[package]]
name = "protoc-bin-vendored-linux-x86_64"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8782f2ce7d43a9a5c74ea4936f001e9e8442205c244f7a3d4286bd4c37bc924"
[[package]]
name = "protoc-bin-vendored-macos-x86_64"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5de656c7ee83f08e0ae5b81792ccfdc1d04e7876b1d9a38e6876a9e09e02537"
[[package]]
name = "protoc-bin-vendored-win32"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9653c3ed92974e34c5a6e0a510864dab979760481714c172e0a34e437cb98804"
[[package]]
name = "psl-types"
version = "2.0.11"
@ -3531,6 +3581,7 @@ dependencies = [
"collab-entity",
"prost",
"prost-build",
"protoc-bin-vendored",
"serde",
"serde_json",
"tokio-tungstenite",

View File

@ -15,9 +15,6 @@ RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
ENV SQLX_OFFLINE true
# install protobuf
RUN apt-get update -y && apt-get install -y protobuf-compiler
# Build the project
RUN cargo build --release --bin appflowy_cloud

View File

@ -22,4 +22,5 @@ actix_message = ["actix"]
tungstenite = ["tokio-tungstenite"]
[build-dependencies]
protoc-bin-vendored = { version = "3.0" }
prost-build = "0.12.1"

View File

@ -1,6 +1,12 @@
use std::process::Command;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let protoc_path = protoc_bin_vendored::protoc_bin_path().expect("protoc bin path");
let protoc_path_str = protoc_path.to_str().expect("protoc path to str");
// Set the `PROTOC` environment variable to the path of the `protoc` binary.
std::env::set_var("PROTOC", protoc_path_str);
prost_build::Config::new()
.out_dir("src/")
.compile_protos(&["proto/realtime.proto"], &["proto/"])?;