From 902df7a051f9b1b1e045cbbe9269a15888769dc9 Mon Sep 17 00:00:00 2001 From: beltram Date: Tue, 13 Jun 2023 19:50:50 +0200 Subject: [PATCH] build: prevent Docker image build to fail due to missing 'protoc' on builder container --- .github/workflows/release.yaml | 2 ++ lib/build.rs | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3ea09606..581751e6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -193,6 +193,8 @@ jobs: if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest needs: [ release ] + env: + DOCKER_BUILD: true steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@stable diff --git a/lib/build.rs b/lib/build.rs index 627317ea..aa473e45 100644 --- a/lib/build.rs +++ b/lib/build.rs @@ -1,9 +1,8 @@ fn main() -> Result<(), Box> { // otherwise fails while building Docker image - #[cfg(not(target_env = "musl"))] - { - for proto in std::fs::read_dir("tests/grpc/protos").unwrap() { - proto.map(|p| p.path()).ok().map(tonic_build::compile_protos).transpose()?; + if std::env::var("DOCKER_BUILD").is_err() { + for proto in std::fs::read_dir("tests/grpc/protos")? { + tonic_build::compile_protos(proto?.path())?; } } Ok(())