Merge pull request #2 from torbjorn/mywork #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build MCP Server | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- "main" | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Build the project | |
runs-on: windows-latest | |
steps: | |
- uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2 | |
with: | |
egress-policy: audit | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Remove .npmrc - uses standard registry for internal build check - non-release version | |
run: | | |
if (Test-Path .npmrc) { | |
Remove-Item .npmrc | |
} | |
shell: pwsh | |
- name: Set up Node.js | |
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
with: | |
node-version: 20 | |
- name: Clean install dependencies | |
run: npm ci | |
- name: Build the project | |
run: npm run build | |
- name: Validate tool names and parameters | |
run: npm run validate-tools | |
- name: Run tests | |
run: npm test | |
- name: Display coverage summary | |
run: | | |
Write-Host "=== Code Coverage Summary ===" | |
if (Test-Path "coverage/lcov-report/index.html") { | |
Write-Host "Coverage report generated successfully" | |
if (Test-Path "coverage/coverage-summary.json") { | |
$coverage = Get-Content "coverage/coverage-summary.json" | ConvertFrom-Json | |
$total = $coverage.total | |
Write-Host "Lines: $($total.lines.pct)%" | |
Write-Host "Functions: $($total.functions.pct)%" | |
Write-Host "Branches: $($total.branches.pct)%" | |
Write-Host "Statements: $($total.statements.pct)%" | |
} | |
} | |
shell: pwsh | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./coverage/lcov.info | |
flags: unittests | |
name: azure-devops-mcp-coverage | |
fail_ci_if_error: false | |
- name: Validate server startup via npx | |
shell: pwsh | |
run: | | |
$result = & npx mcp-server-azuredevops 2>&1 | Out-String | |
if ($result -notmatch "Usage: mcp-server-azuredevops <organization>") { | |
Write-Host "Expected usage message not found in output:" | |
Write-Host $result | |
exit 1 | |
} | |
Write-Host "Validation passed." | |
exit 0 | |
static-code-analysis: | |
name: Static code analysis | |
runs-on: windows-latest | |
steps: | |
- uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2 | |
with: | |
egress-policy: audit | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Node.js | |
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
with: | |
node-version: 20 | |
- name: Clean install dependencies | |
run: npm ci | |
- name: Static code analysis | |
run: npm run eslint | |
- name: Check code formatting | |
run: npm run format-check | |
- name: Verify package version is synced | |
run: | | |
git diff --exit-code ./src/version.ts | |
if (!$?) { | |
Write-Host "Version mismatch detected. Please run 'npm run build' to update version.ts and add changes to the commit." | |
exit 1 | |
} | |
git diff --exit-code ./package-lock.json | |
if (!$?) { | |
Write-Host "Please run 'npm install' to update package-lock.json and add changes to the commit." | |
exit 1 | |
} |