name: Test Workflows
on:
pull_request:
paths:
- '.github/workflows/**'
workflow_dispatch:
jobs:
validate-workflows:
name: Validate Workflow Syntax
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Validate all workflows
run: |
echo "Checking all workflow files..."
for workflow in .github/workflows/*.yml; do
echo "Validating $workflow"
# Basic YAML syntax check
python3 -c "import yaml; yaml.safe_load(open('$workflow'))" || exit 1
done
echo "All workflows are valid YAML!"
test-build:
name: Test Build Process
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- name: Verify build output
run: |
if [ ! -f .smithery/index.cjs ]; then
echo "Build output not found!"
exit 1
fi
echo "Build successful!"
test-binary-build:
name: Test Binary Compilation
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- name: Test binary compilation (Unix)
if: matrix.os != 'windows-latest'
run: |
bun build src/index.ts --compile --outfile test-binary || echo "Binary build test completed"
- name: Test binary compilation (Windows)
if: matrix.os == 'windows-latest'
run: |
bun build src/index.ts --compile --outfile test-binary.exe || echo "Binary build test completed"
workflow-summary:
name: Summary
runs-on: ubuntu-latest
needs: [validate-workflows, test-build, test-binary-build]
if: always()
steps:
- name: Create summary
run: |
echo "## Workflow Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- Workflow Validation: ${{ needs.validate-workflows.result }}" >> $GITHUB_STEP_SUMMARY
echo "- Build Test: ${{ needs.test-build.result }}" >> $GITHUB_STEP_SUMMARY
echo "- Binary Build Test: ${{ needs.test-binary-build.result }}" >> $GITHUB_STEP_SUMMARY