Refactor (#37)

* refactor: remove macros

* refactor: additional cleanup

* chore: small cleanup

* refactor: update .coderabbit.yaml configuration

* docs: update CLAUDE.md with new documentation

* docs: table alignment
This commit is contained in:
Sean P. Kane
2026-01-17 21:24:37 -08:00
committed by GitHub
parent 62f6f4dbcf
commit 47e80f1bc7
46 changed files with 356 additions and 7425 deletions
@@ -1,35 +0,0 @@
name: Macro Cut Object for Magnets Release
on:
push:
tags:
- 'macro-cut-object-for-magnets-v*'
workflow_dispatch:
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release:
uses: ./.github/workflows/macro-release-reusable.yaml
with:
tag_prefix: 'macro-cut-object-for-magnets-v'
macro_dir: 'Cut_Object_for_Magnets'
macro_file: 'CutObjectForMagnets.FCMacro'
macro_name: 'Cut Object for Magnets'
archive_name: 'CutObjectForMagnets'
readme_file: 'README-CutObjectForMagnets.md'
wiki_url: 'https://wiki.freecad.org/Macro_Cut_Object_for_Magnets'
description: |
A FreeCAD macro that cuts 3D objects along a plane and automatically adds aligned magnet holes with surface collision detection. Perfect for creating 3D printed parts that snap together with embedded magnets.
**Features:**
- Cut along preset planes (XY, XZ, YZ) or model datum planes
- Automatic hole placement with even distribution
- Surface collision detection prevents holes from breaking through walls
- Configurable hole diameter, depth, and count
- Creates PartDesign::Body objects with parametric Hole features
permissions:
contents: write
@@ -1,35 +0,0 @@
name: Macro Multi Export Release
on:
push:
tags:
- 'macro-multi-export-v*'
workflow_dispatch:
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release:
uses: ./.github/workflows/macro-release-reusable.yaml
with:
tag_prefix: 'macro-multi-export-v'
macro_dir: 'Multi_Export'
macro_file: 'MultiExport.FCMacro'
macro_name: 'Multi Export'
archive_name: 'MultiExport'
readme_file: 'README-MultiExport.md'
wiki_url: 'https://wiki.freecad.org/Macro_Multi_Export'
description: |
A FreeCAD macro that exports selected bodies to multiple file formats simultaneously with a user-friendly dialog.
**Features:**
- Export to STL, STEP, 3MF, OBJ, IGES, BREP, PLY, and AMF formats
- Batch export multiple objects at once
- Configurable mesh quality settings (tolerance and deflection)
- Real-time file preview before export
- Remember last-used export directory
permissions:
contents: write
@@ -1,312 +0,0 @@
name: Macro Release (Reusable)
# Reusable workflow for releasing individual FreeCAD macros
# Called by component-specific workflows with appropriate inputs
on:
workflow_dispatch:
inputs:
tag_prefix:
description: 'Tag prefix to match (e.g., macro-cut-object-for-magnets-v)'
required: true
type: string
macro_dir:
description: 'Macro directory relative to macros/ (e.g., Cut_Object_for_Magnets)'
required: true
type: string
macro_file:
description: 'Main macro filename (e.g., CutObjectForMagnets.FCMacro)'
required: true
type: string
macro_name:
description: 'Human-readable macro name (e.g., Cut Object for Magnets)'
required: true
type: string
archive_name:
description: 'Archive base name (e.g., CutObjectForMagnets)'
required: true
type: string
readme_file:
description: 'README filename (e.g., README-CutObjectForMagnets.md)'
required: true
type: string
wiki_url:
description: 'FreeCAD Wiki URL for this macro'
required: false
type: string
default: ''
description:
description: 'Short description for release notes'
required: true
type: string
workflow_call:
inputs:
tag_prefix:
description: 'Tag prefix to match (e.g., macro-cut-object-for-magnets-v)'
required: true
type: string
macro_dir:
description: 'Macro directory relative to macros/ (e.g., Cut_Object_for_Magnets)'
required: true
type: string
macro_file:
description: 'Main macro filename (e.g., CutObjectForMagnets.FCMacro)'
required: true
type: string
macro_name:
description: 'Human-readable macro name (e.g., Cut Object for Magnets)'
required: true
type: string
archive_name:
description: 'Archive base name (e.g., CutObjectForMagnets)'
required: true
type: string
readme_file:
description: 'README filename (e.g., README-CutObjectForMagnets.md)'
required: true
type: string
wiki_url:
description: 'FreeCAD Wiki URL for this macro'
required: false
type: string
default: ''
description:
description: 'Short description for release notes'
required: true
type: string
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
env:
TAG_PREFIX: ${{ inputs.tag_prefix }}
run: |
TAG="${GITHUB_REF#refs/tags/}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
# Build regex pattern from tag prefix
PATTERN="^${TAG_PREFIX}([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?)\$"
if [[ ! "$TAG" =~ $PATTERN ]]; then
echo "ERROR: Tag '$TAG' does not match expected format (${TAG_PREFIX}X.Y.Z)"
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 macro version in files
env:
VERSION: ${{ steps.version.outputs.version }}
MACRO_DIR: ${{ inputs.macro_dir }}
MACRO_FILE: ${{ inputs.macro_file }}
MACRO_NAME: ${{ inputs.macro_name }}
run: |
MACRO_PATH="macros/${MACRO_DIR}/${MACRO_FILE}"
echo "Verifying version in source files matches tag: $VERSION"
# Check __Version__ in .FCMacro file
if [ -f "$MACRO_PATH" ]; then
MACRO_VERSION=$(grep -o '__Version__ = "[^"]*"' "$MACRO_PATH" | cut -d'"' -f2)
if [ "$MACRO_VERSION" != "$VERSION" ]; then
echo "ERROR: Version mismatch in $MACRO_PATH"
echo " Expected: $VERSION"
echo " Found: $MACRO_VERSION"
echo ""
echo "The version in source files must be updated before tagging."
echo "Run the appropriate bump command first."
exit 1
fi
echo "✓ $MACRO_PATH: $MACRO_VERSION"
else
echo "ERROR: Macro file not found: $MACRO_PATH"
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 }
/<\/macro>/ { in_macro=0; found_name=0 }
in_macro && index($0, name) > 0 { found_name=1 }
in_macro && found_name && /<version>/ {
gsub(/.*<version>/, ""); gsub(/<\/version>.*/, ""); print; exit
}
' package.xml)
if [ "$PKG_VERSION" != "$VERSION" ]; then
echo "ERROR: Version mismatch in package.xml ($MACRO_NAME section)"
echo " Expected: $VERSION"
echo " Found: $PKG_VERSION"
exit 1
fi
echo "✓ package.xml ($MACRO_NAME): $PKG_VERSION"
echo ""
echo "Version verification passed!"
- name: Create macro archive
env:
VERSION: ${{ steps.version.outputs.version }}
MACRO_DIR: ${{ inputs.macro_dir }}
MACRO_FILE: ${{ inputs.macro_file }}
ARCHIVE_NAME: ${{ inputs.archive_name }}
README_FILE: ${{ inputs.readme_file }}
run: |
# Create staging directory
mkdir -p "staging/${ARCHIVE_NAME}-${VERSION}"
# Copy macro files
cp "macros/${MACRO_DIR}/${MACRO_FILE}" "staging/${ARCHIVE_NAME}-${VERSION}/"
# Copy icon if exists
for ext in svg png; do
ICON_FILE="macros/${MACRO_DIR}/${ARCHIVE_NAME}.${ext}"
if [ -f "$ICON_FILE" ]; then
cp "$ICON_FILE" "staging/${ARCHIVE_NAME}-${VERSION}/"
fi
done
# Copy README
if [ -f "macros/${MACRO_DIR}/${README_FILE}" ]; then
cp "macros/${MACRO_DIR}/${README_FILE}" "staging/${ARCHIVE_NAME}-${VERSION}/README.md"
fi
# Copy LICENSE
cp LICENSE "staging/${ARCHIVE_NAME}-${VERSION}/"
# Create tar.gz archive
cd staging
tar -czvf "${ARCHIVE_NAME}-${VERSION}.tar.gz" "${ARCHIVE_NAME}-${VERSION}"
# Create zip archive
zip -r "${ARCHIVE_NAME}-${VERSION}.zip" "${ARCHIVE_NAME}-${VERSION}"
mv "${ARCHIVE_NAME}-${VERSION}.tar.gz" ../
mv "${ARCHIVE_NAME}-${VERSION}.zip" ../
cd ..
echo "Created archives:"
ls -la "${ARCHIVE_NAME}-${VERSION}."*
- name: Extract release notes section
id: changelog
env:
VERSION: ${{ steps.version.outputs.version }}
MACRO_NAME: ${{ inputs.macro_name }}
DESCRIPTION: ${{ inputs.description }}
MACRO_FILE: ${{ inputs.macro_file }}
MACRO_DIR: ${{ inputs.macro_dir }}
README_FILE: ${{ inputs.readme_file }}
WIKI_URL: ${{ inputs.wiki_url }}
run: |
RELEASE_NOTES="macros/${MACRO_DIR}/RELEASE_NOTES.md"
# Extract section for this version from RELEASE_NOTES.md
# Format: ## Version X.Y.Z (date)
CHANGELOG_CONTENT=$(awk -v version="$VERSION" '
BEGIN { found=0 }
/^## Version / {
if (found) exit
if (index($0, version) > 0) { found=1; next }
}
found { print }
' "$RELEASE_NOTES" 2>/dev/null || echo "")
# Build release body
cat > release_body.md << EOF
## ${MACRO_NAME} Macro v${VERSION}
${DESCRIPTION}
### Installation
Copy \`${MACRO_FILE}\` to your FreeCAD macro directory:
- **macOS**: \`~/Library/Application Support/FreeCAD/Macro/\`
- **Linux**: \`~/.local/share/FreeCAD/Macro/\`
- **Windows**: \`%APPDATA%/FreeCAD/Macro/\`
Optionally copy the icon file (\`.svg\` or \`.png\`) to the same location.
### Documentation
- [Full README](https://github.com/spkane/freecad-robust-mcp-and-more/blob/main/macros/${MACRO_DIR}/${README_FILE})
EOF
if [ -n "$WIKI_URL" ]; then
echo "- [FreeCAD Wiki Page](${WIKI_URL})" >> release_body.md
fi
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: "${{ inputs.macro_name }} Macro 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: |
${{ inputs.archive_name }}-${{ steps.version.outputs.version }}.tar.gz
${{ inputs.archive_name }}-${{ steps.version.outputs.version }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate summary
env:
VERSION: ${{ steps.version.outputs.version }}
MACRO_NAME: ${{ inputs.macro_name }}
ARCHIVE_NAME: ${{ inputs.archive_name }}
run: |
{
echo "## ${MACRO_NAME} Macro Release"
echo ""
echo "**Version:** ${VERSION}"
echo ""
echo "### Downloads"
echo ""
echo "- \`${ARCHIVE_NAME}-${VERSION}.tar.gz\`"
echo "- \`${ARCHIVE_NAME}-${VERSION}.zip\`"
} >> "$GITHUB_STEP_SUMMARY"
-422
View File
@@ -1,422 +0,0 @@
name: Integration Tests
on:
push:
branches: [main, master]
paths:
- "src/freecad_mcp/**/*.py"
- "macros/**/*.FCMacro"
- "macros/**/*.py"
- "addon/FreecadRobustMCPBridge/**/*.py"
- "tests/integration/**/*.py"
- ".github/workflows/macro-test.yaml"
- ".github/actions/setup-freecad/**"
pull_request:
branches: [main, master]
paths:
- "src/freecad_mcp/**/*.py"
- "macros/**/*.FCMacro"
- "macros/**/*.py"
- "addon/FreecadRobustMCPBridge/**/*.py"
- "tests/integration/**/*.py"
- ".github/workflows/macro-test.yaml"
- ".github/actions/setup-freecad/**"
workflow_dispatch:
workflow_call:
# Cancel in-progress runs for the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-integration:
name: Integration Tests with FreeCAD
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install mise
uses: jdx/mise-action@v3
- name: Setup FreeCAD
uses: ./.github/actions/setup-freecad
- name: Cache uv dependencies
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "**/uv.lock"
- name: Install dependencies
run: uv sync --all-extras
- name: Validate macro syntax
run: |
echo "Validating macro Python syntax..."
for macro in macros/**/*.FCMacro; do
echo "Checking: $macro"
python3 -m py_compile "$macro" || {
echo "ERROR: Syntax error in $macro"
exit 1
}
done
echo "All macros have valid Python syntax"
- name: Start FreeCAD headless with MCP bridge
run: |
echo "Using FreeCAD: freecadcmd"
# 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/FreecadRobustMCPBridge/freecad_mcp_bridge/blocking_bridge.py > /tmp/freecad_bridge.log 2>&1 &
FREECAD_PID=$!
echo "FREECAD_PID=$FREECAD_PID" >> "$GITHUB_ENV"
# Wait for bridge to be ready (check XML-RPC port)
echo "Waiting for MCP bridge to start..."
for i in {1..60}; do
if curl -s --max-time 2 -X POST \
-H "Content-Type: text/xml" \
-d '<?xml version="1.0"?><methodCall><methodName>system.listMethods</methodName></methodCall>' \
http://localhost:9875 > /dev/null 2>&1; then
echo "MCP bridge is ready (took ${i}s)"
break
fi
if [ "$i" -eq 60 ]; then
echo "ERROR: MCP bridge did not start within 60s"
echo "=== Bridge log ==="
cat /tmp/freecad_bridge.log || true
kill "$FREECAD_PID" 2>/dev/null || true
exit 1
fi
sleep 1
done
# Log the instance ID for debugging (pytest tests verify bridge via conftest.py fixtures)
BRIDGE_INSTANCE_ID=$(grep -o 'FREECAD_MCP_BRIDGE_INSTANCE_ID=[^ ]*' /tmp/freecad_bridge.log | cut -d= -f2 | head -1)
if [ -n "$BRIDGE_INSTANCE_ID" ]; then
echo "Bridge Instance ID: $BRIDGE_INSTANCE_ID"
else
echo "Warning: Could not extract bridge instance ID from log"
cat /tmp/freecad_bridge.log || true
fi
- name: Run CutObjectForMagnets macro tests
env:
FREECAD_MODE: xmlrpc
# Note: Tests use boolean holes (not PartDesign::Hole) for CI compatibility.
# PartDesign::Hole has a CADKernelError bug in some headless AppImage environments.
run: |
uv run pytest tests/integration/test_cut_object_for_magnets.py -v --tb=short
- name: Run MultiExport macro tests
env:
FREECAD_MODE: xmlrpc
# Export functionality should work in headless mode
continue-on-error: true
run: |
uv run pytest tests/integration/test_multi_export.py -v --tb=short
- name: Run headless mode integration tests
env:
FREECAD_MODE: xmlrpc
# Tests for headless FreeCAD operations (primitives, booleans, exports, etc.)
run: |
uv run pytest tests/integration/test_headless_mode.py -v --tb=short
- name: Upload FreeCAD logs on failure
if: failure() || cancelled()
uses: actions/upload-artifact@v6
with:
name: freecad-headless-logs
path: /tmp/freecad_bridge.log
retention-days: 7
if-no-files-found: ignore
- name: Stop FreeCAD
if: always()
run: |
if [ -n "$FREECAD_PID" ]; then
# Kill process group (handles child processes spawned by FreeCAD/AppImage)
kill -- "-$FREECAD_PID" 2>/dev/null || kill "$FREECAD_PID" 2>/dev/null || true
fi
test-gui:
name: GUI Tests with FreeCAD + Xvfb
runs-on: ubuntu-latest
timeout-minutes: 30
# FreeCAD GUI requires a window manager to generate expose/configure events.
# Without a WM, the GUI binary hangs during Qt initialization.
# Solution: Xvfb + openbox window manager + xdotool for synthetic events.
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install mise
uses: jdx/mise-action@v3
# Note: apt cache removed - caching /var/cache/apt/archives causes permission
# issues and is largely negated by the immediate sudo apt-get update
- name: Install Xvfb, openbox, and X11 dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
xvfb \
openbox \
xdotool \
libxkbcommon-x11-0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-xinerama0 \
libxcb-xfixes0 \
libxcb-shape0 \
libxcb-cursor0 \
x11-utils \
libegl1 \
libgl1-mesa-dri \
libgl1 \
mesa-utils \
fontconfig \
fonts-dejavu-core
# Rebuild font cache (required after installing fonts, especially from cache)
sudo fc-cache -f -v
- name: Setup FreeCAD
uses: ./.github/actions/setup-freecad
- name: Start Xvfb and openbox
run: |
echo "Starting Xvfb virtual display..."
# Use -nolisten tcp to prevent TCP listeners for security
Xvfb :99 -screen 0 1920x1080x24 -nolisten tcp &
XVFB_PID=$!
echo "XVFB_PID=$XVFB_PID" >> "$GITHUB_ENV"
echo "DISPLAY=:99" >> "$GITHUB_ENV"
sleep 2
# Verify Xvfb is running
if ! ps -p $XVFB_PID > /dev/null; then
echo "ERROR: Xvfb failed to start"
exit 1
fi
echo "Xvfb started on display :99 (PID: $XVFB_PID)"
# Start openbox window manager (required for FreeCAD GUI)
# FreeCAD needs a WM to generate expose/configure events
echo "Starting openbox window manager..."
DISPLAY=:99 openbox &
OPENBOX_PID=$!
echo "OPENBOX_PID=$OPENBOX_PID" >> "$GITHUB_ENV"
sleep 1
if ! ps -p $OPENBOX_PID > /dev/null; then
echo "WARNING: openbox may have failed to start"
else
echo "openbox started (PID: $OPENBOX_PID)"
fi
- name: Verify X11 display
env:
DISPLAY: ":99"
run: |
echo "Checking X11 display..."
xdpyinfo | head -10 || echo "xdpyinfo not available"
- name: Cache uv dependencies
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "**/uv.lock"
- name: Install dependencies
run: uv sync --all-extras
- name: Verify fontconfig setup
run: |
echo "Checking fontconfig configuration..."
# Verify the system fontconfig config exists
if [ -f /etc/fonts/fonts.conf ]; then
echo "System fontconfig found at /etc/fonts/fonts.conf"
else
echo "ERROR: /etc/fonts/fonts.conf not found!"
ls -la /etc/fonts/ || echo "/etc/fonts/ directory doesn't exist"
fi
# Test fontconfig is working
echo "Testing fc-list..."
fc-list | head -5 || echo "fc-list failed"
echo "Fontconfig setup verified."
- name: Start FreeCAD GUI with MCP bridge
env:
DISPLAY: ":99"
QT_QPA_PLATFORM: xcb
# Use software rendering for OpenGL (more reliable in CI)
LIBGL_ALWAYS_SOFTWARE: "1"
# Explicit fontconfig paths for AppImage compatibility
# The AppImage's bundled fontconfig may not find system config automatically
FONTCONFIG_FILE: /etc/fonts/fonts.conf
FONTCONFIG_PATH: /etc/fonts
# Set XDG_RUNTIME_DIR to avoid Qt warning
XDG_RUNTIME_DIR: /tmp/runtime-root
run: |
# Create XDG_RUNTIME_DIR
mkdir -p "$XDG_RUNTIME_DIR"
chmod 700 "$XDG_RUNTIME_DIR"
echo "Starting FreeCAD GUI with MCP bridge under Xvfb + openbox..."
echo "DISPLAY=$DISPLAY"
echo "QT_QPA_PLATFORM=$QT_QPA_PLATFORM"
echo "LIBGL_ALWAYS_SOFTWARE=$LIBGL_ALWAYS_SOFTWARE"
echo "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR"
# Verify freecadcmd works (headless mode)
echo "=== Testing freecadcmd (headless) ==="
freecadcmd --version || echo "freecadcmd failed"
# Export fontconfig vars so they're available to backgrounded process
export FONTCONFIG_FILE FONTCONFIG_PATH
# Start FreeCAD GUI (not headless) with MCP bridge
# 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/FreecadRobustMCPBridge/freecad_mcp_bridge/blocking_bridge.py > /tmp/freecad_gui.log 2>&1 &
FREECAD_PID=$!
echo "FREECAD_PID=$FREECAD_PID" >> "$GITHUB_ENV"
echo "Waiting for MCP bridge to start..."
# Send xdotool events to help FreeCAD GUI initialize
# FreeCAD needs mouse/keyboard events to process its event queue
for i in {1..90}; do
# Send synthetic events to help FreeCAD initialize
xdotool mousemove $((400 + i*3)) $((300 + i*3)) click 1 key Escape 2>/dev/null || true
# Check if process is still running
if ! ps -p "$FREECAD_PID" > /dev/null 2>&1; then
echo "ERROR: FreeCAD process died (PID $FREECAD_PID)"
echo "=== FreeCAD GUI log ==="
cat /tmp/freecad_gui.log || echo "Log file is empty or missing"
exit 1
fi
if curl -s --max-time 2 -X POST \
-H "Content-Type: text/xml" \
-d '<?xml version="1.0"?><methodCall><methodName>system.listMethods</methodName></methodCall>' \
http://localhost:9875 > /dev/null 2>&1; then
echo "MCP bridge is ready (took ${i}s)"
break
fi
if [ "$i" -eq 90 ]; then
echo "ERROR: MCP bridge did not start within 90s"
echo "=== FreeCAD GUI log ==="
cat /tmp/freecad_gui.log || echo "Log file is empty or missing"
echo "=== Process status ==="
pgrep -a freecad || echo "No freecad processes found"
kill -- "-$FREECAD_PID" 2>/dev/null || kill "$FREECAD_PID" 2>/dev/null || true
exit 1
fi
# Show progress every 10 seconds
if [ $((i % 10)) -eq 0 ]; then
echo "Still waiting... (${i}s)"
# Show last few lines of log
tail -5 /tmp/freecad_gui.log 2>/dev/null || true
fi
sleep 1
done
# Verify GUI is available
sleep 2
BRIDGE_INSTANCE_ID=$(grep -o 'FREECAD_MCP_BRIDGE_INSTANCE_ID=[^ ]*' /tmp/freecad_gui.log | cut -d= -f2 | head -1)
echo "Bridge Instance ID: $BRIDGE_INSTANCE_ID"
# Check if GUI is up
if grep -q "GuiUp.*True\|GUI.*available" /tmp/freecad_gui.log 2>/dev/null; then
echo "FreeCAD GUI is available"
else
echo "Note: Could not confirm GUI status from log (may still work)"
fi
- name: Run GUI mode integration tests
env:
FREECAD_MODE: xmlrpc
DISPLAY: ":99"
# Tests for GUI-only features (screenshots, visibility, colors, camera, etc.)
# GUI tests under Xvfb can be flaky; don't fail the workflow during stabilization
continue-on-error: true
run: |
uv run pytest tests/integration/test_gui_mode.py -v --tb=short
- name: Upload FreeCAD logs on failure
if: failure() || cancelled()
uses: actions/upload-artifact@v6
with:
name: freecad-gui-logs
path: /tmp/freecad_gui.log
retention-days: 7
if-no-files-found: ignore
- name: Stop FreeCAD, openbox, and Xvfb
if: always()
run: |
if [ -n "$FREECAD_PID" ]; then
# Kill process group (handles child processes spawned by FreeCAD/AppImage)
kill -- "-$FREECAD_PID" 2>/dev/null || kill "$FREECAD_PID" 2>/dev/null || true
fi
if [ -n "$OPENBOX_PID" ]; then
kill "$OPENBOX_PID" 2>/dev/null || true
fi
if [ -n "$XVFB_PID" ]; then
kill "$XVFB_PID" 2>/dev/null || true
fi
lint-macros:
name: Lint Macro Files
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install mise
uses: jdx/mise-action@v3
- name: Cache uv dependencies
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "**/uv.lock"
- name: Install dependencies
run: uv sync --all-extras
- name: Lint macro files with Ruff
run: |
# Run ruff on macro files (check only, don't fail on issues specific to FreeCAD macros)
uv run ruff check macros/ --select=E,F,W --ignore=F401,E402 || true
- name: Check macro documentation
run: |
# Ensure each macro directory has a README
for macro_dir in macros/*/; do
if [ -d "$macro_dir" ]; then
readme_found=false
for readme in "$macro_dir"README*.md; do
if [ -f "$readme" ]; then
readme_found=true
break
fi
done
if [ "$readme_found" = false ]; then
echo "WARNING: No README found in $macro_dir"
else
echo "OK: README found in $macro_dir"
fi
fi
done
-6
View File
@@ -53,9 +53,3 @@ jobs:
- name: Run type checking
run: uv run mypy src/
# Note: FreeCAD integration tests are handled by the "Integration Tests" workflow
# (macro-test.yaml) which runs on every PR. That workflow provides:
# - Headless tests: test_headless_mode.py, test_cut_object_for_magnets.py, test_multi_export.py
# - GUI tests: test_gui_mode.py (uses Xvfb virtual display)
# See .github/workflows/macro-test.yaml for details.