Skip to content

1.0.7

1.0.7 #84

Workflow file for this run

name: PR Checks
on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- '**.md'
- 'docs/**'
- '.devcontainer/**'
- 'examples/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# Check which files have changed to optimize workflow
changes:
runs-on: ubuntu-latest
outputs:
docker: ${{ steps.filter.outputs.docker }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
docker:
- 'Dockerfile'
- '.dockerignore'
- 'package*.json'
- '.github/workflows/pr-check.yml'
quick-check:
name: Quick Check (Build)
runs-on: ubuntu-latest
# Run always, even on draft PRs
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: TypeScript compilation check
run: npm run build
- name: Check version format
run: |
VERSION=$(node -p "require('./package.json').version")
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "❌ Invalid version format: $VERSION"
echo "Version must follow semver: MAJOR.MINOR.PATCH (e.g., 1.0.0)"
exit 1
fi
echo "✅ Version format valid: $VERSION"
dependency-review:
name: Dependency Review
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Dependency Review
uses: actions/dependency-review-action@v4
with:
fail-on-severity: high
docker-build-test:
name: Test Docker Build
needs: [changes, quick-check]
runs-on: ubuntu-latest
# Run only if not draft AND Docker files changed
if: github.event.pull_request.draft == false && needs.changes.outputs.docker == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image (test only)
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true # Load image into Docker daemon
tags: komodo-mcp-server:test
cache-from: type=gha # Read from cache
# Note: cache-to removed - incompatible with load:true
- name: Test Docker image
run: |
docker run --rm komodo-mcp-server:test node --version
echo "✅ Docker image builds and runs successfully"
version-check:
name: Check Version Bump
runs-on: ubuntu-latest
if: github.event.pull_request.base.ref == 'main'
steps:
- name: Checkout PR branch
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Get PR version
id: pr_version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "PR Version: $VERSION"
- name: Checkout main branch
uses: actions/checkout@v6
with:
ref: main
- name: Get main version
id: main_version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Main Version: $VERSION"
- name: Compare versions
run: |
PR_VERSION="${{ steps.pr_version.outputs.version }}"
MAIN_VERSION="${{ steps.main_version.outputs.version }}"
echo "### Version Comparison" >> $GITHUB_STEP_SUMMARY
echo "- Main: \`$MAIN_VERSION\`" >> $GITHUB_STEP_SUMMARY
echo "- PR: \`$PR_VERSION\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "$PR_VERSION" = "$MAIN_VERSION" ]; then
echo "⚠️ **Version not bumped** - No release will be created on merge" >> $GITHUB_STEP_SUMMARY
echo "ℹ️ To trigger a release, update the version in package.json" >> $GITHUB_STEP_SUMMARY
else
echo "✅ **Version bumped** - Release v$PR_VERSION will be created on merge" >> $GITHUB_STEP_SUMMARY
echo "🐳 Docker images will be built with tags:" >> $GITHUB_STEP_SUMMARY
echo "- \`ghcr.io/${{ github.repository }}:$PR_VERSION\`" >> $GITHUB_STEP_SUMMARY
echo "- \`ghcr.io/${{ github.repository }}:latest\`" >> $GITHUB_STEP_SUMMARY
fi
lint-and-format:
name: Lint and Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Check TypeScript errors
run: npx tsc --noEmit
- name: Validate package.json
run: |
node -p "JSON.parse(require('fs').readFileSync('package.json', 'utf8'))" > /dev/null
echo "✅ package.json is valid JSON"
unit-and-fuzz-tests:
name: Unit and Fuzz Tests
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run Unit Tests
run: npm test -- --coverage
- name: Upload Coverage Report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/