forked from dotnet/dotnet-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-and-test.ps1
66 lines (54 loc) · 2.24 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
63
64
65
66
#!/usr/bin/env pwsh
param(
# Version of .NET Core to filter by
[string]$VersionFilter = "*",
# Name of OS to filter by
[string]$OSFilter,
# Type of architecture to filter by
[string]$ArchitectureFilter,
# Additional custom path filters (overrides VersionFilter)
[string]$PathFilters,
# Additional args to pass to ImageBuilder
[string]$OptionalImageBuilderArgs,
# Execution mode of the script
[ValidateSet("BuildAndTest", "Build", "Test")]
[string]$Mode = "BuildAndTest",
# Categories of tests to run
[ValidateSet("runtime", "runtime-deps", "aspnet", "sdk", "sample", "image-size")]
[string[]]$TestCategories = @("runtime", "runtime-deps", "aspnet", "sdk", "sample", "image-size")
)
if ($Mode -eq "BuildAndTest" -or $Mode -eq "Build") {
# Build the product images
& ./eng/common/build.ps1 `
-VersionFilter $VersionFilter `
-OSFilter $OSFilter `
-ArchitectureFilter $ArchitectureFilter `
-PathFilters $PathFilters `
-OptionalImageBuilderArgs $OptionalImageBuilderArgs
$activeOS = docker version -f "{{ .Server.Os }}"
if ($activeOS -eq "windows" -and -not $OSFilter) {
Write-Host "Setting OSFilter to match local Windows host version"
$windowsReleaseId = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ReleaseId
$OSFilter = "nanoserver-$windowsReleaseId"
}
# Build the sample images
& ./eng/common/build.ps1 `
-VersionFilter $VersionFilter `
-OSFilter $OSFilter `
-ArchitectureFilter $ArchitectureFilter `
-PathFilters $PathFilters `
-OptionalImageBuilderArgs $OptionalImageBuilderArgs `
-Manifest manifest.samples.json
}
if ($Mode -eq "BuildAndTest" -or $Mode -eq "Test") {
$localTestCategories = $TestCategories
if ($VersionFilter -ne "*" -and $TestCategories.Contains("sample")) {
$localTestCategories = $TestCategories | where { $_ -ne "sample"}
Write-Warning "Skipping sample image testing since VersionFilter was set"
}
& ./tests/run-tests.ps1 `
-VersionFilter $VersionFilter `
-OSFilter $OSFilter `
-ArchitectureFilter $ArchitectureFilter `
-TestCategories $localTestCategories
}