-
Notifications
You must be signed in to change notification settings - Fork 194
/
Copy pathintegration-tests.ps1
83 lines (57 loc) · 2 KB
/
integration-tests.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#! /usr/bin/env pwsh
#Requires -PSEdition Core
#Requires -Version 7
param()
$ErrorActionPreference = "Stop"
${env:RestoreLockedMode} = "true"
$repoRoot = ${env:GITHUB_WORKSPACE} ?? $PSScriptRoot
$publishPath = Join-Path $repoRoot "publish"
$netCoreTargetPath = Join-Path $repoRoot "integrationtest" "TargetProjects" "NetCore" "NetCoreTestProject.XUnit"
$netfxTargetPath = Join-Path $repoRoot "integrationtest" "TargetProjects" "NetFramework" "FullFrameworkApp.Test"
$testPath = Join-Path $repoRoot "integrationtest" "Validation" "ValidationProject"
$testFilter = "Category=SingleTestProject"
$toolPath = Join-Path $repoRoot ".nuget" "tools"
$toolProject = Join-Path $repoRoot "src" "Stryker.CLI" "Stryker.CLI" "Stryker.CLI.csproj"
$toolVersion = "0.0.0-"
if (${env:GITHUB_ACTIONS} -eq "true") {
$toolVersion += "github-${env:GITHUB_RUN_NUMBER}"
} else {
$toolVersion += "localdev"
}
$stryker = Join-Path $toolPath "dotnet-stryker"
dotnet pack $toolProject "-p:PackageVersion=${toolVersion}" --output $publishPath
if ($LASTEXITCODE -ne 0) {
throw "dotnet pack failed with exit code ${LASTEXITCODE}"
}
dotnet tool install dotnet-stryker --add-source $publishPath --allow-downgrade --tool-path $toolPath --version $toolVersion
if ($LASTEXITCODE -ne 0) {
throw "dotnet tool install failed with exit code ${LASTEXITCODE}"
}
pushd $netCoreTargetPath
try {
& $stryker --dev-mode
} finally {
popd
}
if ($LASTEXITCODE -ne 0) {
throw "dotnet-stryker failed for .NET with exit code ${LASTEXITCODE}"
}
if ($IsWindows) {
pushd $netfxTargetPath
try {
dotnet msbuild -t:restore
if ($LASTEXITCODE -ne 0) {
throw "dotnet msbuild failed to restore NuGet packages with exit code ${LASTEXITCODE}"
}
& $stryker --dev-mode
if ($LASTEXITCODE -ne 0) {
throw "dotnet-stryker failed for .NET Framework with exit code ${LASTEXITCODE}"
}
} finally {
popd
}
}
dotnet test $testPath --filter $testFilter
if ($LASTEXITCODE -ne 0) {
throw "dotnet test failed with exit code ${LASTEXITCODE}"
}