Skip to content
59 changes: 45 additions & 14 deletions .github/workflows/build-cli-release.reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
type: boolean
default: true
required: false

push:
branches:
- protoc-fix
env:
MACOSX_DEPLOYMENT_TARGET: "10.13"

Expand Down Expand Up @@ -68,19 +70,42 @@
# if: matrix._.os == 'ubuntu-latest'
# shell: bash
# run: |
# ci/ubuntu-install-packages

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'BAML Release - Build BAML CLI' step
Uses Step
uses 'dtolnay/rust-toolchain' with ref 'stable', not a pinned commit hash


- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix._.target }}


- uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Install protoc-gen-go
run: go install github.com/golang/protobuf/protoc-gen-go@latest

- name: Add protoc-gen-go to path
shell: bash
run: |
echo "$HOME/go/bin" >> $GITHUB_PATH
# Also set for current step
export PATH="$PATH:$HOME/go/bin"
echo "PATH=$PATH:$HOME/go/bin" >> $GITHUB_ENV

- name: Test protoc-gen-go availability
shell: bash
run: |
echo "Current PATH: $PATH"
echo "Go bin directory contents:"
ls -la $HOME/go/bin/
echo "Which protoc-gen-go:"
which protoc-gen-go
echo "Testing protoc can find protoc-gen-go plugin..."
# Test that protoc can find the go plugin (this will show an error about missing .proto file, but that's expected)
protoc --go_out=/tmp --help | grep -q "go_out" && echo "✅ protoc recognizes --go_out flag" || echo "❌ protoc does not recognize --go_out flag"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider failing the step if '--go_out' isn’t recognized instead of only echoing a message.

Suggested change
protoc --go_out=/tmp --help | grep -q "go_out" && echo "✅ protoc recognizes --go_out flag" || echo "❌ protoc does not recognize --go_out flag"
protoc --go_out=/tmp --help | grep -q "go_out" && echo "✅ protoc recognizes --go_out flag" || (echo "❌ protoc does not recognize --go_out flag"; exit 1)


- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix._.target }}

- name: Use Cross
if: contains(matrix._.os, 'ubuntu')
Expand Down Expand Up @@ -111,17 +136,23 @@
workspaces: engine
prefix-key: "v5-rust-${{ matrix._.target }}"

# Build the CLI - Always use static-ssl features
- name: Build CLI Binary
# This single step now handles all builds
run: >
${{ env.CARGO }} build --release --bin baml-cli ${{ env.TARGET_FLAGS }}
--features static-ssl
--no-default-features
working-directory: engine
# # Build the CLI - Always use static-ssl features
# - name: Build CLI Binary
# # This single step now handles all builds
# run: >
# ${{ env.CARGO }} build --release --bin baml-cli ${{ env.TARGET_FLAGS }}
# --features static-ssl
# --no-default-features
# working-directory: engine

- name: Build CFFI Library
run: >
shell: bash
env:
PROTOC_ARGS: --plugin=protoc-gen-go=$HOME/go/bin/protoc-gen-go
run: |
# The PROTOC_ARGS env var is used by prost-build to pass arguments to protoc.
# We use it to explicitly tell the vendored protoc where to find the go plugin,
# as the cross-compile environment does not inherit the PATH correctly.
${{ env.CARGO }} build --release -p baml_cffi ${{ env.TARGET_FLAGS }}
working-directory: engine
# Skip this step on Windows runners
Expand Down
Loading