Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release 4.3.0 #68

Merged
merged 32 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8bd0220
update version to 4.3.0
max-ieremenko Oct 31, 2024
1778157
clean-up .ps1
max-ieremenko Nov 2, 2024
ceac8d0
Merge pull request #56 from max-ieremenko/build/cleanup-pwsh
max-ieremenko Nov 2, 2024
edb356d
add stylecop.json
max-ieremenko Nov 2, 2024
592cbaf
Merge pull request #57 from max-ieremenko/feature/stylecop.json
max-ieremenko Nov 2, 2024
c56dde1
remove .NET 7 target
max-ieremenko Nov 3, 2024
f8afeb2
build remove .NET 7 target
max-ieremenko Nov 3, 2024
2cbc762
update third party notices
max-ieremenko Nov 3, 2024
012550f
Merge pull request #58 from max-ieremenko/remove/net7
max-ieremenko Nov 3, 2024
4872fce
min pwsh version 7.2+
max-ieremenko Nov 3, 2024
c43ce08
Merge pull request #59 from max-ieremenko/pwsh/7.2-plus
max-ieremenko Nov 3, 2024
715e117
update InvokeBuild to 5.11.3
max-ieremenko Nov 3, 2024
a06cc16
Merge pull request #60 from max-ieremenko/update/invoke-build
max-ieremenko Nov 3, 2024
dbd437c
update ThirdPartyLibraries to 3.6.0
max-ieremenko Nov 3, 2024
19a31e8
Merge pull request #61 from max-ieremenko/update/third-party-libraries
max-ieremenko Nov 3, 2024
73df2cf
target framework net9.0
max-ieremenko Nov 3, 2024
3e89363
build net9.0
max-ieremenko Nov 3, 2024
36f7160
update third party notices
max-ieremenko Nov 3, 2024
901c31d
Merge pull request #62 from max-ieremenko/feature/net9
max-ieremenko Nov 3, 2024
80b4ee1
.sln update dependencies
max-ieremenko Nov 3, 2024
d08d6cc
update third party notices
max-ieremenko Nov 3, 2024
412c777
Merge pull request #63 from max-ieremenko/update/dependencies
max-ieremenko Nov 3, 2024
4fb97fb
load internal dependencies into private context
max-ieremenko Nov 4, 2024
d24ba6e
Merge pull request #64 from max-ieremenko/powershell/dependency-loader
max-ieremenko Nov 4, 2024
40f92bc
update to latest mssql/server image
max-ieremenko Nov 4, 2024
f2f3b76
Merge pull request #65 from max-ieremenko/example/sql-server
max-ieremenko Nov 4, 2024
a58bee3
update Npgsql
max-ieremenko Nov 4, 2024
8b31168
update third party notices Npgsql
max-ieremenko Nov 4, 2024
f7df214
Merge pull request #66 from max-ieremenko/update/Npgsql
max-ieremenko Nov 4, 2024
0eb214d
update MySqlConnector
max-ieremenko Nov 9, 2024
ad7a539
update third party notices MySqlConnector
max-ieremenko Nov 9, 2024
68ff879
Merge pull request #67 from max-ieremenko/update/MySqlConnector
max-ieremenko Nov 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 5 additions & 4 deletions Build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
build.ps1 is designed to run on windows

