Skip to content

Fixes issues with BamlSpan for async vs sync thread. #754

Fixes issues with BamlSpan for async vs sync thread.

Fixes issues with BamlSpan for async vs sync thread. #754

Workflow file for this run

name: Gloo CLI
on:
pull_request:
paths:
- "engine/**"
- ".github/workflows/cli.yml"
branches:
- canary
push:
paths:
- "engine/.bumpversion.cfg"
branches:
- canary
tags:
- "release/baml-cli/v*.*.*"
permissions:
contents: read
pull-requests: read
repository-projects: read
jobs:
build:
name: Build ${{ matrix.platform.name }}
strategy:
fail-fast: false # Don't stop all builds if one fails
matrix:
platform:
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
bin: baml
name: baml-linux-x86_64
command: build
- os: windows-latest
target: x86_64-pc-windows-msvc
bin: baml.exe
name: baml-Windows-x86_64
command: both
- os: macOS-latest
target: x86_64-apple-darwin
bin: baml
name: baml-Darwin-x86_64
command: both
- os: macOS-latest
target: aarch64-apple-darwin
bin: baml
name: baml-Darwin-apple-silicon
command: build # Can't test on macOS-latest because it's Intel
runs-on: ${{ matrix.platform.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
engine
prefix-key: "v2-rust" # We changed the ubuntu version so we need to invalidate the cache
- name: Build binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: ${{ matrix.platform.command }}
target: ${{ matrix.platform.target }}
args: "--locked --release"
strip: false # Don't strip debug symbols
working-directory: engine/baml-cli
# Run Tests on Linux
- name: Run tests
if: ${{ matrix.platform.target == 'x86_64-unknown-linux-gnu' }}
working-directory: engine/baml-cli
run: |
cargo test --locked --release --target x86_64-unknown-linux-gnu
- name: Add artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform.name }}
path: engine/target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}
pre-release:
permissions:
contents: write
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/canary'
environment: nightly
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get artifact [Darwin-Intel]
uses: actions/download-artifact@v4
with:
name: baml-Darwin-x86_64
path: engine/target/x86_64-apple-darwin/release/
- name: Get artifact [Darwin-Silicon]
uses: actions/download-artifact@v4
with:
name: baml-Darwin-apple-silicon
path: engine/target/aarch64-apple-darwin/release/
- name: Get artifact [Linux]
uses: actions/download-artifact@v4
with:
name: baml-linux-x86_64
path: engine/target/x86_64-unknown-linux-gnu/release/
- name: Get artifact [Windows]
uses: actions/download-artifact@v4
with:
name: baml-Windows-x86_64
path: engine/target/x86_64-pc-windows-msvc/release/
- id: hash
run: |
VERSION=$(cat engine/.bumpversion.cfg | grep "current_version =" | cut -d '=' -f 2 | sed 's/[", ]//g')
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+-canary\.[0-9]+$ ]]; then
echo "Version ($VERSION) is not a pre-release build"
exit 1
fi
pushd engine/target/x86_64-unknown-linux-gnu/release
tar -czvf baml-linux-x86_64.tar.gz baml
echo "linux_hash=$(shasum -a 256 baml-linux-x86_64.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
popd
pushd engine/target/x86_64-apple-darwin/release
tar -czvf baml-apple-intel.tar.gz baml
echo "darwin_intel_hash=$(shasum -a 256 baml-apple-intel.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
popd
pushd engine/target/aarch64-apple-darwin/release
tar -czvf baml-apple-arm.tar.gz baml
echo "darwin_arm_hash=$(shasum -a 256 baml-apple-arm.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
popd
windows_binary_path="engine/target/x86_64-pc-windows-msvc/release/baml.exe"
echo "windows_hash=$(shasum -a 256 "$windows_binary_path" | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
echo "version=$(echo $VERSION | cut -d '-' -f 1)" >> $GITHUB_OUTPUT
echo "full_version=$VERSION" >> $GITHUB_OUTPUT
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: "unstable/cli/v${{ steps.hash.outputs.version }}"
files: |
engine/target/x86_64-unknown-linux-gnu/release/baml-linux-x86_64.tar.gz
engine/target/x86_64-apple-darwin/release/baml-apple-intel.tar.gz
engine/target/aarch64-apple-darwin/release/baml-apple-arm.tar.gz
engine/target/x86_64-pc-windows-msvc/release/baml.exe
prerelease: true # Must manually upgrade to release once homebrew is updated.
body: |
## Hashes
Full Version: `${{ steps.hash.outputs.full_version }}`
Linux: `${{ steps.hash.outputs.linux_hash }}`
Mac: Intel: `${{ steps.hash.outputs.darwin_intel_hash }}`
Mac: Apple Silicon: `${{ steps.hash.outputs.darwin_arm_hash }}`
Windows: `${{ steps.hash.outputs.windows_hash }}`
- name: Trigger homebrew-baml update
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.HOMEBREW_BAML_PAT }}
repository: boundaryml/homebrew-baml
event-type: update-formula
client-payload: '{"version": "${{ steps.hash.outputs.full_version }}", "hash_linux": "${{ steps.hash.outputs.linux_hash }}", "hash_mac_intel": "${{ steps.hash.outputs.darwin_intel_hash }}", "hash_mac_arm": "${{ steps.hash.outputs.darwin_arm_hash }}", "hash_windows": "${{ steps.hash.outputs.windows_hash }}", "nightly": true}'
release:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/release/')
environment: release
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get artifact [Darwin-Intel]
uses: actions/download-artifact@v4
with:
name: baml-Darwin-x86_64
path: engine/target/x86_64-apple-darwin/release/
- name: Get artifact [Darwin-Silicon]
uses: actions/download-artifact@v4
with:
name: baml-Darwin-apple-silicon
path: engine/target/aarch64-apple-darwin/release/
- name: Get artifact [Linux]
uses: actions/download-artifact@v4
with:
name: baml-linux-x86_64
path: engine/target/x86_64-unknown-linux-gnu/release/
- name: Get artifact [Windows]
uses: actions/download-artifact@v4
with:
name: baml-Windows-x86_64
path: engine/target/x86_64-pc-windows-msvc/release/
- id: hash
run: |
VERSION=$(cat engine/.bumpversion.cfg | grep "current_version =" | cut -d '=' -f 2 | sed 's/[", ]//g')
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Version ($VERSION) is not a release build"
exit 1
fi
pushd engine/target/x86_64-unknown-linux-gnu/release
tar -czvf baml-linux-x86_64.tar.gz baml
echo "linux_hash=$(shasum -a 256 baml-linux-x86_64.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
popd
pushd engine/target/x86_64-apple-darwin/release
tar -czvf baml-apple-intel.tar.gz baml
echo "darwin_intel_hash=$(shasum -a 256 baml-apple-intel.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
popd
pushd engine/target/aarch64-apple-darwin/release
tar -czvf baml-apple-arm.tar.gz baml
echo "darwin_arm_hash=$(shasum -a 256 baml-apple-arm.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
popd
windows_binary_path="engine/target/x86_64-pc-windows-msvc/release/baml.exe"
echo "windows_hash=$(shasum -a 256 "$windows_binary_path" | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
echo "version=$(echo $VERSION | cut -d '-' -f 1)" >> $GITHUB_OUTPUT
echo "full_version=$VERSION" >> $GITHUB_OUTPUT
- name: Release
uses: softprops/action-gh-release@v2
with:
name: "Cli: ${{ steps.hash.outputs.version }}"
tag_name: "release/baml-cli/v${{ steps.hash.outputs.version }}"
files: |
engine/target/x86_64-unknown-linux-gnu/release/baml-linux-x86_64.tar.gz
engine/target/x86_64-apple-darwin/release/baml-apple-intel.tar.gz
engine/target/aarch64-apple-darwin/release/baml-apple-arm.tar.gz
engine/target/x86_64-pc-windows-msvc/release/baml.exe
prerelease: false
body: |
## Hashes
Linux: `${{ steps.hash.outputs.linux_hash }}`
Mac: Intel: `${{ steps.hash.outputs.darwin_intel_hash }}`
Mac: Apple Silicon: `${{ steps.hash.outputs.darwin_arm_hash }}`
Windows: `${{ steps.hash.outputs.windows_hash }}`
- name: Trigger homebrew-baml update
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.HOMEBREW_BAML_PAT }}
repository: boundaryml/homebrew-baml
event-type: update-formula
client-payload: '{"version": "${{ steps.hash.outputs.version }}", "hash_linux": "${{ steps.hash.outputs.linux_hash }}", "hash_mac_intel": "${{ steps.hash.outputs.darwin_intel_hash }}", "hash_mac_arm": "${{ steps.hash.outputs.darwin_arm_hash }}", "hash_windows": "${{ steps.hash.outputs.windows_hash }}"}'