Skip to content

Commit 162e10b

Browse files
authored
Merge pull request #233 from datalust/dev
2022.1.0 Release
2 parents 325c3c9 + 8e4475b commit 162e10b

File tree

16 files changed

+370
-303
lines changed

16 files changed

+370
-303
lines changed

Build.Docker.ps1

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ $IsPublishedBuild = ($env:APPVEYOR_REPO_BRANCH -eq "main" -or $env:APPVEYOR_REPO
33

44
$version = @{ $true = $env:APPVEYOR_BUILD_VERSION; $false = "99.99.99" }[$env:APPVEYOR_BUILD_VERSION -ne $NULL];
55
$framework = "net6.0"
6-
$rid = "linux-x64"
7-
$tag = "datalust/seqcli-ci:$version"
6+
$image = "datalust/seqcli"
7+
$archs = @("x64", "arm64")
88

99
function Execute-Tests
1010
{
11-
& dotnet test ./test/SeqCli.Tests/SeqCli.Tests.csproj -c Release -f $framework /p:Configuration=Release /p:Platform=x64 /p:VersionPrefix=$version
11+
& dotnet test ./test/SeqCli.Tests/SeqCli.Tests.csproj -c Release -f $framework /p:Configuration=Release /p:VersionPrefix=$version
1212
if ($LASTEXITCODE -ne 0) { exit 1 }
1313

1414
cd ./test/SeqCli.EndToEnd/
@@ -22,16 +22,17 @@ function Execute-Tests
2222
cd ../..
2323
}
2424

25-
function Build-DockerImage
25+
function Build-DockerImage($arch)
2626
{
27-
& dotnet publish src/SeqCli/SeqCli.csproj -c Release -f $framework -r $rid /p:VersionPrefix=$version
27+
$rid = "linux-$arch"
28+
& dotnet publish src/SeqCli/SeqCli.csproj -c Release -f $framework -r $rid --self-contained /p:VersionPrefix=$version
2829
if($LASTEXITCODE -ne 0) { exit 2 }
2930

30-
& docker build -f dockerfiles/seqcli/Dockerfile -t $tag .
31+
& docker build -f dockerfiles/seqcli/$rid.Dockerfile -t "$image-ci:$version-$arch" .
3132
if($LASTEXITCODE -ne 0) { exit 3 }
3233
}
3334

34-
function Publish-DockerImage
35+
function Publish-DockerImage($arch)
3536
{
3637
$ErrorActionPreference = "SilentlyContinue"
3738

@@ -40,7 +41,7 @@ function Publish-DockerImage
4041
if ($LASTEXITCODE) { exit 3 }
4142
}
4243

43-
& docker push $tag
44+
& docker push "$image-ci:$version-$arch"
4445
if($LASTEXITCODE -ne 0) { exit 3 }
4546

4647
$ErrorActionPreference = "Stop"
@@ -50,10 +51,12 @@ Push-Location $PSScriptRoot
5051

5152
Execute-Tests
5253

53-
Build-DockerImage
54+
foreach ($arch in $archs) {
55+
Build-DockerImage($arch)
5456

55-
if ($IsPublishedBuild) {
56-
Publish-DockerImage
57+
if ($IsPublishedBuild) {
58+
Publish-DockerImage($arch)
59+
}
5760
}
5861

5962
Pop-Location

Build.ps1

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ $windowsTfmSuffix = '-windows'
55

66
function Clean-Output
77
{
8-
if(Test-Path ./artifacts) { rm ./artifacts -Force -Recurse }
8+
if(Test-Path ./artifacts) { rm ./artifacts -Force -Recurse }
99
}
1010

1111
function Restore-Packages
1212
{
13-
& dotnet restore
13+
& dotnet restore
1414
if($LASTEXITCODE -ne 0) { throw "Build failed" }
1515
}
1616

@@ -22,46 +22,46 @@ function Execute-Tests
2222

2323
function Create-ArtifactDir
2424
{
25-
mkdir ./artifacts
25+
mkdir ./artifacts
2626
}
2727

2828
function Publish-Archives($version)
2929
{
30-
$rids = @("linux-x64", "linux-musl-x64", "linux-arm64", "osx-x64", "win-x64")
31-
foreach ($rid in $rids) {
32-
$tfm = $framework
33-
if ($rid -eq "win-x64") {
34-
$tfm = "$tfm$windowsTfmSuffix"
35-
}
36-
37-
& dotnet publish ./src/SeqCli/SeqCli.csproj -c Release -f $tfm -r $rid /p:VersionPrefix=$version
38-
if($LASTEXITCODE -ne 0) { throw "Build failed" }
39-
40-
# Make sure the archive contains a reasonable root filename
41-
mv ./src/SeqCli/bin/Release/$tfm/$rid/publish/ ./src/SeqCli/bin/Release/$tfm/$rid/seqcli-$version-$rid/
42-
43-
if ($rid.StartsWith("win-")) {
44-
& ./build/7-zip/7za.exe a -tzip ./artifacts/seqcli-$version-$rid.zip ./src/SeqCli/bin/Release/$tfm/$rid/seqcli-$version-$rid/
45-
if($LASTEXITCODE -ne 0) { throw "Build failed" }
46-
} else {
47-
& ./build/7-zip/7za.exe a -ttar seqcli-$version-$rid.tar ./src/SeqCli/bin/Release/$tfm/$rid/seqcli-$version-$rid/
48-
if($LASTEXITCODE -ne 0) { throw "Build failed" }
49-
50-
# Back to the original directory name
51-
mv ./src/SeqCli/bin/Release/$tfm/$rid/seqcli-$version-$rid/ ./src/SeqCli/bin/Release/$tfm/$rid/publish/
52-
53-
& ./build/7-zip/7za.exe a -tgzip ./artifacts/seqcli-$version-$rid.tar.gz seqcli-$version-$rid.tar
54-
if($LASTEXITCODE -ne 0) { throw "Build failed" }
55-
56-
rm seqcli-$version-$rid.tar
57-
}
58-
}
30+
$rids = $([xml](Get-Content .\src\SeqCli\SeqCli.csproj)).Project.PropertyGroup.RuntimeIdentifiers.Split(';')
31+
foreach ($rid in $rids) {
32+
$tfm = $framework
33+
if ($rid -eq "win-x64") {
34+
$tfm = "$tfm$windowsTfmSuffix"
35+
}
36+
37+
& dotnet publish ./src/SeqCli/SeqCli.csproj -c Release -f $tfm -r $rid --self-contained /p:VersionPrefix=$version
38+
if($LASTEXITCODE -ne 0) { throw "Build failed" }
39+
40+
# Make sure the archive contains a reasonable root filename
41+
mv ./src/SeqCli/bin/Release/$tfm/$rid/publish/ ./src/SeqCli/bin/Release/$tfm/$rid/seqcli-$version-$rid/
42+
43+
if ($rid.StartsWith("win-")) {
44+
& ./build/7-zip/7za.exe a -tzip ./artifacts/seqcli-$version-$rid.zip ./src/SeqCli/bin/Release/$tfm/$rid/seqcli-$version-$rid/
45+
if($LASTEXITCODE -ne 0) { throw "Build failed" }
46+
} else {
47+
& ./build/7-zip/7za.exe a -ttar seqcli-$version-$rid.tar ./src/SeqCli/bin/Release/$tfm/$rid/seqcli-$version-$rid/
48+
if($LASTEXITCODE -ne 0) { throw "Build failed" }
49+
50+
# Back to the original directory name
51+
mv ./src/SeqCli/bin/Release/$tfm/$rid/seqcli-$version-$rid/ ./src/SeqCli/bin/Release/$tfm/$rid/publish/
52+
53+
& ./build/7-zip/7za.exe a -tgzip ./artifacts/seqcli-$version-$rid.tar.gz seqcli-$version-$rid.tar
54+
if($LASTEXITCODE -ne 0) { throw "Build failed" }
55+
56+
rm seqcli-$version-$rid.tar
57+
}
58+
}
5959
}
6060

6161
function Publish-DotNetTool($version)
62-
{
63-
# Tool packages have to target a single non-platform-specific TFM; doing this here is cleaner than attempting it in the CSPROJ directly
64-
dotnet pack ./src/SeqCli/SeqCli.csproj -c Release --output ./artifacts /p:VersionPrefix=$version /p:TargetFrameworks=$framework
62+
{
63+
# Tool packages have to target a single non-platform-specific TFM; doing this here is cleaner than attempting it in the CSPROJ directly
64+
dotnet pack ./src/SeqCli/SeqCli.csproj -c Release --output ./artifacts /p:VersionPrefix=$version /p:TargetFrameworks=$framework
6565
if($LASTEXITCODE -ne 0) { throw "Build failed" }
6666
}
6767

0 commit comments

Comments
 (0)