From 24c08ec15bf5dff02d0fe296d3d348500604afff Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Tue, 27 Dec 2022 00:16:36 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Enable=20deterministic=20builds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Build/build-functions.psm1 | 12 +++-- UnitsNet.sln | 19 ++++++- appveyor.yml | 101 ------------------------------------- 3 files changed, 27 insertions(+), 105 deletions(-) delete mode 100644 appveyor.yml diff --git a/Build/build-functions.psm1 b/Build/build-functions.psm1 index b57d6fb8ed..948f90f7a4 100644 --- a/Build/build-functions.psm1 +++ b/Build/build-functions.psm1 @@ -37,7 +37,7 @@ function Start-Build([boolean] $IncludeNanoFramework = $false) { $appVeyorLoggerNetCoreDll = "C:\Program Files\AppVeyor\BuildAgent\dotnetcore\Appveyor.MSBuildLogger.dll" $appVeyorLoggerArg = if (Test-Path "$appVeyorLoggerNetCoreDll") { "/logger:$appVeyorLoggerNetCoreDll" } else { "" } - dotnet build --configuration Release "$root\UnitsNet.sln" $fileLoggerArg $appVeyorLoggerArg + dotnet build --configuration Release /p:ContinuousIntegrationBuild=true "$root\UnitsNet.sln" $fileLoggerArg $appVeyorLoggerArg if ($lastexitcode -ne 0) { exit 1 } if (-not $IncludeNanoFramework) @@ -53,7 +53,7 @@ function Start-Build([boolean] $IncludeNanoFramework = $false) { # msbuild does not auto-restore nugets for this project type & "$nuget" restore "$root\UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" # now build - & "$msbuildx64" "$root\UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" /verbosity:minimal /p:Configuration=Release /p:Platform="Any CPU" $fileLoggerArg $appVeyorLoggerArg + & "$msbuildx64" "$root\UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" /verbosity:minimal /p:Configuration=Release /p:Platform="Any CPU" /p:ContinuousIntegrationBuild=true $fileLoggerArg $appVeyorLoggerArg if ($lastexitcode -ne 0) { exit 1 } } @@ -83,6 +83,7 @@ function Start-Tests { # Create coverage report for this test project & dotnet dotcover test ` + --no-build ` --dotCoverFilters="+:module=UnitsNet*;-:module=*Tests" ` --dotCoverOutput="$coverageReportFile" ` --dcReportType=DetailedXML @@ -106,7 +107,12 @@ function Start-PackNugets([boolean] $IncludeNanoFramework = $false) { write-host -foreground blue "Pack nugets...`n---" foreach ($projectPath in $projectPaths) { - dotnet pack --configuration Release -o $nugetOutDir "$root\$projectPath" + dotnet pack --configuration Release ` + --no-build ` + --output $nugetOutDir ` + /p:ContinuousIntegrationBuild=true ` + "$root\$projectPath" + if ($lastexitcode -ne 0) { exit 1 } } diff --git a/UnitsNet.sln b/UnitsNet.sln index 6a9d558b59..4ce7b362fa 100644 --- a/UnitsNet.sln +++ b/UnitsNet.sln @@ -24,7 +24,6 @@ ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig .gitattributes = .gitattributes .gitignore = .gitignore - appveyor.yml = appveyor.yml build.bat = build.bat build-all-targets.bat = build-all-targets.bat clean.bat = clean.bat @@ -40,8 +39,19 @@ ProjectSection(SolutionItems) = preProject test.bat = test.bat UnitsNet.sln.DotSettings = UnitsNet.sln.DotSettings UnitsNet.snk = UnitsNet.snk + azure-pipelines.yml = azure-pipelines.yml EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{C315CD54-43F9-47CB-8125-04036D6B5BF0}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{71C6EF60-7E52-4DF4-BA93-5FAF6D89AEC6}" + ProjectSection(SolutionItems) = preProject + Build\build.ps1 = Build\build.ps1 + Build\build-functions.psm1 = Build\build-functions.psm1 + Build\build-pack-nano-nugets.psm1 = Build\build-pack-nano-nugets.psm1 + Build\init.ps1 = Build\init.ps1 + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -80,6 +90,10 @@ Global {B4996AF5-9A8B-481A-9018-EC7F5B1605FF}.Debug|Any CPU.Build.0 = Debug|Any CPU {B4996AF5-9A8B-481A-9018-EC7F5B1605FF}.Release|Any CPU.ActiveCfg = Release|Any CPU {B4996AF5-9A8B-481A-9018-EC7F5B1605FF}.Release|Any CPU.Build.0 = Release|Any CPU + {C315CD54-43F9-47CB-8125-04036D6B5BF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C315CD54-43F9-47CB-8125-04036D6B5BF0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C315CD54-43F9-47CB-8125-04036D6B5BF0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C315CD54-43F9-47CB-8125-04036D6B5BF0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -87,4 +101,7 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {554906B2-5972-4EBF-9DD5-EEFA77D735D8} EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {71C6EF60-7E52-4DF4-BA93-5FAF6D89AEC6} = {B92B01BE-243E-4CCB-B5E5-AF469ADB1F54} + EndGlobalSection EndGlobal diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 80f6462ec8..0000000000 --- a/appveyor.yml +++ /dev/null @@ -1,101 +0,0 @@ -version: '{build}' -image: Visual Studio 2022 - -# Disable AppVeyor builds on all branches. -# We switched to https://dev.azure.com/unitsnet/Units.NET. -branches: - only: - - no-more-appveyor-builds-use-devops-instead - -# Don't build PR commits twice -skip_branch_with_pr: true - -# Don't build tags, avoid duplicate builds on master when bumping version -skip_tags: true - -# Don't build changes to docs -skip_commits: - files: - - docs/* - - '**/*.md' - -# Only fetch the latest commits to reduce time to download on agent, but support pushes containing multiple commits -clone_depth: 20 - -# build cache to preserve files/folders between builds -cache: - - packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified - - '%LocalAppData%\NuGet\Cache' # NuGet < v3 - - '%LocalAppData%\NuGet\v3-cache' # NuGet v3 - -# Set environment variables here -# environment: - -# Uncomment me to enable Remote Desktop for the duration of the build (when debugging hanging builds). -# Password is configured as envvar APPVEYOR_RDP_PASSWORD in AppVeyor UI. -# Scripts that run before cloning repository. -# init: - # - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) - -# Uncomment me to enable Remote Desktop AFTER build. Build is blocked until a special "lock" file on VM desktop is deleted (max 60 mins). -# Password is configured as envvar APPVEYOR_RDP_PASSWORD in AppVeyor UI. -# on_finish: - # - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) - -# Scripts that run after cloning repository. -# install: - -build_script: -- ps: | - # Build, test, pack and push nugets - .\\build-all-targets.bat - $BuildExitCode = $LASTEXITCODE - - # Upload test results to AppVeyor - $wc = New-Object 'System.Net.WebClient' - - if (Test-Path .\\Artifacts\\Logs\\) { - Get-ChildItem .\\Artifacts\\Logs\\*Test*.xml | %{ - $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", $_.FullName) - } - } - - if ($BuildExitCode -ne 0) { - Write-Host "Build failed with exit code $BuildExitCode." - exit $BuildExitCode - } - -# Upload code coverage reports to codecov.io. -# https://docs.codecov.com/docs/codecov-uploader -after_test: -- ps: | - $ProgressPreference = 'SilentlyContinue' - Invoke-WebRequest -Uri https://keybase.io/codecovsecurity/pgp_keys.asc -OutFile codecov.asc - gpg.exe --import codecov.asc - - Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe - Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM -Outfile codecov.exe.SHA256SUM - Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM.sig -Outfile codecov.exe.SHA256SUM.sig - - gpg.exe --verify codecov.exe.SHA256SUM.sig codecov.exe.SHA256SUM - If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject $(Get-Content codecov.exe.SHA256SUM)).length -eq 0) { echo "SHASUM verified" } Else {exit 1} - - .\codecov.exe "Artifacts/Coverage" -t $env:codecov_upload_token - -artifacts: -- path: Artifacts\UnitsNet.zip -- path: 'Artifacts\NuGet\*.nupkg' # find all NuGet packages recursively -- path: Artifacts\Coverage - -for: - - - branches: - only: - - master - - /release\/.+/ - - /support\/.+/ - - deploy: - - provider: NuGet - api_key: - secure: 3xzXMX5mWxAOcNOdbAPQ+xuVGoeLuBQ89G+HTpJAoF137XFC9+p1VWiupSEsHs2c