forked from Ed-Fi-Alliance-OSS/Ed-Fi-ODS-Implementation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.github.ps1
165 lines (123 loc) · 4.83 KB
/
build.github.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# SPDX-License-Identifier: Apache-2.0
# Licensed to the Ed-Fi Alliance under one or more agreements.
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
# See the LICENSE and NOTICES files in the project root for more information.
[CmdLetBinding()]
param(
[ValidateSet('Sandbox', 'SingleTenant', 'MultiTenant')]
[string] $InstallType = 'Sandbox',
[string[]] $OdsTokens = @(),
[string[]] $Tenants = @(),
[ValidateSet('SQLServer', 'PostgreSQL')]
[String] $Engine = 'SQLServer',
[switch] $NoRebuild = $false,
[switch] $NoRestore = $false,
[switch] $NoCodeGen = $false,
[switch] $NoDeploy = $false,
[switch] $RunPester = $false,
[switch] $RunDotnetTest = $false,
[switch] $RunPostman = $false,
[switch] $RunSmokeTest = $false,
[switch] $RunSdkGen = $false,
[switch] $GenerateApiSdkPackage = $false,
[switch] $GenerateTestSdkPackage = $false,
[switch] $UsePlugins = $false,
[switch] $NoPackaging = $false,
[String] $RepositoryRoot,
[String] $SandboxAdminId = 'EdFi.Suite3.Ods.SandboxAdmin',
[String] $PackageVersion = '0.0.0',
[String] $PackageOutput = "$PSScriptRoot/packages",
[String] $SwaggerUIId = 'EdFi.Suite3.Ods.SwaggerUI',
[String] $WebApiId = 'EdFi.Suite3.Ods.WebApi',
[String] $DatabasesId = 'EdFi.Suite3.RestApi.Databases',
[String] $JavaPath = 'java',
[Parameter(Mandatory=$true)]
[ValidateSet('4.0.0', '5.2.0')]
[String] $StandardVersion,
[Parameter(Mandatory=$true)]
[ValidateScript({
if ($_ -match '^(?!0\.0\.0)\d+\.\d+\.\d+?$') {
$true
} else {
throw "Value '{0}' is an invalid version. Supply a valid version in the format 'X.Y.Z' where X, Y, and Z are non-zero digits."
}
})]
[String] $ExtensionVersion,
[string] $MssqlSaPassword,
[string] $LocalDbBackupDirectory,
[string] $DbServerBackupDirectory
)
$ErrorActionPreference = 'Stop'
& "$PSScriptRoot/Initialize-PowershellForDevelopment.ps1"
# Build and Test
$params = @{
InstallType = $InstallType
OdsTokens = @()
Tenants = $Tenants
Engine = $Engine
NoCodeGen = $NoCodeGen
NoRebuild = $NoRebuild
NoRestore = $NoRestore
NoDeploy = $NoDeploy
RunPester = $RunPester
RunDotnetTest = $RunDotnetTest
RunPostman = $RunPostman
RunSmokeTest = $RunSmokeTest
UsePlugins = $UsePlugins
RunSdkGen = $RunSdkGen
GenerateApiSdkPackage = $GenerateApiSdkPackage
GenerateTestSdkPackage = $GenerateTestSdkPackage
PackageVersion = $PackageVersion
RepositoryRoot = $RepositoryRoot
StandardVersion = $StandardVersion
ExtensionVersion = $ExtensionVersion
JavaPath = $JavaPath
MssqlSaPassword = $MssqlSaPassword
LocalDbBackupDirectory = $LocalDbBackupDirectory
DbServerBackupDirectory = $DbServerBackupDirectory
}
Write-FlatHashtable $params
$result = Initialize-DevelopmentEnvironment @params
if (-not $NoPackaging) {
if($null -ne $StandardVersion)
{
$WebApiId += ".Standard." + $StandardVersion
$DatabasesId +=".Standard." + $StandardVersion
}
# Package
$parameters = @{
ProjectPath = (Get-RepositoryResolvedPath (Get-ProjectTypes).SandboxAdmin)
PackageId = $SandboxAdminId
Version = $params.PackageVersion
Properties = (Get-DefaultNuGetProperties)
OutputDirectory = $PackageOutput
}
$result += New-WebPackage @parameters
$parameters = @{
ProjectPath = (Get-RepositoryResolvedPath (Get-ProjectTypes).SwaggerUI)
PackageId = $SwaggerUIId
Version = $params.PackageVersion
Properties = (Get-DefaultNuGetProperties)
OutputDirectory = $PackageOutput
}
$result += New-WebPackage @parameters
$parameters = @{
ProjectPath = (Get-RepositoryResolvedPath (Get-ProjectTypes).WebApi)
PackageId = $WebApiId
Version = $params.PackageVersion
Properties = (Get-DefaultNuGetProperties)
OutputDirectory = $PackageOutput
StandardVersion = $StandardVersion
}
$result += New-WebPackage @parameters
$parameters = @{
ProjectPath = (Get-RepositoryResolvedPath (Get-ProjectTypes).Databases)
PackageId = $DatabasesId
Version = $params.PackageVersion
Properties = (Get-DefaultNuGetProperties)
OutputDirectory = $PackageOutput
StandardVersion = $StandardVersion
}
$result += New-DatabasesPackage @parameters
$result | Format-Table
}