forked from DynamicsValue/fake-xrm-easy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-configuration.ps1
57 lines (47 loc) · 2.18 KB
/
build-configuration.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
param (
[string]$targetFrameworks = "net6.0",
[string]$configuration = "FAKE_XRM_EASY_9"
)
$localPackagesFolder = '../local-packages'
Write-Host "Checking if local packages folder '$($localPackagesFolder)' exists..."
$packagesFolderExists = Test-Path $localPackagesFolder -PathType Container
if(!($packagesFolderExists))
{
New-Item $localPackagesFolder -ItemType Directory
}
Write-Host " -> Cleaning..." -ForegroundColor Yellow
./clean.ps1 -folderPath "./src/FakeXrmEasy/bin"
./clean.ps1 -folderPath "./src/FakeXrmEasy/obj"
./clean.ps1 -folderPath "./tests/FakeXrmEasy.Tests/bin"
./clean.ps1 -folderPath "./tests/FakeXrmEasy.Tests/obj"
Write-Host "Restoring configuration '$($configuration)' and target framework '$($targetFrameworks)'..." -ForegroundColor Yellow
./restore-configuration.ps1 -configuration $configuration -targetFrameworks $targetFrameworks
Write-Host "Building configuration '$($configuration)' and target framework '$($targetFrameworks)'..." -ForegroundColor Yellow
if($targetFrameworks -eq "all")
{
dotnet build --configuration $configuration --no-restore
}
else
{
dotnet build --configuration $configuration --no-restore --framework $targetFrameworks
}
if(!($LASTEXITCODE -eq 0)) {
throw "Error during build step"
}
Write-Host "Testing configuration '$($configuration)' and target framework '$($targetFrameworks)'..." -ForegroundColor Yellow
./test-assemblies -configuration $configuration -targetFramework $targetFrameworks
if(!($LASTEXITCODE -eq 0)) {
throw "Error during test assemblies step"
}
if($targetFrameworks -eq "all")
{
dotnet test --configuration $configuration --no-build --no-restore --verbosity normal --collect:"XPlat code coverage" --settings tests/.runsettings --results-directory ./coverage
}
else
{
dotnet test --configuration $configuration --no-build --no-restore --framework $targetFrameworks --verbosity normal --collect:"XPlat code coverage" --settings tests/.runsettings --results-directory ./coverage
}
if(!($LASTEXITCODE -eq 0)) {
throw "Error during test step"
}
Write-Host "*** Building configuration configuration '$($configuration)' and target framework '$($targetFrameworks)' Succeeded :) **** " -ForegroundColor Green