Skip to content

Commit 00959dc

Browse files
Merge pull request #26 from max-ieremenko/release/4.1.1
Release/4.1.1
2 parents 0c7476f + de381f7 commit 00959dc

561 files changed

Lines changed: 14428 additions & 15359 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Build/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
build.ps1 is designed to run on windows
44

55
- PowerShell Desktop 5.1
6+
- PowerShell [7.3.0](https://github.com/PowerShell/PowerShell/releases/tag/v7.3.0) for .net 7.0 tests
67
- PowerShell [7.2.1](https://github.com/PowerShell/PowerShell/releases/tag/v7.2.1) for .net 6.0 tests
78
- PowerShell [7.1.5](https://github.com/PowerShell/PowerShell/releases/tag/v7.1.5) for .net 5.0 tests
89
- PowerShell [7.0.8](https://github.com/PowerShell/PowerShell/releases/tag/v7.0.8) for .net core 3.1 tests
9-
- Install-Module -Name InvokeBuild -RequiredVersion 5.8.7
10-
- ThirdPartyLibraries https://www.nuget.org/packages/ThirdPartyLibraries.GlobalTool/
10+
- Install-Module -Name [InvokeBuild](https://www.powershellgallery.com/packages/InvokeBuild/5.9.12) -RequiredVersion 5.9.12
11+
- Install-Module -Name [ThirdPartyLibraries](https://www.powershellgallery.com/packages/ThirdPartyLibraries/3.1.2) -RequiredVersion 3.1.2
1112
- .net framework 4.7.2+ sdk
12-
- .net core 3.1 sdk
13-
- .net 5.0 sdk
13+
- .net 7.0 sdk
1414
- docker, switched to linux containers
1515

1616
## How to build
@@ -19,7 +19,7 @@ build.ps1 is designed to run on windows
1919
PS> git clone https://github.com/max-ieremenko/SqlDatabase.git
2020
2121
# build required docker images
22-
PS> .\Build\create-images.ps1
22+
PS> .\Build\create-images.ps1
2323
2424
# run build
2525
PS> .\Build\build.ps1

Build/build-scripts.ps1

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ function Get-AssemblyVersion($assemblyInfoCsPath) {
2525
}
2626

2727
function Get-RepositoryCommitId {
28-
$response = (Invoke-RestMethod -Uri "https://api.github.com/repos/max-ieremenko/SqlDatabase/commits/master")
29-
return $response.sha
28+
git rev-parse HEAD
3029
}
3130

3231
function Start-Mssql {
@@ -157,26 +156,30 @@ function Wait-Connection {
157156
$timeout = 50
158157
)
159158

160-
$connection = New-Object -TypeName $connectionName -ArgumentList $connectionString
161-
try {
162-
for ($i = 0; $i -lt $timeout; $i++) {
163-
try {
164-
$connection.Open()
165-
return
166-
}
167-
catch {
168-
Start-Sleep -Seconds 1
169-
}
159+
function Test-Connection {
160+
$connection = New-Object -TypeName $connectionName -ArgumentList $connectionString
161+
try {
162+
$connection.Open()
170163
}
164+
finally {
165+
$connection.Dispose()
166+
}
167+
}
171168

169+
for ($i = 0; $i -lt $timeout; $i++) {
172170
try {
173-
$connection.Open()
171+
Test-Connection
172+
return
174173
}
175174
catch {
176-
throw "$connectionName $connectionString"
175+
Start-Sleep -Seconds 1
177176
}
178177
}
179-
finally {
180-
$connection.Dispose()
178+
179+
try {
180+
Test-Connection
181+
}
182+
catch {
183+
throw "$connectionName $connectionString"
181184
}
182185
}

Build/build-tasks.it-tool-linux.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ task RunTest {
3232
$test = (Join-Path $settings.integrationTests $database) + ":/test"
3333

3434
exec {
35-
docker run --rm `
35+
docker run -it --rm `
3636
-v $app `
3737
-v $test `
3838
--env connectionString=$connectionString `

Build/build-tasks.ps1

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ task Build {
4141
}
4242

4343
task ThirdPartyNotices {
44-
Invoke-Build -File build-tasks.third-party.ps1 -Task "ThirdParty" -settings $settings
44+
Invoke-Build -File build-tasks.third-party.ps1 -settings $settings
4545
}
4646

4747
task PackGlobalTool {
@@ -103,25 +103,16 @@ task PackManualDownload PackGlobalTool, PackPoweShellModule, {
103103
$thirdParty = Join-Path $settings.bin "ThirdPartyNotices.txt"
104104
$packageVersion = $settings.version
105105

106-
$destination = Join-Path $out "SqlDatabase.$packageVersion-net452.zip"
107-
$source = Join-Path $settings.bin "SqlDatabase\net452\*"
108-
Compress-Archive -Path $source, $lic, $thirdParty -DestinationPath $destination
109-
110106
$destination = Join-Path $out "SqlDatabase.$packageVersion-PowerShell.zip"
111107
$source = Join-Path $settings.artifactsPowerShell "*"
112108
Compress-Archive -Path $source -DestinationPath $destination
113109

114-
$destination = Join-Path $out "SqlDatabase.$packageVersion-netcore31.zip"
115-
$source = Join-Path $settings.bin "SqlDatabase\netcoreapp3.1\publish\*"
116-
Compress-Archive -Path $source, $lic, $thirdParty -DestinationPath $destination
117-
118-
$destination = Join-Path $out "SqlDatabase.$packageVersion-net50.zip"
119-
$source = Join-Path $settings.bin "SqlDatabase\net5.0\publish\*"
120-
Compress-Archive -Path $source, $lic, $thirdParty -DestinationPath $destination
121-
122-
$destination = Join-Path $out "SqlDatabase.$packageVersion-net60.zip"
123-
$source = Join-Path $settings.bin "SqlDatabase\net6.0\publish\*"
124-
Compress-Archive -Path $source, $lic, $thirdParty -DestinationPath $destination
110+
$targets = "net452", "netcoreapp3.1", "net5.0", "net6.0", "net7.0"
111+
foreach ($target in $targets) {
112+
$destination = Join-Path $out "SqlDatabase.$packageVersion-$target.zip"
113+
$source = Join-Path $settings.bin "SqlDatabase\$target\*"
114+
Compress-Archive -Path $source, $lic, $thirdParty -DestinationPath $destination
115+
}
125116
}
126117

127118
task UnitTest {
@@ -130,6 +121,7 @@ task UnitTest {
130121
@{ File = "build-tasks.unit-test.ps1"; Task = "Test"; settings = $settings; targetFramework = "netcoreapp3.1" }
131122
@{ File = "build-tasks.unit-test.ps1"; Task = "Test"; settings = $settings; targetFramework = "net5.0" }
132123
@{ File = "build-tasks.unit-test.ps1"; Task = "Test"; settings = $settings; targetFramework = "net6.0" }
124+
@{ File = "build-tasks.unit-test.ps1"; Task = "Test"; settings = $settings; targetFramework = "net7.0" }
133125
)
134126

135127
Build-Parallel $builds -ShowParameter targetFramework -MaximumBuilds 4
@@ -179,14 +171,14 @@ task PsCoreTest {
179171
# show-powershell-images.ps1
180172
$images = $(
181173
"mcr.microsoft.com/powershell:6.1.0-ubuntu-18.04"
182-
, "mcr.microsoft.com/powershell:6.1.1-alpine-3.8"
183-
, "mcr.microsoft.com/powershell:6.1.2-alpine-3.8"
184-
, "mcr.microsoft.com/powershell:6.1.3-alpine-3.8"
185-
, "mcr.microsoft.com/powershell:6.2.0-alpine-3.8"
186-
, "mcr.microsoft.com/powershell:6.2.1-alpine-3.8"
187-
, "mcr.microsoft.com/powershell:6.2.2-alpine-3.8"
174+
, "mcr.microsoft.com/powershell:6.1.1-ubuntu-18.04"
175+
, "mcr.microsoft.com/powershell:6.1.2-ubuntu-18.04"
176+
, "mcr.microsoft.com/powershell:6.1.3-ubuntu-18.04"
177+
, "mcr.microsoft.com/powershell:6.2.0-ubuntu-18.04"
178+
, "mcr.microsoft.com/powershell:6.2.1-ubuntu-18.04"
179+
, "mcr.microsoft.com/powershell:6.2.2-ubuntu-18.04"
188180
, "mcr.microsoft.com/powershell:6.2.3-ubuntu-18.04"
189-
, "mcr.microsoft.com/powershell:6.2.4-alpine-3.8"
181+
, "mcr.microsoft.com/powershell:6.2.4-ubuntu-18.04"
190182
, "mcr.microsoft.com/powershell:7.0.0-ubuntu-18.04"
191183
, "mcr.microsoft.com/powershell:7.0.1-ubuntu-18.04"
192184
, "mcr.microsoft.com/powershell:7.0.2-ubuntu-18.04"
@@ -198,7 +190,8 @@ task PsCoreTest {
198190
, "mcr.microsoft.com/powershell:7.1.4-ubuntu-20.04"
199191
, "mcr.microsoft.com/powershell:7.2.0-ubuntu-20.04"
200192
, "mcr.microsoft.com/powershell:7.2.1-ubuntu-20.04"
201-
, "mcr.microsoft.com/powershell:7.3.0-preview.1-ubuntu-20.04")
193+
, "mcr.microsoft.com/powershell:7.2.2-ubuntu-20.04"
194+
, "mcr.microsoft.com/powershell:7.3-ubuntu-20.04")
202195

203196
$builds = @()
204197
foreach ($image in $images) {
@@ -220,7 +213,8 @@ task SdkToolTest {
220213
$images = $(
221214
"sqldatabase/dotnet_pwsh:3.1-sdk"
222215
, "sqldatabase/dotnet_pwsh:5.0-sdk"
223-
, "sqldatabase/dotnet_pwsh:6.0-sdk")
216+
, "sqldatabase/dotnet_pwsh:6.0-sdk"
217+
, "sqldatabase/dotnet_pwsh:7.0-sdk")
224218

225219
$builds = @()
226220
foreach ($image in $images) {
@@ -240,9 +234,10 @@ task SdkToolTest {
240234

241235
task NetRuntimeLinuxTest {
242236
$testCases = $(
243-
@{ targetFramework = "netcore31"; image = "sqldatabase/dotnet_pwsh:3.1-runtime" }
244-
, @{ targetFramework = "net50"; image = "sqldatabase/dotnet_pwsh:5.0-runtime" }
245-
, @{ targetFramework = "net60"; image = "sqldatabase/dotnet_pwsh:6.0-runtime" }
237+
@{ targetFramework = "netcoreapp3.1"; image = "sqldatabase/dotnet_pwsh:3.1-runtime" }
238+
, @{ targetFramework = "net5.0"; image = "sqldatabase/dotnet_pwsh:5.0-runtime" }
239+
, @{ targetFramework = "net6.0"; image = "sqldatabase/dotnet_pwsh:6.0-runtime" }
240+
, @{ targetFramework = "net7.0"; image = "sqldatabase/dotnet_pwsh:7.0-runtime" }
246241
)
247242

248243
$builds = @()
@@ -265,9 +260,10 @@ task NetRuntimeLinuxTest {
265260
task NetRuntimeWindowsTest {
266261
$testCases = $(
267262
"net452"
268-
, "netcore31"
269-
, "net50"
270-
, "net60"
263+
, "netcoreapp3.1"
264+
, "net5.0"
265+
, "net6.0"
266+
, "net7.0"
271267
)
272268

273269
$builds = @()

Build/build-tasks.third-party.ps1

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,32 @@ param(
22
$settings
33
)
44

5-
function Write-ThirdPartyNotices($appName, $sources, $repository, $out) {
6-
$source = $sources | ForEach-Object {"-source", $_}
7-
$outTemp = Join-Path $out "Temp"
5+
task Default Update, Test, Publish
86

9-
Exec {
10-
ThirdPartyLibraries update `
11-
-appName $appName `
12-
$source `
13-
-repository $repository
14-
}
7+
Enter-Build {
8+
$repository = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "third-party-libraries"))
159

16-
Exec {
17-
ThirdPartyLibraries validate `
18-
-appName $appName `
19-
$source `
20-
-repository $repository
21-
}
22-
23-
Exec {
24-
ThirdPartyLibraries generate `
25-
-appName $appName `
26-
-repository $repository `
27-
-to $outTemp
28-
}
29-
30-
Move-Item (Join-Path $outTemp "ThirdPartyNotices.txt") $out -Force
31-
Remove-Item -Path $outTemp -Recurse -Force
32-
}
33-
34-
task ThirdParty {
3510
$sourceDir = $settings.sources
36-
$thirdPartyRepository = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "third-party-libraries"))
37-
$binDir = $settings.bin
38-
39-
$sources = @(
40-
(Join-Path $sourceDir "SqlDatabase"),
11+
$sources = (Join-Path $sourceDir "SqlDatabase"),
4112
(Join-Path $sourceDir "SqlDatabase.Test"),
4213
(Join-Path $sourceDir "SqlDatabase.PowerShell"),
4314
(Join-Path $sourceDir "SqlDatabase.PowerShell.Test"),
4415
(Join-Path $sourceDir "SqlDatabase.Test")
45-
)
46-
47-
Write-ThirdPartyNotices "SqlDatabase" $sources $thirdPartyRepository $binDir
16+
}
17+
18+
task Update {
19+
Update-ThirdPartyLibrariesRepository -AppName "SqlDatabase" -Source $sources -Repository $repository
20+
}
21+
22+
task Test {
23+
Test-ThirdPartyLibrariesRepository -AppName "SqlDatabase" -Source $sources -Repository $repository
24+
}
25+
26+
task Publish {
27+
$outTemp = Join-Path $settings.bin "Temp"
28+
$title = "SqlDatabase " + $settings.version
29+
Publish-ThirdPartyNotices -AppName "SqlDatabase" -Repository $repository -Title $title -To $outTemp
30+
31+
Move-Item (Join-Path $outTemp "ThirdPartyNotices.txt") $settings.bin -Force
32+
Remove-Item -Path $outTemp -Recurse -Force
4833
}

Build/build.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
#Requires -Modules @{ModuleName='InvokeBuild'; RequiredVersion='5.8.7'}
1+
#Requires -Version "7.0"
2+
#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.9.12" }
23

34
Set-StrictMode -Version Latest
5+
$ErrorActionPreference = "Stop"
46

57
$file = Join-Path $PSScriptRoot "build-tasks.ps1"
68
Invoke-Build -File $file

Build/create-images-tasks.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ task Default `
55
, BuildDotnetRuntime50 `
66
, BuildDotnetSdk60 `
77
, BuildDotnetRuntime60 `
8+
, BuildDotnetSdk70 `
9+
, BuildDotnetRuntime70 `
810
, BuildMsSqlDatabase `
911
, BuildPgSqlDatabase `
1012
, BuildMySqlDatabase
@@ -92,3 +94,21 @@ task BuildDotnetRuntime60 {
9294
.
9395
}
9496
}
97+
98+
task BuildDotnetSdk70 {
99+
exec {
100+
docker build `
101+
-f image-dotnet-sdk-7.0.dockerfile `
102+
-t sqldatabase/dotnet_pwsh:7.0-sdk `
103+
.
104+
}
105+
}
106+
107+
task BuildDotnetRuntime70 {
108+
exec {
109+
docker build `
110+
-f image-dotnet-runtime-7.0.dockerfile `
111+
-t sqldatabase/dotnet_pwsh:7.0-runtime `
112+
.
113+
}
114+
}

Build/create-images.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#Requires -Modules @{ModuleName='InvokeBuild'; RequiredVersion='5.8.7'}
1+
#Requires -Version "7.0"
2+
#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.9.12" }
23

34
Set-StrictMode -Version Latest
45

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM mcr.microsoft.com/dotnet/runtime:7.0
2+
3+
RUN apt-get update && \
4+
apt-get install -y curl && \
5+
curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.3.0/powershell_7.3.0-1.deb_amd64.deb --output powershell.deb && \
6+
dpkg -i powershell.deb && \
7+
apt-get install -f && \
8+
rm -f powershell.deb
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:7.0
2+
3+
RUN apt-get update && \
4+
curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.3.0/powershell_7.3.0-1.deb_amd64.deb --output powershell.deb && \
5+
dpkg -i powershell.deb && \
6+
apt-get install -f && \
7+
rm -f powershell.deb

0 commit comments

Comments
 (0)