Skip to content

feat: UAT runner ergonomics + demote fastmcp tool-failure tracebacks #1331

feat: UAT runner ergonomics + demote fastmcp tool-failure tracebacks

feat: UAT runner ergonomics + demote fastmcp tool-failure tracebacks #1331

Workflow file for this run

name: Build Binary (Test Only)
# NOTE: This workflow is for testing binary builds in PRs only.
# For releases, use the _build-and-release.yml reusable workflow.
on:
pull_request:
branches: [master]
paths:
- 'src/**'
- 'packaging/binary/**'
- 'packaging/mcpb/**'
- '.github/workflows/build-binary.yml'
workflow_dispatch:
inputs:
version:
description: 'Version to build (e.g., 4.7.4)'
required: true
default: '0.0.0-dev'
# Restrict permissions by default (security best practice)
permissions:
contents: read
jobs:
build:
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
artifact_name: ha-mcp-linux
binary_ext: ''
platform: linux
- os: windows-latest
artifact_name: ha-mcp-windows
binary_ext: '.exe'
platform: win32
- os: macos-latest
artifact_name: ha-mcp-macos-arm64
binary_ext: ''
platform: darwin
runs-on: ${{ matrix.os }}
name: Build on ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "latest"
- name: Create virtual environment and install dependencies
run: |
uv venv .venv
uv pip install -e . pyinstaller
shell: bash
- name: Activate venv (Unix)
if: runner.os != 'Windows'
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Activate venv (Windows)
if: runner.os == 'Windows'
run: echo "$PWD/.venv/Scripts" >> $env:GITHUB_PATH
shell: pwsh
- name: Build binary
run: pyinstaller packaging/binary/ha-mcp.spec
- name: Run smoke test (Unix)
if: runner.os != 'Windows'
run: |
chmod +x dist/ha-mcp
# Run the built-in smoke test to verify all libraries are bundled
./dist/ha-mcp --smoke-test
- name: Run smoke test (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
# Run the built-in smoke test to verify all libraries are bundled
& "dist\ha-mcp.exe" --smoke-test
if ($LASTEXITCODE -ne 0) {
Write-Host "Smoke test failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
- name: Rename binary for artifact
shell: bash
run: |
mv dist/ha-mcp${{ matrix.binary_ext }} dist/${{ matrix.artifact_name }}${{ matrix.binary_ext }}
- name: Upload binary artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact_name }}
path: dist/${{ matrix.artifact_name }}${{ matrix.binary_ext }}
if-no-files-found: error
create-mcpb:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Download Windows binary
uses: actions/download-artifact@v8
with:
name: ha-mcp-windows
path: mcpb-bundle
- name: Download macOS binary
uses: actions/download-artifact@v8
with:
name: ha-mcp-macos-arm64
path: mcpb-bundle
- name: Set version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
VERSION="${VERSION:-0.0.0-dev}"
else
# For pull_request, use dev version
VERSION="0.0.0-dev"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Create combined mcpb bundle
run: |
VERSION="${{ steps.version.outputs.version }}"
# Rename binaries to standard names
mv mcpb-bundle/ha-mcp-windows.exe mcpb-bundle/ha-mcp.exe
mv mcpb-bundle/ha-mcp-macos-arm64 mcpb-bundle/ha-mcp
# Copy icons to bundle (light + dark variants + main icon)
cp packaging/mcpb/icon-16.png mcpb-bundle/
cp packaging/mcpb/icon-32.png mcpb-bundle/
cp packaging/mcpb/icon-64.png mcpb-bundle/
cp packaging/mcpb/icon-128.png mcpb-bundle/
cp packaging/mcpb/icon-256.png mcpb-bundle/
cp packaging/mcpb/icon-512.png mcpb-bundle/
cp packaging/mcpb/icon-dark-16.png mcpb-bundle/
cp packaging/mcpb/icon-dark-32.png mcpb-bundle/
cp packaging/mcpb/icon-dark-64.png mcpb-bundle/
cp packaging/mcpb/icon-dark-128.png mcpb-bundle/
cp packaging/mcpb/icon-dark-256.png mcpb-bundle/
cp packaging/mcpb/icon-dark-512.png mcpb-bundle/
cp packaging/mcpb/icon-512.png mcpb-bundle/icon.png
# Generate manifest.json (multi-platform)
python packaging/mcpb/generate_manifest.py "$VERSION"
# Create .mcpb file (zip archive)
cd mcpb-bundle
zip -r ../ha-mcp.mcpb *
cd ..
# List contents for verification
echo "=== MCPB Contents ==="
unzip -l ha-mcp.mcpb
- name: Upload mcpb artifact
uses: actions/upload-artifact@v7
with:
name: ha-mcp-mcpb
path: ha-mcp.mcpb
if-no-files-found: error