diff --git a/.vsts-ci.yml b/.vsts-ci.yml index d821b1e0ad..f640cf1893 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -18,6 +18,14 @@ steps: inputs: versionSpec: 4.6.2 +- task: DotNetCoreCLI@2 + inputs: + command: build + projects: script/setversion.csproj + arguments: -c Release + displayName: Set Version + condition: eq(variables['system.pullrequest.isfork'], false) + - powershell: | nuget install SignClient -Version 0.9.1 -SolutionDir $(Build.SourcesDirectory) -Verbosity quiet -ExcludeVersion .\build.cmd @@ -26,13 +34,14 @@ steps: SIGNCLIENT_SECRET: $(SignClientSecret) SIGNCLIENT_USER: $(SignClientUser) VSTS_ACCESS_TOKEN: $(System.AccessToken) + COVERALLS_TOKEN: $(COVERALLS_TOKEN) - task: CopyFiles@2 inputs: Contents: 'artifacts/*.nupkg' TargetFolder: '$(build.artifactstagingdirectory)\packages' flattenFolders: true - condition: always() + condition: eq(variables['system.pullrequest.isfork'], false) - task: PublishBuildArtifacts@1 displayName: Publish Package Artifacts @@ -40,14 +49,14 @@ steps: pathToPublish: '$(build.artifactstagingdirectory)\packages' artifactType: container artifactName: Packages - condition: always() + condition: eq(variables['system.pullrequest.isfork'], false) - task: CopyFiles@2 inputs: Contents: '**/*.binlog' TargetFolder: '$(build.artifactstagingdirectory)\binlogs' flattenFolders: true - condition: always() + condition: eq(variables['system.pullrequest.isfork'], false) - task: PublishBuildArtifacts@1 displayName: Publish Logs @@ -55,13 +64,13 @@ steps: pathToPublish: '$(build.artifactstagingdirectory)\binlogs' artifactType: container artifactName: Logs - condition: always() + condition: eq(variables['system.pullrequest.isfork'], false) - task: CopyFiles@2 inputs: Contents: '**/bin/*' TargetFolder: '$(build.artifactstagingdirectory)\binaries' - condition: always() + condition: eq(variables['system.pullrequest.isfork'], false) - task: PublishBuildArtifacts@1 displayName: Publish Binaries @@ -69,13 +78,13 @@ steps: pathToPublish: '$(build.artifactstagingdirectory)\binaries' artifactType: container artifactName: Binaries - condition: always() + condition: eq(variables['system.pullrequest.isfork'], false) - task: CopyFiles@2 inputs: Contents: 'src/ReactiveUI.**/Events_*.cs' TargetFolder: '$(build.artifactstagingdirectory)\Events' - condition: always() + condition: eq(variables['system.pullrequest.isfork'], false) - task: PublishBuildArtifacts@1 displayName: Publish Generated Events @@ -83,4 +92,4 @@ steps: pathToPublish: '$(build.artifactstagingdirectory)\Events' artifactType: container artifactName: Events - condition: always() + condition: eq(variables['system.pullrequest.isfork'], false) diff --git a/GitVersion.yml b/GitVersion.yml deleted file mode 100644 index 02ef9a4bdf..0000000000 --- a/GitVersion.yml +++ /dev/null @@ -1,16 +0,0 @@ -next-version: 8.0.0 -assembly-versioning-scheme: None -assembly-informational-format: '{NuGetVersion}-{sha}' -branches: - master: - mode: ContinuousDelivery - tag: - increment: Patch - prevent-increment-of-merged-branch-version: true - track-merge-target: false - develop: - mode: ContinuousDeployment - tag: alpha - increment: Minor - prevent-increment-of-merged-branch-version: false - track-merge-target: true diff --git a/README.md b/README.md index f4db3544f4..b8f4ef120d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![NuGet Stats](https://img.shields.io/nuget/v/reactiveui.svg)](https://www.nuget.org/packages/reactiveui) [![NuGet Stats](https://img.shields.io/nuget/vpre/reactiveui.svg)](https://www.nuget.org/packages/reactiveui) [![Build status](https://ci.appveyor.com/api/projects/status/jqfgxoaock7n23xm?svg=true)](https://ci.appveyor.com/project/dotnetfoundation/reactiveui) +[![NuGet Stats](https://img.shields.io/nuget/v/reactiveui.svg)](https://www.nuget.org/packages/reactiveui) [![NuGet Stats](https://img.shields.io/nuget/vpre/reactiveui.svg)](https://www.nuget.org/packages/reactiveui) [![Build status](https://dotnetfoundation.visualstudio.com/_apis/public/build/definitions/a5852744-a77d-4d76-a9d2-81ac1fdd5744/11/badge)](https://dotnetfoundation.visualstudio.com/ReactiveUI/ReactiveUI%20Team/_build/index?definitionId=11) [![Coverage Status](https://coveralls.io/repos/github/reactiveui/ReactiveUI/badge.svg?branch=develop)](https://coveralls.io/github/reactiveui/ReactiveUI?branch=develop) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://reactiveui.net/contribute) [![Pull Request Stats](http://www.issuestats.com/github/reactiveui/reactiveui/badge/pr?style=flat)](http://www.issuestats.com/github/reactiveui/reactiveui) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Freactiveui%2FReactiveUI.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Freactiveui%2FReactiveUI?ref=badge_shield) diff --git a/SignPackages.ps1 b/SignPackages.ps1 index 20d6e5eead..5552153822 100644 --- a/SignPackages.ps1 +++ b/SignPackages.ps1 @@ -1,7 +1,7 @@ $currentDirectory = split-path $MyInvocation.MyCommand.Definition # See if we have the ClientSecret available -if([string]::IsNullOrEmpty($env:SIGNCLIENT_SECRET)){ +if([string]::IsNullOrWhitespace($env:SIGNCLIENT_SECRET)){ Write-Error "Client Secret not found, not signing packages"; [System.Environment]::Exit(1); } diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 3e977adada..0000000000 --- a/appveyor.yml +++ /dev/null @@ -1,76 +0,0 @@ -# configuration for "master" branch -- - image: Visual Studio 2017 - branches: - only: - - master - version: 1.0.{build} - environment: - ANDROID_HOME: "C:\\android-sdk-windows" - COVERALLS_TOKEN: jLYKFVgST432LzbZeyLnLpoteXwQLveBw - GITHUB_USERNAME: - secure: 4l81stjUdh712ndqnwBryw== - GITHUB_TOKEN: - secure: TukU0LPvpoN1xkqjNNI8Ij7OxMnCmJxRnj6CsCDcAu+euK3eRTPRFJZl94na2+68 - NUGET_SOURCE: https://www.nuget.org/api/v2/package - NUGET_APIKEY: - secure: cANUegIQhgeZ7Yg4sosXNGmFF33i77nTriEjaeniQ4S26btcwYsopOO3qXKlbrvf - SIGNCLIENT_SECRET: - secure: TGMBTw6fMix/D/hPuoS6J6XQdY5L1hlL6JPpzgKBbDg= - SIGNCLIENT_USER: - secure: wwm115V/GOIkqGLbOom1aGBqkMQy6REFKPaG8P0b4//f0r01dc9pTWruOxLyi4X8 - init: - - cd "C:\projects\reactiveui" - install: - - nuget install SignClient -Version 0.9.0 -SolutionDir %APPVEYOR_BUILD_FOLDER% -Verbosity quiet -ExcludeVersion - build_script: - - ./build.cmd - cache: - - tools -> build.* - - src\packages -> **\packages.config - - '%USERPROFILE%\.nuget\packages -> **\project.json' - artifacts: - - path: artifacts/*.nupkg - - path: '**/bin/*' - - path: '**/*.binlog' - - path: src/ReactiveUI.**/Events_*.cs - test: off - on_failure: - - ps: Get-ChildItem *.binlog -recurse | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } - -# configuration for "develop" branch -- - image: Visual Studio 2017 - branches: - except: - - master - skip_branch_with_pr: true - version: 1.0.{build} - environment: - ANDROID_HOME: "C:\\android-sdk-windows" - COVERALLS_TOKEN: jLYKFVgST432LzbZeyLnLpoteXwQLveBw - NUGET_SOURCE: https://www.myget.org/F/reactiveui/api/v2/package - NUGET_APIKEY: - secure: KTszzEEs33kbeqkpGGMvM58elvNLeTJhytpv7s9fPHoY4ZZmk5fMwofKDtK2lhno - SIGNCLIENT_SECRET: - secure: TGMBTw6fMix/D/hPuoS6J6XQdY5L1hlL6JPpzgKBbDg= - SIGNCLIENT_USER: - secure: wwm115V/GOIkqGLbOom1aGBqkMQy6REFKPaG8P0b4//f0r01dc9pTWruOxLyi4X8 - init: - - cd "C:\projects\reactiveui" - install: - - nuget install SignClient -Version 0.9.0 -SolutionDir %APPVEYOR_BUILD_FOLDER% -Verbosity quiet -ExcludeVersion - build_script: - - ./build.cmd - cache: - - tools -> build.* - - src\packages -> **\packages.config - - '%USERPROFILE%\.nuget\packages -> **\project.json' - artifacts: - - path: artifacts/*.nupkg - - path: '**/bin/*' - - path: '**/*.binlog' - - path: src/ReactiveUI.**/Events_*.cs - test: off - on_failure: - - ps: Get-ChildItem *.binlog -recurse | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file diff --git a/build.cake b/build.cake index 924d045cc1..6b6e064d0b 100644 --- a/build.cake +++ b/build.cake @@ -16,7 +16,6 @@ ////////////////////////////////////////////////////////////////////// #tool "nuget:?package=GitReleaseManager&version=0.7.0" -#tool "nuget:?package=GitVersion.CommandLine&version=3.6.5" #tool "nuget:?package=coveralls.io&version=1.4.2" #tool "nuget:?package=OpenCover&version=4.6.519" #tool "nuget:?package=ReportGenerator&version=3.1.2" @@ -42,27 +41,12 @@ var treatWarningsAsErrors = false; // Build configuration var local = BuildSystem.IsLocalBuild; -var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest; -var isRepository = StringComparer.OrdinalIgnoreCase.Equals("reactiveui/reactiveui", AppVeyor.Environment.Repository.Name); - -var isDevelopBranch = StringComparer.OrdinalIgnoreCase.Equals("develop", AppVeyor.Environment.Repository.Branch); -var isReleaseBranch = StringComparer.OrdinalIgnoreCase.Equals("master", AppVeyor.Environment.Repository.Branch); -var isTagged = AppVeyor.Environment.Repository.Tag.IsTag; - -var githubOwner = "reactiveui"; -var githubRepository = "reactiveui"; -var githubUrl = string.Format("https://github.com/{0}/{1}", githubOwner, githubRepository); +var isPullRequest = !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("SYSTEM_PULLREQUEST_PULLREQUESTNUMBER")); +var isRepository = StringComparer.OrdinalIgnoreCase.Equals("reactiveui/reactiveui", TFBuild.Environment.Repository.RepoName); var msBuildPath = VSWhereLatest().CombineWithFilePath("./MSBuild/15.0/Bin/MSBuild.exe"); - -// Version -var gitVersion = GitVersion(); - -var majorMinorPatch = gitVersion.MajorMinorPatch; -var informationalVersion = gitVersion.InformationalVersion; -var nugetVersion = gitVersion.NuGetVersionV2; -var buildVersion = gitVersion.FullBuildMetaData; +var informationalVersion = EnvironmentVariable("GitAssemblyInformationalVersion"); // Artifacts var artifactDirectory = "./artifacts/"; @@ -91,7 +75,7 @@ Setup(context => throw new NotImplementedException("ReactiveUI will only build on Windows (w/Xamarin installed) because it's not possible to target UWP, WPF and Windows Forms from UNIX."); } - Information("Building version {0} of ReactiveUI. (isTagged: {1})", informationalVersion, isTagged); + Information("Building version {0} of ReactiveUI.", informationalVersion); CreateDirectory(artifactDirectory); }); @@ -200,11 +184,7 @@ Task("BuildReactiveUI") .WithTarget("build;pack") .WithProperty("PackageOutputPath", MakeAbsolute(Directory(artifactDirectory)).ToString().Quote()) .WithProperty("TreatWarningsAsErrors", treatWarningsAsErrors.ToString()) - .SetConfiguration("Release") - // Due to https://github.com/NuGet/Home/issues/4790 and https://github.com/NuGet/Home/issues/4337 we - // have to pass a version explicitly - .WithProperty("Version", nugetVersion.ToString()) - .WithProperty("InformationalVersion", informationalVersion) + .SetConfiguration("Release") .SetVerbosity(Verbosity.Minimal) .SetNodeReuse(false)); }; @@ -264,15 +244,13 @@ Task("UploadTestCoverage") { // Resolve the API key. var token = EnvironmentVariable("COVERALLS_TOKEN"); - if (string.IsNullOrEmpty(token)) + if (!string.IsNullOrEmpty(token)) { - throw new Exception("The COVERALLS_TOKEN environment variable is not defined."); + CoverallsIo(testCoverageOutputFile, new CoverallsIoSettings() + { + RepoToken = token + }); } - - CoverallsIo(testCoverageOutputFile, new CoverallsIoSettings() - { - RepoToken = token - }); }); Task("SignPackages") @@ -298,133 +276,26 @@ Task("Package") Task("PinNuGetDependencies") .Does (() => { - // only pin whitelisted packages. - foreach(var package in packageWhitelist) - { - // only pin the package which was created during this build run. - var packagePath = artifactDirectory + File(string.Concat(package, ".", nugetVersion, ".nupkg")); - - // see https://github.com/cake-contrib/Cake.PinNuGetDependency - PinNuGetDependency(packagePath, "ReactiveUI"); - } -}); - - -Task("PublishPackages") - .IsDependentOn("RunUnitTests") - .IsDependentOn("Package") - .IsDependentOn("SignPackages") - .WithCriteria(() => !local) - .WithCriteria(() => !isPullRequest) - .WithCriteria(() => isRepository) - .WithCriteria(() => isDevelopBranch || isReleaseBranch) - .Does (() => -{ - - if (isReleaseBranch && !isTagged) - { - Information("Packages will not be published as this release has not been tagged."); - return; - } - - // Resolve the API key. - var apiKey = EnvironmentVariable("NUGET_APIKEY"); - if (string.IsNullOrEmpty(apiKey)) - { - throw new Exception("The NUGET_APIKEY environment variable is not defined."); - } - - var source = EnvironmentVariable("NUGET_SOURCE"); - if (string.IsNullOrEmpty(source)) - { - throw new Exception("The NUGET_SOURCE environment variable is not defined."); - } - - // only push whitelisted packages. - foreach(var package in packageWhitelist) - { - // only push the package which was created during this build run. - var packagePath = artifactDirectory + File(string.Concat(package, ".", nugetVersion, ".nupkg")); - - // Push the package. - NuGetPush(packagePath, new NuGetPushSettings { - Source = source, - ApiKey = apiKey - }); - } -}); - -Task("CreateRelease") - .IsDependentOn("Package") - .WithCriteria(() => !local) - .WithCriteria(() => !isPullRequest) - .WithCriteria(() => isRepository) - .WithCriteria(() => isReleaseBranch) - .WithCriteria(() => !isTagged) - .Does (() => -{ - var username = EnvironmentVariable("GITHUB_USERNAME"); - if (string.IsNullOrEmpty(username)) + var packages = GetFiles(artifactDirectory + "*.nupkg"); + foreach(var package in packages) { - throw new Exception("The GITHUB_USERNAME environment variable is not defined."); - } - - var token = EnvironmentVariable("GITHUB_TOKEN"); - if (string.IsNullOrEmpty(token)) - { - throw new Exception("The GITHUB_TOKEN environment variable is not defined."); + // only pin whitelisted packages. + if(packageWhitelist.Any(p => package.GetFilename().ToString().StartsWith(p, StringComparison.OrdinalIgnoreCase))) + { + // see https://github.com/cake-contrib/Cake.PinNuGetDependency + PinNuGetDependency(package, "ReactiveUI"); + } } - - GitReleaseManagerCreate(username, token, githubOwner, githubRepository, new GitReleaseManagerCreateSettings { - Milestone = majorMinorPatch, - Name = majorMinorPatch, - Prerelease = true, - TargetCommitish = "master" - }); }); -Task("PublishRelease") - .IsDependentOn("RunUnitTests") - .IsDependentOn("Package") - .WithCriteria(() => !local) - .WithCriteria(() => !isPullRequest) - .WithCriteria(() => isRepository) - .WithCriteria(() => isReleaseBranch) - .WithCriteria(() => isTagged) - .Does (() => -{ - var username = EnvironmentVariable("GITHUB_USERNAME"); - if (string.IsNullOrEmpty(username)) - { - throw new Exception("The GITHUB_USERNAME environment variable is not defined."); - } - - var token = EnvironmentVariable("GITHUB_TOKEN"); - if (string.IsNullOrEmpty(token)) - { - throw new Exception("The GITHUB_TOKEN environment variable is not defined."); - } - // only push whitelisted packages. - foreach(var package in packageWhitelist) - { - // only push the package which was created during this build run. - var packagePath = artifactDirectory + File(string.Concat(package, ".", nugetVersion, ".nupkg")); - - GitReleaseManagerAddAssets(username, token, githubOwner, githubRepository, majorMinorPatch, packagePath); - } - - GitReleaseManagerClose(username, token, githubOwner, githubRepository, majorMinorPatch); -}); ////////////////////////////////////////////////////////////////////// // TASK TARGETS ////////////////////////////////////////////////////////////////////// Task("Default") - .IsDependentOn("CreateRelease") - .IsDependentOn("PublishPackages") - .IsDependentOn("PublishRelease") + .IsDependentOn("Package") .Does (() => { }); diff --git a/build.cmd b/build.cmd index 9e027e59d0..ec3dc97bda 100644 --- a/build.cmd +++ b/build.cmd @@ -1,7 +1,6 @@ @echo off -tools\nuget\nuget.exe update -self tools\nuget\nuget.exe install Cake -OutputDirectory tools -ExcludeVersion -Version 0.22.1 -tools\Cake\Cake.exe build.cake --target=%1 --verbosity=diagnostic +tools\Cake\Cake.exe build.cake --target=%1 exit /b %errorlevel% diff --git a/script/setversion.csproj b/script/setversion.csproj new file mode 100644 index 0000000000..1f2887636d --- /dev/null +++ b/script/setversion.csproj @@ -0,0 +1,10 @@ + + + + netstandard2.0 + + + + + + diff --git a/script/version.json b/script/version.json new file mode 100644 index 0000000000..f1b52a7dcf --- /dev/null +++ b/script/version.json @@ -0,0 +1,8 @@ +{ + "inherit": true, + "cloudBuild": { + "buildNumber": { + "enabled": true + } + } +} diff --git a/src/Directory.build.props b/src/Directory.build.props index cfcb7faff7..a2790b24af 100644 --- a/src/Directory.build.props +++ b/src/Directory.build.props @@ -30,6 +30,10 @@ + + + + diff --git a/version.json b/version.json new file mode 100644 index 0000000000..90432d1767 --- /dev/null +++ b/version.json @@ -0,0 +1,16 @@ +{ + "version": "8.1", + "publicReleaseRefSpec": [ + "^refs/heads/master$", // we release out of master + "^refs/heads/rel/\\d+\\.\\d+\\.\\d+" // we also release branches starting with rel/N.N.N + ], + "nugetPackageVersion":{ + "semVer": 2 + }, + "cloudBuild": { + "setVersionVariables": true, + "buildNumber": { + "enabled": false + } + } +}