forked from GitTools/GitVersion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Lets see how well this works - Thrown together over lunch - Opening this as a point of discussion
- Loading branch information
1 parent
aa5bb19
commit aaf37c5
Showing
7 changed files
with
487 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,15 @@ | ||
language: csharp | ||
solution: src/GitVersion.sln | ||
sudo: false | ||
mono: | ||
- latest | ||
os: | ||
- linux | ||
- osx | ||
before_install: # We need to download nuget.exe due to: https://github.com/travis-ci/travis-ci/issues/5932 | ||
before_install: | ||
- git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags | ||
- mkdir -p .nuget | ||
- wget -O .nuget/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe | ||
- mono .nuget/nuget.exe | ||
install: | ||
- mono .nuget/nuget.exe restore src/GitVersion.sln -Verbosity detailed | ||
- mono .nuget/nuget.exe install NUnit.Runners -Version 3.2.1 -OutputDirectory ./src/packages | ||
script: | ||
- xbuild ./src/GitVersion.sln /property:Configuration="Debug" /verbosity:detailed | ||
- mono ./build/NuGetCommandLineBuild/tools/GitVersion.exe -l console -output buildserver -updateAssemblyInfo | ||
- xbuild ./src/GitVersion.sln /property:Configuration="Debug" /verbosity:detailed | ||
- mono ./src/packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe ./src/GitVersionTask.Tests/bin/Debug/GitVersionTask.Tests.dll ./src/GitVersionCore.Tests/bin/Debug/GitVersionCore.Tests.dll ./src/GitVersionTask.Tests/bin/Debug/GitVersionTask.Tests.dll ./src/GitVersionExe.Tests/bin/Debug/GitVersionExe.Tests.dll --where "cat != NoMono" --noresult | ||
|
||
# | ||
# To run a clean build with Mono, executing just one test, do: | ||
# xbuild ./src/GitVersion.sln /t:Clean /verbosity:quiet && xbuild ./src/GitVersion.sln /property:Configuration="Debug" /verbosity:quiet && mono ./src/packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe ./src/GitVersionTask.Tests/bin/Debug/GitVersionTask.Tests.dll ./src/GitVersionCore.Tests/bin/Debug/GitVersionCore.Tests.dll ./src/GitVersionTask.Tests/bin/Debug/GitVersionTask.Tests.dll ./src/GitVersionExe.Tests/bin/Debug/GitVersionExe.Tests.dll --noresult --where "test =~ /TheNameOfTheTest/" | ||
# | ||
# To run a clean build with Mono, executing all tests, do: | ||
# xbuild ./src/GitVersion.sln /t:Clean /verbosity:quiet && xbuild ./src/GitVersion.sln /property:Configuration="Debug" /verbosity:quiet && mono ./src/packages/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe ./src/GitVersionTask.Tests/bin/Debug/GitVersionTask.Tests.dll ./src/GitVersionCore.Tests/bin/Debug/GitVersionCore.Tests.dll ./src/GitVersionTask.Tests/bin/Debug/GitVersionTask.Tests.dll ./src/GitVersionExe.Tests/bin/Debug/GitVersionExe.Tests.dll --noresult --where "cat != NoMono" --noresult | ||
# | ||
- ./build.sh | ||
cache: | ||
directories: | ||
- src/packages | ||
- tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,8 @@ | ||
assembly_info: | ||
patch: false | ||
|
||
platform: | ||
- Any CPU | ||
|
||
configuration: | ||
- Debug | ||
|
||
build_script: | ||
- cmd: nuget restore src/GitVersion.sln | ||
- cmd: npm i -g tfx-cli | ||
|
||
- cmd: msbuild src/GitVersion.sln "/p:Configuration=%CONFIGURATION%;Platform=%PLATFORM%" | ||
- ps: .\build\NuGetCommandLineBuild\tools\GitVersion.exe /l console /output buildserver /updateAssemblyInfo | ||
- cmd: msbuild src/GitVersion.sln "/p:Configuration=%CONFIGURATION%;Platform=%PLATFORM%" | ||
|
||
- cmd: appveyor PushArtifact "build\NuGetExeBuild\GitVersion.Portable.%GitVersion_NuGetVersion%.nupkg" | ||
|
||
- cmd: appveyor PushArtifact "build\NuGetCommandLineBuild\GitVersion.CommandLine.%GitVersion_NuGetVersion%.nupkg" | ||
- cmd: appveyor PushArtifact "build\NuGetRefBuild\GitVersion.%GitVersion_NuGetVersion%.nupkg" | ||
- cmd: appveyor PushArtifact "build\NuGetTaskBuild\GitVersionTask.%GitVersion_NuGetVersion%.nupkg" | ||
- ps: appveyor PushArtifact ("build\GemBuild\gitversion-$env:GitVersion_MajorMinorPatch" + (&{If($env:GitVersion_PreReleaseTag -eq '' -or $env:GitVersion_PreReleaseTag -eq $null) {""} Else {"."+$env:GitVersion_PreReleaseTag}}) + ".gem") | ||
|
||
- cmd: 7z a "GitVersion_%GitVersion_NuGetVersion%.zip" -r .\build\NuGetCommandLineBuild\Tools\*.* | ||
- cmd: appveyor PushArtifact "GitVersion_%GitVersion_NuGetVersion%.zip" | ||
|
||
- cmd: 7z a "GitVersionTfsBuildTask_%GitVersion_NuGetVersion%.zip" -r .\build\GitVersionTfsTaskBuild\GitVersionTask\*.* | ||
- cmd: appveyor PushArtifact "GitVersionTfsBuildTask_%GitVersion_NuGetVersion%.zip" | ||
- cmd: appveyor PushArtifact "build\GitVersionTfsTaskBuild\gittools.gitversion-%GitVersion_SemVer%.vsix" | ||
|
||
test_script: | ||
- nunit3-console "src\GitVersionTask.Tests\bin\%CONFIGURATION%\GitVersionTask.Tests.dll" "src\GitVersionExe.Tests\bin\%CONFIGURATION%\GitVersionExe.Tests.dll" "src\GitVersionCore.Tests\bin\%CONFIGURATION%\GitVersionCore.Tests.dll" | ||
- ps: .\build.ps1 -Target "AppVeyor" | ||
|
||
cache: | ||
- src\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified | ||
- src\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,242 @@ | ||
#tool "nuget:?package=GitVersion.CommandLine" | ||
#tool "nuget:?package=NUnit.ConsoleRunner" | ||
|
||
var target = Argument("target", "Default"); | ||
var configuration = Argument("configuration", "Release"); | ||
|
||
string version = null; | ||
string nugetVersion = null; | ||
string preReleaseTag = null; | ||
string semVersion = null; | ||
string milestone = null; | ||
bool publishingError = false; | ||
bool IsTagged = (BuildSystem.AppVeyor.Environment.Repository.Tag.IsTag && | ||
!string.IsNullOrWhiteSpace(BuildSystem.AppVeyor.Environment.Repository.Tag.Name)); | ||
bool IsMainGitVersionRepo = StringComparer.OrdinalIgnoreCase.Equals("gittools/gitversion", BuildSystem.AppVeyor.Environment.Repository.Name); | ||
bool IsPullRequest = BuildSystem.AppVeyor.Environment.PullRequest.IsPullRequest; | ||
|
||
Setup(context => | ||
{ | ||
if(!BuildSystem.IsLocalBuild) | ||
{ | ||
GitVersion(new GitVersionSettings{ | ||
UpdateAssemblyInfo = true, | ||
LogFilePath = "console", | ||
OutputType = GitVersionOutput.BuildServer | ||
}); | ||
|
||
version = context.EnvironmentVariable("GitVersion_MajorMinorPatch"); | ||
nugetVersion = context.EnvironmentVariable("GitVersion_NuGetVersion"); | ||
preReleaseTag = context.EnvironmentVariable("GitVersion_PreReleaseTag"); | ||
semVersion = context.EnvironmentVariable("GitVersion_LegacySemVerPadded"); | ||
milestone = string.Concat("v", version); | ||
} | ||
|
||
GitVersion assertedVersions = GitVersion(new GitVersionSettings | ||
{ | ||
OutputType = GitVersionOutput.Json | ||
}); | ||
|
||
version = assertedVersions.MajorMinorPatch; | ||
nugetVersion = assertedVersions.NuGetVersion; | ||
preReleaseTag = assertedVersions.PreReleaseTag; | ||
semVersion = assertedVersions.LegacySemVerPadded; | ||
milestone = string.Concat("v", version); | ||
}); | ||
|
||
Task("NuGet-Package-Restore") | ||
.Does(() => | ||
{ | ||
NuGetRestore("./src/GitVersion.sln"); | ||
}); | ||
|
||
Task("Build") | ||
.IsDependentOn("NuGet-Package-Restore") | ||
.Does(() => | ||
{ | ||
if(IsRunningOnUnix()) | ||
{ | ||
XBuild("./Source/Gep13.Cake.Sample.WebApplication.sln", new XBuildSettings() | ||
.SetConfiguration(configuration) | ||
.WithProperty("POSIX", "True") | ||
.SetVerbosity(Verbosity.Verbose) | ||
); | ||
} | ||
else | ||
{ | ||
MSBuild("./src/GitVersion.sln", new MSBuildSettings() | ||
.SetConfiguration(configuration) | ||
.SetPlatformTarget(PlatformTarget.MSIL) | ||
.WithProperty("Windows", "True") | ||
.UseToolVersion(MSBuildToolVersion.VS2015) | ||
.SetVerbosity(Verbosity.Minimal) | ||
.SetNodeReuse(false)); | ||
} | ||
}); | ||
|
||
Task("Run-NUnit-Tests") | ||
.IsDependentOn("Build") | ||
.Does(() => | ||
{ | ||
NUnit3("src/*.Tests/bin/" + configuration + "/*.Tests.dll"); | ||
}); | ||
|
||
Task("Zip-Files") | ||
.IsDependentOn("Run-NUnit-Tests") | ||
.Does(() => | ||
{ | ||
var files = GetFiles("./build/NuGetCommandLineBuild/Tools/*.*"); | ||
|
||
Zip("./", "GitVersion_" + nugetVersion + ".zip", files); | ||
|
||
files = GetFiles("./build/GitVersionTfsTaskBuild/GitVersionTask/*.*"); | ||
|
||
Zip("./", "GitVersionTfsBuildTask_" + nugetVersion + ".zip", files); | ||
}); | ||
|
||
Task("Create-NuGet-Packages") | ||
.Does(() => | ||
{ | ||
|
||
}); | ||
|
||
Task("Create-Chocolatey-Packages") | ||
.Does(() => | ||
{ | ||
|
||
}); | ||
|
||
Task("Create-Release-Notes") | ||
.Does(() => | ||
{ | ||
//GitReleaseManagerCreate(parameters.GitHub.UserName, parameters.GitHub.Password, "cake-build", "cake", new GitReleaseManagerCreateSettings { | ||
// Milestone = parameters.Version.Milestone, | ||
// Name = parameters.Version.Milestone, | ||
// Prerelease = true, | ||
// TargetCommitish = "main" | ||
//}); | ||
}); | ||
|
||
Task("Package") | ||
.IsDependentOn("Zip-Files") | ||
.IsDependentOn("Create-NuGet-Packages") | ||
.IsDependentOn("Create-Chocolatey-Packages"); | ||
|
||
Task("Upload-AppVeyor-Artifacts") | ||
.IsDependentOn("Package") | ||
.WithCriteria(() => BuildSystem.AppVeyor.IsRunningOnAppVeyor) | ||
.Does(() => | ||
{ | ||
AppVeyor.UploadArtifact("build/NuGetExeBuild/GitVersion.Portable." + nugetVersion +".nupkg"); | ||
AppVeyor.UploadArtifact("build/NuGetCommandLineBuild/GitVersion.CommandLine." + nugetVersion +".nupkg"); | ||
AppVeyor.UploadArtifact("build/NuGetRefBuild/GitVersion." + nugetVersion +".nupkg"); | ||
AppVeyor.UploadArtifact("build/NuGetTaskBuild/GitVersionTask." + nugetVersion +".nupkg"); | ||
AppVeyor.UploadArtifact("build/GitVersionTfsTaskBuild/gittools.gitversion-" + semVersion + ".vsix"); | ||
AppVeyor.UploadArtifact("GitVersion_" + nugetVersion + ".zip"); | ||
AppVeyor.UploadArtifact("GitVersionTfsBuildTask_" + nugetVersion + ".zip"); | ||
}); | ||
|
||
Task("Publish-MyGet") | ||
.IsDependentOn("Package") | ||
.WithCriteria(() => !BuildSystem.IsLocalBuild) | ||
.WithCriteria(() => !IsPullRequest) | ||
.WithCriteria(() => IsMainGitVersionRepo) | ||
.Does(() => | ||
{ | ||
|
||
}) | ||
.OnError(exception => | ||
{ | ||
Information("Publish-MyGet Task failed, but continuing with next Task..."); | ||
publishingError = true; | ||
}); | ||
|
||
Task("Publish-NuGet") | ||
.IsDependentOn("Package") | ||
.WithCriteria(() => !BuildSystem.IsLocalBuild) | ||
.WithCriteria(() => !IsPullRequest) | ||
.WithCriteria(() => IsMainGitVersionRepo) | ||
.WithCriteria(() => IsTagged) | ||
.Does(() => | ||
{ | ||
|
||
}) | ||
.OnError(exception => | ||
{ | ||
Information("Publish-NuGet Task failed, but continuing with next Task..."); | ||
publishingError = true; | ||
}); | ||
|
||
Task("Publish-Chocolatey") | ||
.IsDependentOn("Package") | ||
.WithCriteria(() => !BuildSystem.IsLocalBuild) | ||
.WithCriteria(() => !IsPullRequest) | ||
.WithCriteria(() => IsMainGitVersionRepo) | ||
.WithCriteria(() => IsTagged) | ||
.Does(() => | ||
{ | ||
|
||
}) | ||
.OnError(exception => | ||
{ | ||
Information("Publish-Chocolatey Task failed, but continuing with next Task..."); | ||
publishingError = true; | ||
}); | ||
|
||
Task("Publish-Gem") | ||
.IsDependentOn("Package") | ||
.WithCriteria(() => !BuildSystem.IsLocalBuild) | ||
.WithCriteria(() => !IsPullRequest) | ||
.WithCriteria(() => IsMainGitVersionRepo) | ||
.WithCriteria(() => IsTagged) | ||
.Does(() => | ||
{ | ||
|
||
}) | ||
.OnError(exception => | ||
{ | ||
Information("Publish-Gem Task failed, but continuing with next Task..."); | ||
publishingError = true; | ||
}); | ||
|
||
Task("Publish-GitHub-Release") | ||
.IsDependentOn("Package") | ||
.WithCriteria(() => !BuildSystem.IsLocalBuild) | ||
.WithCriteria(() => !IsPullRequest) | ||
.WithCriteria(() => IsMainGitVersionRepo) | ||
.WithCriteria(() => IsTagged) | ||
.Does(() => | ||
{ | ||
|
||
}) | ||
.OnError(exception => | ||
{ | ||
Information("Publish-GitHub-Release Task failed, but continuing with next Task..."); | ||
publishingError = true; | ||
}); | ||
|
||
Task("AppVeyor") | ||
.IsDependentOn("Upload-AppVeyor-Artifacts") | ||
.IsDependentOn("Publish-MyGet") | ||
.IsDependentOn("Publish-NuGet") | ||
.IsDependentOn("Publish-Chocolatey") | ||
.IsDependentOn("Publish-Gem") | ||
.IsDependentOn("Publish-GitHub-Release") | ||
.Finally(() => | ||
{ | ||
if(publishingError) | ||
{ | ||
throw new Exception("An error occurred during the publishing of Cake. All publishing tasks have been attempted."); | ||
} | ||
}); | ||
|
||
Task("Travis") | ||
.IsDependentOn("Run-NUnit-Tests"); | ||
|
||
Task("ReleaseNotes") | ||
.IsDependentOn("Create-Release-Notes"); | ||
|
||
Task("Default") | ||
.IsDependentOn("Package"); | ||
|
||
RunTarget(target); |
Oops, something went wrong.