-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathInstall.ps1
More file actions
83 lines (69 loc) · 2.77 KB
/
Install.ps1
File metadata and controls
83 lines (69 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
if (Test-Path -Path "$PSScriptRoot\config.json") {
$config = (Get-Content -Path .\config.json -Raw) | ConvertFrom-Json
$uninstall = $config.uninstall
$compile = $config.compile
} else {
Write-Host "Config file not found, assuming default values."
$uninstall = $true
$compile = $true
}
# Get current directory so we can reset back to it after running the tests
$currentDirectory = Get-Location
# Stop any running testengine.server.mcp processes
Write-Host "Stopping any running testengine.server.mcp processes..."
Get-Process -Name "testengine.server.mcp*" -ErrorAction SilentlyContinue | ForEach-Object {
Write-Host "Stopping process ID $($_.Id)..."
Stop-Process -Id $_.Id -Force
}
if ($uninstall) {
Write-Host "Uninstalling the Test Engine MCP Server..."
# Uninstall the testengine.server.mcp tool if it is already installed
$installedTools = dotnet tool list -g
if ($installedTools -match "testengine.server.mcp") {
Write-Host "Uninstalling testengine.server.mcp..."
dotnet tool uninstall -g testengine.server.mcp
}
}
Set-Location "$currentDirectory\..\..\src\testengine.server.mcp"
if ($compile) {
Write-Host "Compiling the project..."
dotnet build
dotnet pack -c Debug --output ./nupkgs
} else {
Write-Host "Skipping compilation..."
}
Write-Host "Installing the Test Engine MCP Server..."
# Find the greatest version of the .nupkg file in the nupkgs folder
Write-Host "Finding the greatest version of the .nupkg file..."
$nupkgFolder = "$currentDirectory\..\..\src\testengine.server.mcp\nupkgs"
$nupkgFiles = Get-ChildItem -Path $nupkgFolder -Filter "*.nupkg" | Sort-Object -Property Name -Descending
if ($nupkgFiles.Count -eq 0) {
Write-Host "No .nupkg files found in the nupkgs folder."
exit 1
}
$latestNupkg = $nupkgFiles[0]
Write-Host "Installing the Test Engine MCP Server from $($latestNupkg.BaseName)..."
dotnet tool install -g testengine.server.mcp --add-source $nupkgFolder --version $($latestNupkg.BaseName -replace 'testengine.server.mcp.', '')
# Get the absolute path to start.te.yaml using forward slashes
$startTeYamlPath = (Join-Path -Path $currentDirectory -ChildPath "start.te.yaml").Replace("\", "/")
Write-Host "Add the following to you setting.json in Visual Studio Code"
Write-Host "1. Test Setting Configuration"
Write-Host "2. The Organization URL of the environment you want to test"
Write-Host "----------------------------------------"
Write-Host @"
{
"mcp": {
"servers": {
"TestEngine": {
"command": "testengine.server.mcp",
"args": [
"$startTeYamlPath"
]
}
}
}
}
"@
Set-Location $currentDirectory