Skip to content

Commit da62a35

Browse files
authored
Merge pull request #358 from serilog/build-on-macos
build on macos
2 parents 6deeec3 + 3b2d346 commit da62a35

File tree

4 files changed

+32
-38
lines changed

4 files changed

+32
-38
lines changed

Build.ps1

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ if(Test-Path .\artifacts) {
77
Remove-Item .\artifacts -Force -Recurse
88
}
99

10-
& dotnet restore --no-cache
11-
1210
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
1311
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
1412
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"]
@@ -18,43 +16,20 @@ $buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($c
1816
echo "build: Package version suffix is $suffix"
1917
echo "build: Build version suffix is $buildSuffix"
2018

21-
foreach ($src in gci src/*) {
22-
Push-Location $src
23-
24-
echo "build: Packaging project in $src"
25-
26-
& dotnet build -c Release --version-suffix=$buildSuffix
27-
28-
if($suffix) {
29-
& dotnet pack -c Release --include-source --no-build -o ../../artifacts --version-suffix=$suffix -p:ContinuousIntegrationBuild=true
30-
} else {
31-
& dotnet pack -c Release --include-source --no-build -o ../../artifacts -p:ContinuousIntegrationBuild=true
32-
}
33-
if($LASTEXITCODE -ne 0) { exit 1 }
34-
35-
Pop-Location
36-
}
37-
38-
foreach ($test in gci test/*.Tests) {
39-
Push-Location $test
40-
41-
echo "build: Testing project in $test"
19+
& dotnet build --configuration Release --version-suffix=$buildSuffix /p:ContinuousIntegrationBuild=true
4220

43-
& dotnet test -c Release
44-
if($LASTEXITCODE -ne 0) { exit 3 }
21+
if($LASTEXITCODE -ne 0) { exit 1 }
4522

46-
Pop-Location
23+
if($suffix) {
24+
& dotnet pack src\Serilog.Settings.Configuration --configuration Release --no-build --no-restore -o artifacts --version-suffix=$suffix
25+
} else {
26+
& dotnet pack src\Serilog.Settings.Configuration --configuration Release --no-build --no-restore -o artifacts
4727
}
4828

49-
foreach ($test in gci test/*.PerformanceTests) {
50-
Push-Location $test
29+
if($LASTEXITCODE -ne 0) { exit 2 }
5130

52-
echo "build: Building performance test project in $test"
31+
Write-Output "build: Testing"
5332

54-
& dotnet build -c Release
55-
if($LASTEXITCODE -ne 0) { exit 2 }
56-
57-
Pop-Location
58-
}
33+
& dotnet test test\Serilog.Settings.Configuration.Tests --configuration Release --no-build --no-restore
5934

60-
Pop-Location
35+
if($LASTEXITCODE -ne 0) { exit 3 }

appveyor.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,27 @@ skip_tags: true
55
image:
66
- Visual Studio 2022
77
- Ubuntu
8+
- macOS
89

910
build_script:
10-
- pwsh: ./Build.ps1
11+
- pwsh: |
12+
if ($isWindows) {
13+
Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./dotnet-install.ps1"
14+
./dotnet-install.ps1 -JSonFile global.json -Architecture x64 -InstallDir 'C:\Program Files\dotnet'
15+
./Build.ps1
16+
}
17+
if ($isLinux) {
18+
Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile "./dotnet-install.sh"
19+
sudo chmod u+x dotnet-install.sh
20+
sudo ./dotnet-install.sh --jsonfile global.json --architecture x64 --install-dir '/usr/share/dotnet'
21+
./Build.ps1
22+
}
23+
if ($isMacOS) {
24+
Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile "./dotnet-install.sh"
25+
sudo chmod u+x dotnet-install.sh
26+
sudo ./dotnet-install.sh --jsonfile global.json --architecture x64 --install-dir '/usr/local/share/dotnet'
27+
./Build.ps1
28+
}
1129
1230
test: off
1331

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "7.0.102",
3+
"version": "7.0.201",
44
"allowPrerelease": false,
55
"rollForward": "latestFeature"
66
}

test/Serilog.Settings.Configuration.Tests/Serilog.Settings.Configuration.Tests.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net7.0;netcoreapp3.1;net48</TargetFrameworks>
4+
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT'">net48</TargetFrameworks>
5+
<TargetFrameworks>$(TargetFrameworks);net7.0;netcoreapp3.1</TargetFrameworks>
56
</PropertyGroup>
67

78
<ItemGroup>

0 commit comments

Comments
 (0)