name: Test
on:
push:
branches: ['**']
pull_request:
branches: [main]
jobs:
test:
name: Test (Node ${{ matrix.node-version }} on ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18, 19, 20, 21, 22, 23, 24, 25]
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linter
run: npm run lint
- name: Run E2E tests
run: npm test
- name: Build
run: npm run build
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
cache: false
- name: Ensure Go directories exist
shell: bash
run: |
mkdir -p ~/go/bin
mkdir -p ~/go/pkg/mod
- name: Cache mcptools binary
id: cache-mcptools
uses: actions/cache@v4
with:
path: |
~/go/bin
~/go/pkg/mod
key: ${{ runner.os }}-go-mcptools-${{ hashFiles('**/test.yml') }}
restore-keys: |
${{ runner.os }}-go-mcptools-
- name: Install mcptools
if: steps.cache-mcptools.outputs.cache-hit != 'true'
run: go install github.com/f/mcptools/cmd/mcptools@latest
- name: Run package installation tests
run: npm run test:package
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: test
if: always()
steps:
- name: Check test results
run: |
if [ "${{ needs.test.result }}" == "failure" ]; then
echo "Tests failed on one or more configurations"
exit 1
fi
echo "All tests passed across all Node versions and platforms!"