- PowerShell Desktop 5.1
- PowerShell [7.3.0](https://github.com/PowerShell/PowerShell/releases/tag/v7.3.0) for .net 7.0 and 8.0 tests
- PowerShell [7.5.0](https://github.com/PowerShell/PowerShell/releases/tag/v7.5.0-preview.4) for .net 9.0 tests
- PowerShell [7.3.0](https://github.com/PowerShell/PowerShell/releases/tag/v7.3.0) for .net 8.0 tests
- PowerShell [7.2.1](https://github.com/PowerShell/PowerShell/releases/tag/v7.2.1) for .net 6.0 tests
- Install-Module -Name [InvokeBuild](https://www.powershellgallery.com/packages/InvokeBuild/5.11.1) -RequiredVersion 5.11.1
- Install-Module -Name [ThirdPartyLibraries](https://www.powershellgallery.com/packages/ThirdPartyLibraries/3.5.1) -RequiredVersion 3.5.1
- Install-Module -Name [InvokeBuild](https://www.powershellgallery.com/packages/InvokeBuild)
- Install-Module -Name [ThirdPartyLibraries](https://www.powershellgallery.com/packages/ThirdPartyLibraries)
- .net framework 4.7.2+ sdk
- .net 8.0 sdk
- .net 9.0 sdk
- docker, switched to linux containers

## How to build
Expand Down
12 changes: 6 additions & 6 deletions Build/build.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Requires -Version "7.0"
#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.11.1" }
#Requires -Modules @{ ModuleName="ThirdPartyLibraries"; ModuleVersion="3.5.1" }
#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.11.3" }
#Requires -Modules @{ ModuleName="ThirdPartyLibraries"; ModuleVersion="3.6.0" }

[CmdletBinding()]
param (
[Parameter()]
[ValidateSet("local", "github")]
[ValidateSet('local', 'github')]
[string]
$Mode,

Expand All @@ -15,9 +15,9 @@ param (
)

Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$ErrorActionPreference = 'Stop'

$file = Join-Path $PSScriptRoot "tasks/build-tasks.ps1"
$task = ($Mode -eq "github") ? "GithubBuild" : "LocalBuild"
$file = Join-Path $PSScriptRoot 'tasks/build-tasks.ps1'
$task = ($Mode -eq 'github') ? 'GithubBuild' : 'LocalBuild'

Invoke-Build -File $file -Task $task -GithubToken $GithubToken
4 changes: 2 additions & 2 deletions Build/create-images.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Requires -Version "7.0"
#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.11.0" }
#Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.11.3" }

Set-StrictMode -Version Latest

$file = Join-Path $PSScriptRoot "tasks/create-images-tasks.ps1"
$file = Join-Path $PSScriptRoot 'tasks/create-images-tasks.ps1'
Invoke-Build -File $file
33 changes: 17 additions & 16 deletions Build/install-dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,33 @@
[CmdletBinding()]
param (
[Parameter()]
[ValidateSet(".net", "InvokeBuild", "ThirdPartyLibraries")]
[ValidateSet('.net', 'InvokeBuild', 'ThirdPartyLibraries')]
[string[]]
$List = (".net", "InvokeBuild", "ThirdPartyLibraries")
$List = ('.net', 'InvokeBuild', 'ThirdPartyLibraries')
)

Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$ErrorActionPreference = 'Stop'

. (Join-Path $PSScriptRoot "scripts/Get-ModuleVersion.ps1")
. (Join-Path $PSScriptRoot "scripts/Invoke-InstallDotNet.ps1")
. (Join-Path $PSScriptRoot "scripts/Invoke-InstallModule.ps1")
. (Join-Path $PSScriptRoot 'scripts/Get-ModuleVersion.ps1')
. (Join-Path $PSScriptRoot 'scripts/Invoke-InstallDotNet.ps1')
. (Join-Path $PSScriptRoot 'scripts/Invoke-InstallModule.ps1')

if (".net" -in $List) {
Invoke-InstallDotNet -Version "6.0.419"
Invoke-InstallDotNet -Version "7.0.406"
if ('.net' -in $List) {
Invoke-InstallDotNet -Version '6.0.422'
Invoke-InstallDotNet -Version '8.0.403'
Invoke-InstallDotNet -Version '9.0.100-rc.2.24474.11'

$version = (Get-Content -Raw (Join-Path $PSScriptRoot "../Sources/global.json") | ConvertFrom-Json).sdk.version
$version = (Get-Content -Raw (Join-Path $PSScriptRoot '../Sources/global.json') | ConvertFrom-Json).sdk.version
Invoke-InstallDotNet -Version $version
}

if ("InvokeBuild" -in $List) {
$version = Get-ModuleVersion "InvokeBuild"
Invoke-InstallModule -Name "InvokeBuild" -Version $version
if ('InvokeBuild' -in $List) {
$version = Get-ModuleVersion 'InvokeBuild'
Invoke-InstallModule -Name 'InvokeBuild' -Version $version
}

if ("ThirdPartyLibraries" -in $List) {
$version = Get-ModuleVersion "ThirdPartyLibraries"
Invoke-InstallModule -Name "ThirdPartyLibraries" -Version $version
if ('ThirdPartyLibraries' -in $List) {
$version = Get-ModuleVersion 'ThirdPartyLibraries'
Invoke-InstallModule -Name 'ThirdPartyLibraries' -Version $version
}
2 changes: 1 addition & 1 deletion Build/scripts/Get-ModuleVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Get-ModuleVersion {
$Name
)

$sources = Get-Content (Join-Path $PSScriptRoot "../build.ps1") -Raw
$sources = Get-Content (Join-Path $PSScriptRoot '../build.ps1') -Raw
$tokens = $null
$errors = $null
$modules = [Management.Automation.Language.Parser]::ParseInput($sources, [ref]$tokens, [ref]$errors).ScriptRequirements.RequiredModules
Expand Down
12 changes: 6 additions & 6 deletions Build/scripts/Invoke-InstallDotNet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Invoke-InstallDotNet {
$versions = dotnet --list-sdks
foreach ($installedVersion in $versions) {
# 6.0.401 [C:\Program Files\dotnet\sdk]
$test = ($installedVersion -split " ")[0]
$test = ($installedVersion -split ' ')[0]

if (Test-Version -Target $Version -Test $test) {
Write-Output ".net sdk $test is alredy installed"
Expand All @@ -41,15 +41,15 @@ function Invoke-InstallDotNet {
}
}

$installDir = "C:\Program Files\dotnet"
$installScript = "dotnet-install.ps1"
$installDir = 'C:\Program Files\dotnet'
$installScript = 'dotnet-install.ps1'

if ($IsLinux) {
$installDir = "/usr/share/dotnet"
$installScript = "dotnet-install.sh"
$installDir = '/usr/share/dotnet'
$installScript = 'dotnet-install.sh'
}

$downloadDir = Join-Path ([System.IO.Path]::GetTempPath()) "install-dotnet"
$downloadDir = Join-Path ([System.IO.Path]::GetTempPath()) 'install-dotnet'
if (Test-Path $downloadDir) {
Remove-Item -Path $downloadDir -Recurse -Force
}
Expand Down
2 changes: 1 addition & 1 deletion Build/scripts/Invoke-InstallModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Invoke-InstallModule {
$Version
)

$test = Get-InstalledModule -Name $Name -MinimumVersion $Version -ErrorAction "SilentlyContinue"
$test = Get-InstalledModule -Name $Name -MinimumVersion $Version -ErrorAction 'SilentlyContinue'
if ($test) {
Write-Output "$Name $($test.Version) is alredy installed"
return
Expand Down
4 changes: 2 additions & 2 deletions Build/scripts/Start-Container.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ function Start-Container {

$ip = exec {
docker inspect `
--format "{{.NetworkSettings.Networks.bridge.IPAddress}}" `
--format '{{.NetworkSettings.Networks.bridge.IPAddress}}' `
$containerId
}

$hostPort = exec {
docker inspect `
--format "{{(index (index .NetworkSettings.Ports \""$ContainerPort/tcp\"") 0).HostPort}}" `
--format "{{(index (index .NetworkSettings.Ports ""$ContainerPort/tcp"") 0).HostPort}}" `
$containerId
}

Expand Down
12 changes: 6 additions & 6 deletions Build/scripts/Start-Mssql.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ function Start-Mssql {
$port = $container.port

$builder = New-Object -TypeName System.Data.SqlClient.SqlConnectionStringBuilder
$builder["Initial Catalog"] = "SqlDatabaseTest"
$builder["User Id"] = "sa"
$builder["Password"] = "P@ssw0rd"
$builder["Connect Timeout"] = 5
$builder['Initial Catalog'] = 'SqlDatabaseTest'
$builder['User Id'] = 'sa'
$builder['Password'] = 'P@ssw0rd'
$builder['Connect Timeout'] = 5

$builder["Data Source"] = ".,$port"
$builder['Data Source'] = ".,$port"
$connectionString = $builder.ToString()

$builder["Data Source"] = $container.ip
$builder['Data Source'] = $container.ip
$remoteConnectionString = $builder.ToString()

return @{
Expand Down
12 changes: 6 additions & 6 deletions Build/scripts/Start-Mysql.ps1
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
function Start-Mysql {
param ()

$sqlConnectordll = Join-Path $env:USERPROFILE "\.nuget\packages\mysqlconnector\1.3.10\lib\netstandard2.0\MySqlConnector.dll"
$sqlConnectordll = Join-Path $env:USERPROFILE '\.nuget\packages\mysqlconnector\1.3.10\lib\netstandard2.0\MySqlConnector.dll'
Add-Type -Path $sqlConnectordll

$container = Start-Container -Image sqldatabase/mysql:8.0.25 -ContainerPort 3306

$builder = New-Object -TypeName MySqlConnector.MySqlConnectionStringBuilder
$builder["Database"] = "sqldatabasetest"
$builder["User ID"] = "root"
$builder["Password"] = "qwerty"
$builder["ConnectionTimeout"] = 5
$builder['Database'] = 'sqldatabasetest'
$builder['User ID'] = 'root'
$builder['Password'] = 'qwerty'
$builder['ConnectionTimeout'] = 5

$builder.Server = "localhost"
$builder.Server = 'localhost'
$builder.Port = $container.port.ToString()
$connectionString = $builder.ToString()

Expand Down
12 changes: 6 additions & 6 deletions Build/scripts/Start-Pgsql.ps1
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
function Start-Pgsql {
param ()

$npgsqldll = Join-Path $env:USERPROFILE ".nuget\packages\npgsql\4.0.16\lib\netstandard2.0\Npgsql.dll"
$npgsqldll = Join-Path $env:USERPROFILE '.nuget\packages\npgsql\4.0.16\lib\netstandard2.0\Npgsql.dll'
Add-Type -Path $npgsqldll

$container = Start-Container -Image sqldatabase/postgres:13.3 -ContainerPort 5432

$builder = New-Object -TypeName Npgsql.NpgsqlConnectionStringBuilder
$builder["Database"] = "sqldatabasetest"
$builder["Username"] = "adminuser"
$builder["Password"] = "qwerty"
$builder["Timeout"] = 5
$builder['Database'] = 'sqldatabasetest'
$builder['Username'] = 'adminuser'
$builder['Password'] = 'qwerty'
$builder['Timeout'] = 5

$builder.Host = "localhost"
$builder.Host = 'localhost'
$builder.Port = $container.port.ToString()
$connectionString = $builder.ToString()

Expand Down
1 change: 1 addition & 0 deletions Build/show-powershell-images.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ function Get-ShortVersion {
(Invoke-RestMethod -Uri 'https://mcr.microsoft.com/v2/powershell/tags/list').tags `
| Where-Object { ($_ -Like '[0-9]*') -or ($_ -Like 'preview-[0-9]*') } `
| Get-ShortVersion `
| Where-Object { ($_ -ge '7.2') } `
| Sort-Object -Unique
14 changes: 7 additions & 7 deletions Build/tasks/build-tasks.it-linux.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ param(
, $image
)

task Default StartDatabase, UnZip, RunTest
task . StartDatabase, UnZip, RunTest

Get-ChildItem -Path (Join-Path $PSScriptRoot '../scripts') -Filter *.ps1 | ForEach-Object { . $_.FullName }

$containerId = ""
$connectionString = ""
$remoteConnectionString = ""
$containerId = ''
$connectionString = ''
$remoteConnectionString = ''
$tempDir = Join-Path $settings.bin ([Guid]::NewGuid().ToString())

Enter-Build {
Expand All @@ -38,16 +38,16 @@ task StartDatabase {
task RunTest {
& "Wait-$database" $connectionString

$app = $tempDir + ":/app"
$test = (Join-Path $settings.integrationTests $database) + ":/test"
$app = $tempDir + ':/app'
$test = (Join-Path $settings.integrationTests $database) + ':/test'

exec {
docker run --rm `
-v $app `
-v $test `
--env connectionString=$remoteConnectionString `
--env test=/test `
-w "/app" `
-w '/app' `
$image `
bash /test/Test.sh
}
Expand Down
10 changes: 5 additions & 5 deletions Build/tasks/build-tasks.it-ps-core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ param(
, $image
)

task Default StartDatabase, RunTest
task . StartDatabase, RunTest

Get-ChildItem -Path (Join-Path $PSScriptRoot '../scripts') -Filter *.ps1 | ForEach-Object { . $_.FullName }

$containerId = ""
$connectionString = ""
$containerId = ''
$connectionString = ''

Enter-Build {
Write-Output "$database on $image"
Expand All @@ -26,8 +26,8 @@ task StartDatabase {
}

task RunTest {
$app = $settings.artifactsPowerShell + ":/root/.local/share/powershell/Modules/SqlDatabase"
$test = (Join-Path $settings.integrationTests $database) + ":/test"
$app = $settings.artifactsPowerShell + ':/root/.local/share/powershell/Modules/SqlDatabase'
$test = (Join-Path $settings.integrationTests $database) + ':/test'

exec {
docker run --rm `
Expand Down
10 changes: 5 additions & 5 deletions Build/tasks/build-tasks.it-ps-desktop.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ param(
, $database
)

task Default RunContainers, CopyModule, PublishModule, RunTest
task . RunContainers, CopyModule, PublishModule, RunTest

Get-ChildItem -Path (Join-Path $PSScriptRoot '../scripts') -Filter *.ps1 | ForEach-Object { . $_.FullName }

$containerId = ""
$connectionString = ""
$testDir = Join-Path ([Environment]::GetFolderPath("MyDocuments")) "WindowsPowerShell\modules\SqlDatabase"
$containerId = ''
$connectionString = ''
$testDir = Join-Path ([Environment]::GetFolderPath('MyDocuments')) 'WindowsPowerShell\modules\SqlDatabase'

task CopyModule {
if (Test-Path $testDir) {
Expand All @@ -20,7 +20,7 @@ task CopyModule {
}

task PublishModule {
$log = Join-Path $settings.artifacts "Publish-Module.whatif.log"
$log = Join-Path $settings.artifacts 'Publish-Module.whatif.log'
$command = "Publish-Module -Name SqlDatabase -WhatIf -Verbose -NuGetApiKey 123 *> $log"

exec { powershell -NoLogo -Command "$command" }
Expand Down
8 changes: 4 additions & 4 deletions Build/tasks/build-tasks.it-tool-linux.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ param(
, $image
)

task Default StartDatabase, RunTest
task . StartDatabase, RunTest

Get-ChildItem -Path (Join-Path $PSScriptRoot '../scripts') -Filter *.ps1 | ForEach-Object { . $_.FullName }

$containerId = ""
$connectionString = ""
$containerId = ''
$connectionString = ''

Enter-Build {
Write-Output "$database on $image"
Expand All @@ -29,7 +29,7 @@ task RunTest {
$packageVersion = $settings.version
$packageName = "SqlDatabase.GlobalTool.$packageVersion.nupkg"
$app = (Join-Path $settings.artifacts $packageName) + ":/app/$packageName"
$test = (Join-Path $settings.integrationTests $database) + ":/test"
$test = (Join-Path $settings.integrationTests $database) + ':/test'

exec {
docker run -it --rm `
Expand Down
10 changes: 5 additions & 5 deletions Build/tasks/build-tasks.it-win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ param(
, $database
)

task Default StartDatabase, UnZip, RunTest
task . StartDatabase, UnZip, RunTest

Get-ChildItem -Path (Join-Path $PSScriptRoot '../scripts') -Filter *.ps1 | ForEach-Object { . $_.FullName }

$containerId = ""
$connectionString = ""
$containerId = ''
$connectionString = ''
$tempDir = Join-Path $settings.bin ([Guid]::NewGuid().ToString())

Enter-Build {
Expand All @@ -35,9 +35,9 @@ task StartDatabase {
task RunTest {
& "Wait-$database" $connectionString

$app = Join-Path $tempDir "SqlDatabase.exe"
$app = Join-Path $tempDir 'SqlDatabase.exe'
$script = (Join-Path $settings.integrationTests $database)
$script = Join-Path $script "Test.ps1"
$script = Join-Path $script 'Test.ps1'

& $script $app $connectionString
}
Expand Down
Loading