Skip to content

fix: enforce OpenAI tool-choice contract #235

fix: enforce OpenAI tool-choice contract

fix: enforce OpenAI tool-choice contract #235

Workflow file for this run

name: Portable
on:
push:
branches: [ main ]
tags:
- '*'
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build-portable:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- distro: "debian"
version: "13"
container:
image: ghcr.io/rocm/fastflowlm/build-environment:${{ matrix.distro }}${{ matrix.version }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Configure git safe directory
run: git config --global --add safe.directory $(pwd)
- name: Get version from git describe
id: get_version
run: |
VERSION=$(git describe --tags --always | sed 's/^v//')
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Get short SHA
id: short_sha
run: echo "sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
- name: Upgrade Rust toolchain
run: |
apt-get update
apt-get install -y uuid-dev nasm patchelf
apt-get install -y --no-install-recommends curl ca-certificates
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sh -s -- -y --profile minimal --default-toolchain stable
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Build FLM portable distribution
run: |
cd src
cmake --preset linux-portable
cmake --build build -j$(nproc)
- name: Create installation package
run: |
cd src/build
DESTDIR=$PWD/install cmake --install .
# Rename binary and wrapper for portable layout
mv install/opt/fastflowlm/flm install/opt/fastflowlm/flm-real
mv install/opt/fastflowlm/flm-wrapper.sh install/opt/fastflowlm/flm
chmod +x install/opt/fastflowlm/flm
# Strip debug symbols to reduce binary size (111MB → 33MB)
# --strip-debug removes debug info while keeping stack trace capability
strip --strip-debug install/opt/fastflowlm/flm-real
- name: Create portable tarball
env:
VERSION: ${{ steps.get_version.outputs.version }}
run: |
cd src/build/install/opt/fastflowlm
tar czf $GITHUB_WORKSPACE/fastflowlm_${VERSION}_linux.tar.gz \
flm \
flm-real \
lib/ \
xclbins/ \
model_list.json \
model_info.json
echo "Created tarball with symlinks preserved"
# The default backend is XRT, so confirm libxrt is bundled.
tar tzf $GITHUB_WORKSPACE/fastflowlm_${VERSION}_linux.tar.gz | grep libxrt
- name: Upload portable build artifact
uses: actions/upload-artifact@v4
with:
name: portable
path: fastflowlm_${{ steps.get_version.outputs.version }}_linux.tar.gz
retention-days: 7
if-no-files-found: error
- name: Collect FFmpeg logs
if: always()
shell: bash
run: |
set -euxo pipefail
OUT="${RUNNER_TEMP}/ffmpeg-logs"
mkdir -p "${OUT}"
find "${GITHUB_WORKSPACE}" -type f \
\( -name "configure.log" -o -name "build.log" -o -name "config.log" \) \
-path "*/ffmpeg-build/*" \
-print \
-exec cp --parents {} "${OUT}" \; || true
- name: Upload FFmpeg logs artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: ffmpeg-logs-${{ github.job }}-run${{ github.run_number }}-attempt${{ github.run_attempt }}
path: ${{ runner.temp }}/ffmpeg-logs
if-no-files-found: warn
retention-days: 14
test-summary:
runs-on: ubuntu-latest
needs: build-portable
if: always()
steps:
- name: Summary
run: |
echo "# Portable Build Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ FLM built successfully with portable distribution" >> $GITHUB_STEP_SUMMARY
echo "✅ FFmpeg statically linked (no external FFmpeg dependencies)" >> $GITHUB_STEP_SUMMARY
echo "✅ XRT and XDNA plugin bundled with distribution" >> $GITHUB_STEP_SUMMARY
echo "✅ FFTW (libfftw3) bundled with distribution" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Build Configuration" >> $GITHUB_STEP_SUMMARY
echo "- **FFmpeg**: Statically linked (built from source)" >> $GITHUB_STEP_SUMMARY
echo "- **XRT**: Dynamically linked, bundled in lib/" >> $GITHUB_STEP_SUMMARY
echo "- **XDNA plugin**: Bundled in lib/" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Usage" >> $GITHUB_STEP_SUMMARY
echo "The binary is portable and includes all necessary libraries in the lib/ directory." >> $GITHUB_STEP_SUMMARY
echo "RPATH is set to \$ORIGIN/../lib for automatic library discovery." >> $GITHUB_STEP_SUMMARY
release:
permissions:
contents: write
runs-on: ubuntu-latest
needs: build-portable
if: github.ref_type == 'tag'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from git describe
id: get_version
run: |
VERSION=$(git describe --tags --always | sed 's/^v//')
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Download all portable artifacts
uses: actions/download-artifact@v4
with:
path: portable
- name: Upload Binaries to Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file_glob: true
file: portable/**/*.gz