Skip to content

feat: update version to 0.1.0; enhance system prompts with autonomous… #2

feat: update version to 0.1.0; enhance system prompts with autonomous…

feat: update version to 0.1.0; enhance system prompts with autonomous… #2

Workflow file for this run

name: Deno Core Tests
on:
push:
branches: [ main, develop, feature/* ]
paths:
- 'packages/core/**'
- '.github/workflows/deno-test.yml'
pull_request:
branches: [ main, develop ]
paths:
- 'packages/core/**'
- '.github/workflows/deno-test.yml'
workflow_dispatch:
inputs:
test_type:
description: 'Type of test to run'
required: true
default: 'all'
type: choice
options:
- all
- unit
- integration
- coverage
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DENO_DIR: ~/.cache/deno
FORCE_COLOR: 1
NO_COLOR: 0
jobs:
test:
name: Test on ${{ matrix.os }} with Deno ${{ matrix.deno-version }}
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
deno-version: ['2.4.x', '2.x']
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Deno ${{ matrix.deno-version }}
uses: denoland/setup-deno@v2
with:
deno-version: ${{ matrix.deno-version }}
- name: Print Deno version
run: |
deno --version
echo "Deno executable path: $(which deno)"
- name: Cache Deno modules
uses: actions/cache@v4
with:
path: ${{ env.DENO_DIR }}
key: deno-${{ runner.os }}-${{ matrix.deno-version }}-${{ hashFiles('packages/core/deno.lock', 'packages/core/deno.json') }}
restore-keys: |
deno-${{ runner.os }}-${{ matrix.deno-version }}-
deno-${{ runner.os }}-
- name: Install dependencies
working-directory: packages/core
run: |
echo "Installing dependencies..."
deno cache --reload=jsr: --reload=npm: mod.ts
deno cache tests/*.ts
- name: Check formatting
working-directory: packages/core
run: deno fmt --check
continue-on-error: ${{ matrix.os == 'windows-latest' }}
- name: Lint code
working-directory: packages/core
run: deno lint
continue-on-error: ${{ matrix.os == 'windows-latest' }}
- name: Type check
working-directory: packages/core
run: |
echo "Type checking main module..."
deno check mod.ts
echo "Type checking server module..."
deno check src/server.ts
echo "Type checking test files..."
deno check tests/*.ts
- name: Run unit tests
if: ${{ github.event.inputs.test_type == 'unit' || github.event.inputs.test_type == 'all' || github.event.inputs.test_type == '' }}
working-directory: packages/core
run: |
echo "Running unit tests..."
deno test --allow-env --allow-read tests/utils_test.ts tests/env_utils_test.ts
- name: Run integration tests
if: ${{ github.event.inputs.test_type == 'integration' || github.event.inputs.test_type == 'all' || github.event.inputs.test_type == '' }}
working-directory: packages/core
run: |
echo "Running integration tests..."
deno test --allow-env --allow-read tests/integration_test.ts tests/workflow_test.ts tests/ai_test.ts
- name: Run all tests
if: ${{ github.event.inputs.test_type == 'all' || github.event.inputs.test_type == '' }}
working-directory: packages/core
run: |
echo "Running all tests with deno task..."
deno task test
- name: Run test runner script
working-directory: packages/core
run: |
echo "Running comprehensive test runner..."
deno run --allow-env --allow-read --allow-run tests/run_tests.ts
coverage:
name: Generate test coverage
runs-on: ubuntu-latest
if: ${{ github.event.inputs.test_type == 'coverage' || github.event.inputs.test_type == 'all' || github.event.inputs.test_type == '' }}
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: 2.x
- name: Cache Deno modules
uses: actions/cache@v4
with:
path: ${{ env.DENO_DIR }}
key: deno-coverage-${{ runner.os }}-${{ hashFiles('packages/core/deno.lock', 'packages/core/deno.json') }}
- name: Run tests with coverage
working-directory: packages/core
run: |
echo "Running tests with coverage collection..."
deno test --allow-env --allow-read --coverage=.coverage tests/
- name: Generate coverage reports
working-directory: packages/core
run: |
echo "Generating HTML coverage report..."
deno coverage .coverage --html
echo "Generating LCOV coverage report..."
deno coverage .coverage --lcov --output=coverage.lcov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
continue-on-error: true
with:
file: packages/core/coverage.lcov
directory: packages/core
flags: mcpc-core
name: mcpc-core-coverage
fail_ci_if_error: false
- name: Upload coverage artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: packages/core/.coverage/
retention-days: 7
performance:
name: Performance tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: 2.x
- name: Run performance tests
working-directory: packages/core
run: |
echo "Checking test execution time..."
time deno task test
echo "Running individual test timing..."
for test_file in tests/*.ts; do
if [[ "$test_file" != "tests/run_tests.ts" ]]; then
echo "Timing $test_file..."
time deno test --allow-env --allow-read "$test_file"
fi
done
security:
name: Security checks
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: 2.x
- name: Check dependencies
working-directory: packages/core
run: |
echo "Checking dependency tree..."
deno info mod.ts
echo "Checking for insecure HTTP imports..."
if grep -r "http://" . --include="*.ts" --include="*.js"; then
echo "⚠️ Found HTTP imports (should use HTTPS)"
exit 1
else
echo "✅ No insecure HTTP imports found"
fi
- name: Validate permissions
working-directory: packages/core
run: |
echo "Validating test permissions..."
# Ensure tests only use minimal required permissions
if deno test --allow-all tests/ 2>&1 | grep -q "error"; then
echo "❌ Tests should not require --allow-all"
exit 1
else
echo "✅ Tests use minimal permissions"
fi
publish-check:
name: Check publishability
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: 2.x
- name: Check if package can be published
working-directory: packages/core
run: |
echo "Checking JSR publishing readiness..."
deno publish --dry-run --allow-dirty || echo "Package would fail to publish to JSR"
echo "Validating deno.json..."
deno task server:compile || echo "Server compilation task failed"
notify-success:
name: Notify success
runs-on: ubuntu-latest
needs: [test, coverage, performance, security, publish-check]
if: success()
steps:
- name: Success notification
run: |
echo "🎉 All MCPC Core tests passed successfully!"
echo "✅ Tests completed on all platforms"
echo "✅ Coverage generated"
echo "✅ Performance tests passed"
echo "✅ Security checks passed"
echo "✅ Package is publishable"
notify-failure:
name: Notify failure
runs-on: ubuntu-latest
needs: [test, coverage, performance, security, publish-check]
if: failure()
steps:
- name: Failure notification
run: |
echo "❌ Some MCPC Core tests failed!"
echo "Please check the logs above for details."
echo "Failed jobs: ${{ toJson(needs) }}"