From 3681e1eae8192739330f209c43a329ce80d098ab Mon Sep 17 00:00:00 2001 From: Christian Walpen Date: Thu, 9 Dec 2021 06:50:51 +0100 Subject: [PATCH 1/3] Update Version for next Release --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6a350e2..c44f210 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,10 +2,10 @@ # version format -version: 1.2.1.{build} +version: 1.2.2.{build} environment: - base_version: 1.2.1 + base_version: 1.2.2 # you can use {branch} name in version format too # version: 1.0.{build}-{branch} From b129882f01532ba2bd6e3360be96b0c2c6650179 Mon Sep 17 00:00:00 2001 From: Christian Walpen Date: Wed, 27 Apr 2022 10:09:17 +0200 Subject: [PATCH 2/3] Update appveyor Build to use nuke:build --- .nuke/build.schema.json | 16 +++++++++ appveyor-default.yml | 71 +++++++++++++++++++++++++++++++++++++ appveyor.yml | 78 +++++++++++++++++++++-------------------- build/Build.cs | 38 ++++++++++++++++++-- 4 files changed, 162 insertions(+), 41 deletions(-) create mode 100644 appveyor-default.yml diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 60c3d37..eb0f16d 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -6,6 +6,10 @@ "build": { "type": "object", "properties": { + "BuildNo": { + "type": "string", + "description": "The Buildnumber provided by the CI" + }, "Configuration": { "type": "string", "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", @@ -42,6 +46,10 @@ "VSCode" ] }, + "IsRc": { + "type": "boolean", + "description": "Is RC Version" + }, "NoLogo": { "type": "boolean", "description": "Disables displaying the NUKE logo" @@ -73,6 +81,8 @@ "enum": [ "Clean", "Compile", + "Deploy", + "FullBuild", "Restore", "Test" ] @@ -90,6 +100,8 @@ "enum": [ "Clean", "Compile", + "Deploy", + "FullBuild", "Restore", "Test" ] @@ -104,6 +116,10 @@ "Quiet", "Verbose" ] + }, + "Version": { + "type": "string", + "description": "Version to be injected in the Build" } } } diff --git a/appveyor-default.yml b/appveyor-default.yml new file mode 100644 index 0000000..c44f210 --- /dev/null +++ b/appveyor-default.yml @@ -0,0 +1,71 @@ +# http://www.appveyor.com/docs/appveyor-yml + + +# version format +version: 1.2.2.{build} + +environment: + base_version: 1.2.2 + +# you can use {branch} name in version format too +# version: 1.0.{build}-{branch} + +dotnet_csproj: + patch: true + file: '**\*.csproj' + version: '{version}' + package_version: $(base_version)-RC{build} + assembly_version: $(base_version) + file_version: '{version}' + informational_version: '{version}' + +# branches to build +branches: + # whitelist + only: + - master + - dev +# - somebranch + +os: Visual Studio 2022 +install: +# - set PATH=C:\Program Files (x86)\MSBuild\16.0\Bin;%PATH% + - dotnet tool install --global Nuke.GlobalTool + + +#before_build: +# - ps: dotnet tool install --global FlubuCore.Tool --version 5.1.8 + +build_script: + - nuke ReleaseBuild +# - ps: cd BuildScript +# - ps: flubu rebuild + +# to disable automatic tests +test: off + +#---------------------------------# +# artifacts configuration # +#---------------------------------# + +artifacts: + - path: src\YamlMap\bin\Release\netstandard2.0\YamlMap.dll + name: YamlMap.dll + + - path: src\YamlMap\bin\Release\net48\YamlMap.dll + name: YamlMap.dll + + # pushing all *.nupkg files in directory + - path: 'src\YamlMap\bin\Release\*.nupkg' + +# providers: Local, FTP, WebDeploy, AzureCS, AzureBlob, S3, NuGet, Environment +# provider names are case-sensitive! +# deploy: + # Deploying to NuGet feed +# - provider: NuGet +# server: https://my.nuget.server/feed +# api_key: +# secure: UlhUOcqPXsN837S8VwqMZ+10mKTxkqlnvCS5mwSyUGkFwwukfBtvXNpX81+bjS1j +# skip_symbols: true +# symbol_server: https://your.symbol.server/feed +# artifact: MeasureMap.nupkg diff --git a/appveyor.yml b/appveyor.yml index c44f210..5121096 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,62 +1,64 @@ # http://www.appveyor.com/docs/appveyor-yml - -# version format -version: 1.2.2.{build} - environment: base_version: 1.2.2 +version: $(base_version).{build} + # you can use {branch} name in version format too # version: 1.0.{build}-{branch} -dotnet_csproj: - patch: true - file: '**\*.csproj' - version: '{version}' - package_version: $(base_version)-RC{build} - assembly_version: $(base_version) - file_version: '{version}' - informational_version: '{version}' +image: + - Visual Studio 2022 + +for: + - + branches: + # whitelist + only: + - dev + + # Do not build on tags (GitHub only) + skip_tags: true -# branches to build -branches: - # whitelist - only: - - master - - dev -# - somebranch + install: + - dotnet tool install Nuke.GlobalTool --global --version 6.0.1 --no-cache -os: Visual Studio 2022 -install: -# - set PATH=C:\Program Files (x86)\MSBuild\16.0\Bin;%PATH% - - dotnet tool install --global Nuke.GlobalTool + before_build: + - dotnet restore ./build/_build.csproj + build_script: + - nuke FullBuild --isrc true --version "%base_version%" --buildno "%APPVEYOR_BUILD_NUMBER%" -#before_build: -# - ps: dotnet tool install --global FlubuCore.Tool --version 5.1.8 + - + branches: + # whitelist + only: + - master -build_script: - - nuke ReleaseBuild -# - ps: cd BuildScript -# - ps: flubu rebuild + # Do not build on tags (GitHub only) + skip_tags: true -# to disable automatic tests -test: off + install: + - dotnet tool install Nuke.GlobalTool --global --version 6.0.1 --no-cache + + before_build: + - dotnet restore ./build/_build.csproj + + build_script: + - nuke FullBuild --isrc false --version "%base_version%" --buildno "%APPVEYOR_BUILD_NUMBER%" #---------------------------------# # artifacts configuration # #---------------------------------# artifacts: - - path: src\YamlMap\bin\Release\netstandard2.0\YamlMap.dll + - path: src\YamlMap\bin\Release\netstandard2.1\YamlMap.dll name: YamlMap.dll - - - path: src\YamlMap\bin\Release\net48\YamlMap.dll - name: YamlMap.dll - + - path: src\YamlMap\bin\Release\netstandard2.1\YamlMap.xml + name: YamlMap.xml # pushing all *.nupkg files in directory - - path: 'src\YamlMap\bin\Release\*.nupkg' + - path: '**\*.nupkg' # providers: Local, FTP, WebDeploy, AzureCS, AzureBlob, S3, NuGet, Environment # provider names are case-sensitive! @@ -68,4 +70,4 @@ artifacts: # secure: UlhUOcqPXsN837S8VwqMZ+10mKTxkqlnvCS5mwSyUGkFwwukfBtvXNpX81+bjS1j # skip_symbols: true # symbol_server: https://your.symbol.server/feed -# artifact: MeasureMap.nupkg +# artifact: MeasureMap.nupkg \ No newline at end of file diff --git a/build/Build.cs b/build/Build.cs index 0eb2e89..141a972 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -33,13 +33,26 @@ class Build : NukeBuild [GitRepository] readonly GitRepository GitRepository; AbsolutePath SourceDirectory => RootDirectory / "src"; - AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts"; + AbsolutePath ArtifactsDirectory => RootDirectory / "Artifacts"; + + AbsolutePath TestsDirectory => RootDirectory / "Tests"; + + [Parameter("Version to be injected in the Build")] + public string Version { get; set; } = $"1.2.2"; + + [Parameter("The Buildnumber provided by the CI")] + public string BuildNo = "2"; + + [Parameter("Is RC Version")] + public bool IsRc = false; + Target Clean => _ => _ .Before(Restore) .Executes(() => { SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory); + TestsDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory); EnsureCleanDirectory(ArtifactsDirectory); }); @@ -57,6 +70,11 @@ class Build : NukeBuild DotNetBuild(s => s .SetProjectFile(Solution) .SetConfiguration(Configuration) + .SetVersion($"{Version}.{BuildNo}") + .SetAssemblyVersion($"{Version}.{BuildNo}") + .SetFileVersion(Version) + .SetInformationalVersion($"{Version}.{BuildNo}") + .AddProperty("PackageVersion", PackageVersion) .EnableNoRestore()); }); @@ -66,10 +84,24 @@ class Build : NukeBuild { DotNetTest(s => s .SetProjectFile(Solution) - .SetConfiguration("Debug")); + .SetConfiguration(Configuration) + .SetNoBuild(true) + .SetFilter("FullyQualifiedName!~Integration.Tests") + .EnableNoRestore()); }); - Target ReleaseBuild => _ => _ + Target FullBuild => _ => _ .DependsOn(Compile) .DependsOn(Test); + + Target Deploy => _ => _ + .DependsOn(Compile) + .Executes(() => + { + CopyFileToDirectory($"{SourceDirectory}/YamlMap/bin/{Configuration}/YamlMap.{PackageVersion}.nupkg", "C:\\Projects\\NuGet Store", FileExistsPolicy.Overwrite, false); + CopyFileToDirectory($"{SourceDirectory}/YamlMap/bin/{Configuration}/YamlMap.{PackageVersion}.snupkg", "C:\\Projects\\NuGet Store", FileExistsPolicy.Overwrite, false); + }); + + string PackageVersion + => IsRc ? int.Parse(BuildNo) < 10 ? $"{Version}-RC0{BuildNo}" : $"{Version}-RC{BuildNo}" : Version; } From 7cdc9b36d0857f5b68139621eec5fa4906599d9c Mon Sep 17 00:00:00 2001 From: Christian Walpen Date: Mon, 29 Aug 2022 21:01:08 +0200 Subject: [PATCH 3/3] Downgrade to netstandard2.0 --- .nuke/build.schema.json | 1 + build/_build.csproj | 2 +- src/Tests/YamlMap.Tests/Integration.cs | 2 +- src/Tests/YamlMap.Tests/YamlFileWriterTests.cs | 4 ++-- src/Tests/YamlMap.Tests/YamlMap.Tests.csproj | 12 ++++++------ src/YamlMap/YamlMap.csproj | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index eb0f16d..217a5d8 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -33,6 +33,7 @@ "AppVeyor", "AzurePipelines", "Bamboo", + "Bitbucket", "Bitrise", "GitHubActions", "GitLab", diff --git a/build/_build.csproj b/build/_build.csproj index db7aa01..cb65b8e 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Tests/YamlMap.Tests/Integration.cs b/src/Tests/YamlMap.Tests/Integration.cs index 847fe96..b5a1609 100644 --- a/src/Tests/YamlMap.Tests/Integration.cs +++ b/src/Tests/YamlMap.Tests/Integration.cs @@ -13,7 +13,7 @@ public class Integration [Test] public void LoadDataFromFile() { - var path = Uri.UnescapeDataString(new UriBuilder(typeof(Integration).Assembly.CodeBase).Path); + var path = Uri.UnescapeDataString(new UriBuilder(typeof(Integration).Assembly.Location).Path); path = Path.Combine(Path.GetDirectoryName(path), "TestData", "users.yml"); var reader = new YamlFileReader(); diff --git a/src/Tests/YamlMap.Tests/YamlFileWriterTests.cs b/src/Tests/YamlMap.Tests/YamlFileWriterTests.cs index 90fb716..365d89a 100644 --- a/src/Tests/YamlMap.Tests/YamlFileWriterTests.cs +++ b/src/Tests/YamlMap.Tests/YamlFileWriterTests.cs @@ -13,7 +13,7 @@ public class YamlFileWriterTests [SetUp] public void Setup() { - var path = Path.Combine(Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)), "WriterTest.yml"); + var path = Path.Combine(Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().Location).Path)), "WriterTest.yml"); if (File.Exists(path)) { File.Delete(path); @@ -28,7 +28,7 @@ public void YamlFileWriter_Write() Id = "writer test" }; - var path = Path.Combine(Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)), "WriterTest.yml"); + var path = Path.Combine(Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().Location).Path)), "WriterTest.yml"); var writer = new YamlFileWriter(); writer.Write(path, item); diff --git a/src/Tests/YamlMap.Tests/YamlMap.Tests.csproj b/src/Tests/YamlMap.Tests/YamlMap.Tests.csproj index d1d883f..103da7d 100644 --- a/src/Tests/YamlMap.Tests/YamlMap.Tests.csproj +++ b/src/Tests/YamlMap.Tests/YamlMap.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0;net48 false @@ -18,14 +18,14 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + diff --git a/src/YamlMap/YamlMap.csproj b/src/YamlMap/YamlMap.csproj index bdf6840..d64d500 100644 --- a/src/YamlMap/YamlMap.csproj +++ b/src/YamlMap/YamlMap.csproj @@ -1,7 +1,7 @@  - netstandard2.1 + netstandard2.0 netcoreapp2.1 true ../YamlMap.snk