* fix: lots of fixes and name refactoring * feat: Add workbench preferences * fix: MCP bridge status widget and just command fixes * fix(tests): Use the correct mesa-glx package * fix(ci): Add fontconfig to GUI test dependencies FreeCAD GUI was failing to start with: "Fontconfig error: Cannot load default config file: No such file" Added fontconfig and fonts-dejavu-core packages to the GUI test job dependencies to resolve the font configuration issue. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor(addon): Extract path utilities into shared module Create path_utils.py module that consolidates duplicated path-finding logic from commands.py and InitGui.py: - get_addon_path(): Find addon directory with caching and fallbacks - get_icon_path(): Get full path to an icon file - get_icons_dir(): Get path to icons directory - get_workbench_icon(): Get path to workbench main icon This removes ~100 lines of duplicated code while preserving the same behavior including _addon_path_cache and all fallback methods. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(addon): Prevent stale plugin state on startup failure The StartMCPBridgeCommand.Activated method could leave _mcp_plugin in a partially initialized state if FreecadMCPPlugin.start() failed after the plugin was instantiated. Changes: - Create plugin in a local variable first - Only assign to _mcp_plugin after start() succeeds - Explicitly clear _mcp_plugin and _running_config in exception handlers to ensure clean state for subsequent retry attempts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Lot of broad improvements * fix(ci): Use blocking headless_server.py for GUI tests The GUI test was using startup_bridge.py which is non-blocking (designed for interactive use). For CI, even in GUI mode, we need the blocking headless_server.py that calls run_forever() to keep FreeCAD running. GUI features are still available since we use the 'freecad' executable instead of 'freecadcmd'. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor(addon): Rename headless_server.py to blocking_bridge.py The old name was misleading because: - It works with both GUI (freecad) and headless (freecadcmd) modes - The key characteristic is that it BLOCKS with run_forever() New naming convention clarifies the difference: - blocking_bridge.py: Starts bridge and blocks (for CI, servers) - startup_bridge.py: Starts bridge and returns (for interactive GUI) Updated all references across: - GitHub workflow (macro-test.yaml) - Just commands (freecad.just) - Unit tests (test_addon_structure.py) - Documentation (5 files) - CLAUDE.md Also improved the script to detect GUI mode dynamically using FreeCAD.GuiUp and display the appropriate status message. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(just): Remove erroneous rm of startup_bridge.py on error The startup script is now a permanent source file in the repository, not a generated temporary file. The rm -f would have deleted source code if FreeCAD wasn't found. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: General improvements * fix: Lots of general fixes and only stable to PyPi * fix: small cleanup * fix: Small fixes and hopefully fixes the GUI tests * fix: Add proper library paths for FreeCAD GUI in CI - Create wrapper scripts instead of symlinks for AppImage binaries - Set LD_LIBRARY_PATH, QT_PLUGIN_PATH for GUI mode - Add diagnostic output to identify startup failures * fix: Use apprun for GUI tests in CI * fix: Improving Xvfb tests * fix: GUI tests worlk * chore: remove invalid --no-splash comments * fix: ARM64 architecture support and other fixes * fix: cleanup * test: just commands test suite * test: improve just command tests * fix: more general improvements * fix: more cleanup * fix: more updates * fix: small tweaks --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
230 lines
7.9 KiB
YAML
230 lines
7.9 KiB
YAML
name: MCP Workbench Release
|
|
|
|
# Trigger on tag push matching the component-specific pattern
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'robust-mcp-workbench-v*'
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
|
|
# Cancel in-progress runs for the same tag
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
validate-and-release:
|
|
name: Validate Tag and Create Release
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Validate semantic version tag
|
|
id: version
|
|
run: |
|
|
TAG="${GITHUB_REF#refs/tags/}"
|
|
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
|
|
|
# Extract version from tag (robust-mcp-workbench-v1.2.3 -> 1.2.3)
|
|
if [[ ! "$TAG" =~ ^robust-mcp-workbench-v([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?)$ ]]; then
|
|
echo "ERROR: Tag '$TAG' does not match expected format (robust-mcp-workbench-vX.Y.Z or robust-mcp-workbench-vX.Y.Z-prerelease)"
|
|
exit 1
|
|
fi
|
|
|
|
VERSION="${BASH_REMATCH[1]}"
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
# Check if this is a prerelease
|
|
if [[ "$VERSION" =~ -[a-zA-Z0-9.]+ ]]; then
|
|
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
echo "Parsed version: $VERSION"
|
|
|
|
- name: Verify version in source files
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.version }}"
|
|
|
|
echo "Verifying version in source files matches tag: $VERSION"
|
|
|
|
# Check __version__ in __init__.py
|
|
INIT_FILE="addon/FreecadRobustMCP/freecad_mcp_bridge/__init__.py"
|
|
INIT_VERSION=$(grep -o '__version__ = "[^"]*"' "$INIT_FILE" | cut -d'"' -f2)
|
|
if [ "$INIT_VERSION" != "$VERSION" ]; then
|
|
echo "ERROR: Version mismatch in $INIT_FILE"
|
|
echo " Expected: $VERSION"
|
|
echo " Found: $INIT_VERSION"
|
|
echo ""
|
|
echo "The version in source files must be updated before tagging."
|
|
echo "Run: just release::bump-workbench $VERSION"
|
|
exit 1
|
|
fi
|
|
echo "✓ $INIT_FILE: $INIT_VERSION"
|
|
|
|
# Check package.xml
|
|
PKG_VERSION=$(awk '/<workbench>/,/<\/workbench>/' package.xml | grep -o '<version>[^<]*</version>' | head -1 | sed 's/<[^>]*>//g')
|
|
if [ "$PKG_VERSION" != "$VERSION" ]; then
|
|
echo "ERROR: Version mismatch in package.xml (workbench section)"
|
|
echo " Expected: $VERSION"
|
|
echo " Found: $PKG_VERSION"
|
|
exit 1
|
|
fi
|
|
echo "✓ package.xml (workbench): $PKG_VERSION"
|
|
|
|
echo ""
|
|
echo "Version verification passed!"
|
|
|
|
- name: Create workbench archive
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.version }}"
|
|
|
|
# Create staging directory
|
|
mkdir -p "staging/freecad-mcp-workbench-${VERSION}"
|
|
|
|
# Copy workbench files
|
|
cp -r addon/FreecadRobustMCP/* "staging/freecad-mcp-workbench-${VERSION}/"
|
|
|
|
# Copy LICENSE
|
|
cp LICENSE "staging/freecad-mcp-workbench-${VERSION}/"
|
|
|
|
# Create README for the archive
|
|
cat > "staging/freecad-mcp-workbench-${VERSION}/README.md" << EOF
|
|
# Robust MCP Bridge Workbench
|
|
|
|
**Version:** ${VERSION}
|
|
|
|
## Installation
|
|
|
|
### Via FreeCAD Addon Manager (Recommended)
|
|
|
|
1. Open FreeCAD
|
|
2. Go to **Tools → Addon Manager**
|
|
3. Search for "Robust MCP Bridge"
|
|
4. Click **Install**
|
|
5. Restart FreeCAD
|
|
|
|
### Manual Installation
|
|
|
|
Copy the contents of this archive to your FreeCAD Mod directory:
|
|
|
|
- **macOS**: \`~/Library/Application Support/FreeCAD/Mod/FreecadRobustMCP/\`
|
|
- **Linux**: \`~/.local/share/FreeCAD/Mod/FreecadRobustMCP/\`
|
|
- **Windows**: \`%APPDATA%/FreeCAD/Mod/FreecadRobustMCP/\`
|
|
|
|
## Usage
|
|
|
|
1. Switch to the **Robust MCP Bridge** workbench
|
|
2. Click **Start MCP Bridge** in the toolbar
|
|
3. Connect your MCP client (Claude Code, etc.)
|
|
|
|
## Documentation
|
|
|
|
Full documentation: https://github.com/spkane/freecad-robust-mcp-and-more
|
|
|
|
## License
|
|
|
|
MIT License - see LICENSE file
|
|
EOF
|
|
|
|
# Create tar.gz archive
|
|
cd staging
|
|
tar -czvf "freecad-mcp-workbench-${VERSION}.tar.gz" "freecad-mcp-workbench-${VERSION}"
|
|
|
|
# Create zip archive
|
|
zip -r "freecad-mcp-workbench-${VERSION}.zip" "freecad-mcp-workbench-${VERSION}"
|
|
|
|
mv "freecad-mcp-workbench-${VERSION}.tar.gz" ../
|
|
mv "freecad-mcp-workbench-${VERSION}.zip" ../
|
|
cd ..
|
|
|
|
echo "Created archives:"
|
|
ls -la "freecad-mcp-workbench-${VERSION}."*
|
|
|
|
- name: Extract changelog section
|
|
id: changelog
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.version }}"
|
|
# Match header exactly as it appears in CHANGELOG.md (with optional space before v)
|
|
HEADER="### Robust MCP Bridge Workbench v${VERSION}"
|
|
|
|
# Extract section between this version header and the next component header or separator
|
|
# Only exit on: "---" separator OR "### " followed by component name (capital letter)
|
|
# This allows #### Added, #### Changed, etc. to be included
|
|
CHANGELOG_CONTENT=$(awk -v header="$HEADER" '
|
|
BEGIN { found=0 }
|
|
$0 == header || $0 == header " " { found=1; next }
|
|
found && /^---$/ { exit }
|
|
found && /^### [A-Z]/ { exit }
|
|
found { print }
|
|
' CHANGELOG.md)
|
|
|
|
# Build release body with changelog content if available
|
|
cat > release_body.md << 'STATIC_EOF'
|
|
## Robust MCP Bridge Workbench v${{ steps.version.outputs.version }}
|
|
|
|
This release contains the Robust MCP Bridge workbench for FreeCAD.
|
|
|
|
### Installation
|
|
|
|
**Recommended:** Install via FreeCAD's Addon Manager (search for "Robust MCP Bridge").
|
|
|
|
**Manual:** Download and extract to your FreeCAD Mod directory.
|
|
|
|
### What's Included
|
|
|
|
- Robust MCP Bridge workbench for GUI and headless FreeCAD
|
|
- XML-RPC and JSON-RPC server support
|
|
- Toolbar commands for bridge control
|
|
|
|
See the [full documentation](https://github.com/spkane/freecad-robust-mcp-and-more) for usage instructions.
|
|
STATIC_EOF
|
|
|
|
if [ -n "$CHANGELOG_CONTENT" ]; then
|
|
{
|
|
echo ""
|
|
echo "### Changelog"
|
|
echo ""
|
|
echo "$CHANGELOG_CONTENT"
|
|
} >> release_body.md
|
|
fi
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
name: "Robust MCP Bridge Workbench v${{ steps.version.outputs.version }}"
|
|
tag_name: ${{ github.ref_name }}
|
|
prerelease: ${{ steps.version.outputs.is_prerelease == 'true' }}
|
|
generate_release_notes: true
|
|
body_path: release_body.md
|
|
files: |
|
|
freecad-mcp-workbench-${{ steps.version.outputs.version }}.tar.gz
|
|
freecad-mcp-workbench-${{ steps.version.outputs.version }}.zip
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Generate summary
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.version }}"
|
|
|
|
{
|
|
echo "## Robust MCP Bridge Workbench Release"
|
|
echo ""
|
|
echo "**Version:** ${VERSION}"
|
|
echo ""
|
|
echo "### Downloads"
|
|
echo ""
|
|
echo "- \`freecad-mcp-workbench-${VERSION}.tar.gz\`"
|
|
echo "- \`freecad-mcp-workbench-${VERSION}.zip\`"
|
|
echo ""
|
|
echo "### Installation"
|
|
echo ""
|
|
echo "Install via FreeCAD Addon Manager or extract to your Mod directory."
|
|
} >> "$GITHUB_STEP_SUMMARY"
|