ci.yml•1.86 kB
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build_lint_test:
name: Build, Lint & Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x, 22.x]
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
cache: "npm" # Cache npm dependencies
- name: Install dependencies
run: npm ci # Use 'ci' for cleaner, faster, and more reliable installs in CI
- name: Check formatting
run: npm run format:check
- name: Build project stdio
run: npm run build:stdio
- name: Build project http
run: npm run build # test smithery build
- name: Run linter
run: npm run lint
- name: Run tests with coverage
run: npm run test -- --coverage # Pass --coverage flag to Jest
env:
# If your tests that instantiate VideoManagement don't mock API calls,
# you'll need a test API key.
# Create a GitHub secret named YOUTUBE_API_KEY_TEST with a dummy or test-specific key.
# If all API calls are mocked, a dummy value is fine.
YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY_TEST || 'dummy_api_key_for_ci' }}
CI: true
- name: Upload coverage to Codecov
if: matrix.node-version == '22.x' && !cancelled()
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: kirbah/mcp-youtube
- name: Upload test results to Codecov
if: matrix.node-version == '22.x' && !cancelled()
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}