-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-and-test.ps1
executable file
·62 lines (51 loc) · 1.64 KB
/
build-and-test.ps1
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
#!/usr/bin/pwsh
[CmdletBinding(PositionalBinding = $false)]
param (
[string]$configuration = "Debug",
[string]$versionSuffix = "",
[switch]$noTest
)
Set-StrictMode -version 2.0
$ErrorActionPreference = "Stop"
function Fail([string]$message) {
throw $message
}
function Single([string]$pattern) {
$items = @(Get-Item $pattern)
if ($items.Length -ne 1) {
$itemsList = $items -Join "`n"
Fail "Expected single item, found`n$itemsList`n"
}
return $items[0]
}
try {
# build monaco editor
Push-Location "$PSScriptRoot\src\lisp-monaco-editor"
npm i
npm run compile
Pop-Location
# build dotnet
$solution = Single "$PSScriptRoot/*.sln"
dotnet restore $solution || Fail "Failed to restore solution"
dotnet build $solution --configuration $configuration || Fail "Failed to build solution"
# test
if (-Not $noTest) {
dotnet test --no-restore --no-build --configuration $configuration || Fail "Error running tests."
}
# create package
dotnet pack --no-restore --no-build --configuration $configuration /p:VersionSuffix=$versionSuffix $solution || Fail "Error creating package."
Write-Host "Packages generated at $PSScriptRoot/artifacts/packages/$configuration"
# create wasm package
dotnet publish "$PSScriptRoot/src/IxMilia.Lisp.Wasm/IxMilia.Lisp.Wasm.csproj" --configuration $configuration --output "$PSScriptRoot/artifacts/wasm"
# create vscode extension
Push-Location "$PSScriptRoot\src\lisp-vscode"
npm i
npm run package
Pop-Location
}
catch {
Write-Host $_
Write-Host $_.Exception
Write-Host $_.ScriptStackTrace
exit 1
}