Fix: rename workbench and prepare for release (#27)
* chore: rename workbench to FreecadRobustMCPBridge * fix: stdio cleanup and bug fix for JSON RPC * fix: update FreeCAD MCP bridge and tests * test: Fix GUI Integration tests and other issues * fix: unit tests in CI and a few other things * docs: generate GitHub pages site and link to it. * fix: General code improvements and DRY refactoring * chore: General cleanup * chore: small fixes * docs: cleanup * docs: fixes * docs: small corrections * docs: fix * test: release check * bump: workbench v0.6.0 * chore: bump macros to 0.6.0 * docs: Release improvements * refactor: improve DRYness of code
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
# Documentation deployment workflow
|
||||
# Deploys MkDocs documentation to GitHub Pages with versioning via mike
|
||||
#
|
||||
# Deployment strategy:
|
||||
# - Push to main: Deploys as "latest" (always the current main branch docs)
|
||||
# - MCP server release tag: Deploys versioned docs (e.g., "1.0.0") as permanent snapshots
|
||||
#
|
||||
# The "latest" alias always points to the main branch documentation.
|
||||
# Tagged releases get permanent versioned documentation (e.g., "1.0.0", "1.1.0").
|
||||
# Users can switch between versions using the version selector in the docs.
|
||||
|
||||
name: Deploy Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "docs/**"
|
||||
- "mkdocs.yaml"
|
||||
- "src/**"
|
||||
- ".github/workflows/docs.yaml"
|
||||
tags:
|
||||
# Deploy versioned docs when MCP server is released
|
||||
- "robust-mcp-server-v*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Version to deploy (e.g., 1.0.0, dev)"
|
||||
required: false
|
||||
default: "dev"
|
||||
set_latest:
|
||||
description: "Set this version as 'latest' alias"
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: write
|
||||
pages: write
|
||||
|
||||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||
# However, do NOT cancel in-progress runs as we want to allow these deployments to complete.
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Full history needed for git-revision-date plugin
|
||||
|
||||
- name: Configure Git for mike
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "uv.lock"
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync --all-extras --frozen
|
||||
|
||||
- name: Determine version to deploy
|
||||
id: version
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||
# Manual dispatch - use provided version
|
||||
VERSION="${{ github.event.inputs.version }}"
|
||||
SET_LATEST="${{ github.event.inputs.set_latest }}"
|
||||
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
|
||||
# Tag push - extract version from tag
|
||||
# robust-mcp-server-v1.0.0 -> 1.0.0
|
||||
TAG="${{ github.ref_name }}"
|
||||
VERSION="${TAG#robust-mcp-server-v}"
|
||||
# Tagged releases never set latest (main branch is always latest)
|
||||
SET_LATEST="false"
|
||||
else
|
||||
# Push to main - deploy as "latest"
|
||||
VERSION="latest"
|
||||
SET_LATEST="true"
|
||||
fi
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
echo "set_latest=${SET_LATEST}" >> "$GITHUB_OUTPUT"
|
||||
echo "Deploying version: ${VERSION} (set_latest: ${SET_LATEST})"
|
||||
|
||||
- name: Deploy latest documentation (main branch)
|
||||
if: steps.version.outputs.version == 'latest'
|
||||
run: |
|
||||
# Deploy main branch docs as "latest" and set as default
|
||||
# Run deploy without --push, then set-default with --push for single git push
|
||||
uv run mike deploy --update-aliases latest
|
||||
uv run mike set-default --push latest
|
||||
|
||||
- name: Deploy versioned documentation (tagged release)
|
||||
if: steps.version.outputs.version != 'latest'
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
SET_LATEST="${{ steps.version.outputs.set_latest }}"
|
||||
|
||||
if [[ "$SET_LATEST" == "true" ]]; then
|
||||
# Manual dispatch requested setting as latest
|
||||
# Run deploy without --push, then set-default with --push for single git push
|
||||
uv run mike deploy --update-aliases "$VERSION" latest
|
||||
uv run mike set-default --push latest
|
||||
else
|
||||
# Deploy version only (tagged releases don't update latest)
|
||||
uv run mike deploy --push "$VERSION"
|
||||
fi
|
||||
|
||||
- name: List deployed versions
|
||||
run: uv run mike list
|
||||
@@ -143,6 +143,21 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check wiki-source.txt
|
||||
WIKI_FILE="macros/${MACRO_DIR}/wiki-source.txt"
|
||||
if [ -f "$WIKI_FILE" ]; then
|
||||
WIKI_VERSION=$(grep -o '|Version=[^|]*' "$WIKI_FILE" | cut -d= -f2 | tr -d '\n')
|
||||
if [ "$WIKI_VERSION" != "$VERSION" ]; then
|
||||
echo "ERROR: Version mismatch in $WIKI_FILE"
|
||||
echo " Expected: $VERSION"
|
||||
echo " Found: $WIKI_VERSION"
|
||||
echo ""
|
||||
echo "Run the appropriate bump command first."
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ $WIKI_FILE: $WIKI_VERSION"
|
||||
fi
|
||||
|
||||
# Check package.xml
|
||||
PKG_VERSION=$(awk -v name="$MACRO_NAME" '
|
||||
/<macro>/ { in_macro=1 }
|
||||
|
||||
@@ -7,7 +7,7 @@ on:
|
||||
- "src/freecad_mcp/**/*.py"
|
||||
- "macros/**/*.FCMacro"
|
||||
- "macros/**/*.py"
|
||||
- "addon/FreecadRobustMCP/**/*.py"
|
||||
- "addon/FreecadRobustMCPBridge/**/*.py"
|
||||
- "tests/integration/**/*.py"
|
||||
- ".github/workflows/macro-test.yaml"
|
||||
- ".github/actions/setup-freecad/**"
|
||||
@@ -17,7 +17,7 @@ on:
|
||||
- "src/freecad_mcp/**/*.py"
|
||||
- "macros/**/*.FCMacro"
|
||||
- "macros/**/*.py"
|
||||
- "addon/FreecadRobustMCP/**/*.py"
|
||||
- "addon/FreecadRobustMCPBridge/**/*.py"
|
||||
- "tests/integration/**/*.py"
|
||||
- ".github/workflows/macro-test.yaml"
|
||||
- ".github/actions/setup-freecad/**"
|
||||
@@ -73,7 +73,7 @@ jobs:
|
||||
# Start FreeCAD headless with MCP bridge in background
|
||||
# Uses the workbench addon's blocking bridge script
|
||||
# Use setsid to create a new process group for reliable cleanup
|
||||
setsid freecadcmd addon/FreecadRobustMCP/freecad_mcp_bridge/blocking_bridge.py > /tmp/freecad_bridge.log 2>&1 &
|
||||
setsid freecadcmd addon/FreecadRobustMCPBridge/freecad_mcp_bridge/blocking_bridge.py > /tmp/freecad_bridge.log 2>&1 &
|
||||
FREECAD_PID=$!
|
||||
echo "FREECAD_PID=$FREECAD_PID" >> "$GITHUB_ENV"
|
||||
|
||||
@@ -288,7 +288,7 @@ jobs:
|
||||
# Uses blocking_bridge.py which blocks with run_forever() to keep process alive
|
||||
# GUI features are available since we're using 'freecad' not 'freecadcmd'
|
||||
# Use setsid to create a new process group for reliable cleanup
|
||||
setsid freecad addon/FreecadRobustMCP/freecad_mcp_bridge/blocking_bridge.py > /tmp/freecad_gui.log 2>&1 &
|
||||
setsid freecad addon/FreecadRobustMCPBridge/freecad_mcp_bridge/blocking_bridge.py > /tmp/freecad_gui.log 2>&1 &
|
||||
FREECAD_PID=$!
|
||||
echo "FREECAD_PID=$FREECAD_PID" >> "$GITHUB_ENV"
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
echo "Verifying version in source files matches tag: $VERSION"
|
||||
|
||||
# Check __version__ in __init__.py
|
||||
INIT_FILE="addon/FreecadRobustMCP/freecad_mcp_bridge/__init__.py"
|
||||
INIT_FILE="addon/FreecadRobustMCPBridge/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"
|
||||
@@ -68,6 +68,21 @@ jobs:
|
||||
fi
|
||||
echo "✓ $INIT_FILE: $INIT_VERSION"
|
||||
|
||||
# Check wiki-source.txt
|
||||
WIKI_FILE="addon/FreecadRobustMCPBridge/wiki-source.txt"
|
||||
if [ -f "$WIKI_FILE" ]; then
|
||||
WIKI_VERSION=$(grep -o '|Version=[^|]*' "$WIKI_FILE" | cut -d= -f2 | tr -d '\n')
|
||||
if [ "$WIKI_VERSION" != "$VERSION" ]; then
|
||||
echo "ERROR: Version mismatch in $WIKI_FILE"
|
||||
echo " Expected: $VERSION"
|
||||
echo " Found: $WIKI_VERSION"
|
||||
echo ""
|
||||
echo "Run: just release::bump-workbench $VERSION"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ $WIKI_FILE: $WIKI_VERSION"
|
||||
fi
|
||||
|
||||
# Check package.xml
|
||||
PKG_VERSION=$(awk '/<workbench>/,/<\/workbench>/' package.xml | grep -o '<version>[^<]*</version>' | head -1 | sed 's/<[^>]*>//g')
|
||||
if [ "$PKG_VERSION" != "$VERSION" ]; then
|
||||
@@ -89,7 +104,7 @@ jobs:
|
||||
mkdir -p "staging/freecad-mcp-workbench-${VERSION}"
|
||||
|
||||
# Copy workbench files
|
||||
cp -r addon/FreecadRobustMCP/* "staging/freecad-mcp-workbench-${VERSION}/"
|
||||
cp -r addon/FreecadRobustMCPBridge/* "staging/freecad-mcp-workbench-${VERSION}/"
|
||||
|
||||
# Copy LICENSE
|
||||
cp LICENSE "staging/freecad-mcp-workbench-${VERSION}/"
|
||||
@@ -114,9 +129,9 @@ jobs:
|
||||
|
||||
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/\`
|
||||
- **macOS**: \`~/Library/Application Support/FreeCAD/Mod/FreecadRobustMCPBridge/\`
|
||||
- **Linux**: \`~/.local/share/FreeCAD/Mod/FreecadRobustMCPBridge/\`
|
||||
- **Windows**: \`%APPDATA%/FreeCAD/Mod/FreecadRobustMCPBridge/\`
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
Reference in New Issue
Block a user