Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Auto detect text files and perform LF normalization
* text=auto eol=crlf

# Declare files that will always have LF line endings on checkout.
*.sh text eol=lf

# Don't check these into the repo as LF to work around TeamCity bug
*.xml -text
*.targets -text
Expand Down
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,10 @@ site/
# Visual Studio Code
####################

.vscode
.vscode

####################
# Cake
####################
/tools
/*.zip
26 changes: 6 additions & 20 deletions .travis.yml
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
17 changes: 0 additions & 17 deletions Build.cmd

This file was deleted.

11 changes: 11 additions & 0 deletions appveyor.deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
install:
npm i -g tfx-cli

assembly_info:
patch: false

build_script:
- ps: .\deploy.ps1

test: off
skip_non_tags: true
33 changes: 7 additions & 26 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,17 @@
install:
npm i -g tfx-cli

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"
- ps: .\build.ps1

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"
test: off
skip_tags: true

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
174 changes: 174 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
#tool "nuget:?package=NUnit.ConsoleRunner"
#tool "nuget:?package=GitReleaseNotes"

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;

void Build(string configuration, string nugetVersion, string semVersion, string version, string preReleaseTag)
{
if(IsRunningOnUnix())
{
XBuild("./src/GitVersion.sln", new XBuildSettings()
.SetConfiguration(configuration)
.WithProperty("POSIX", "True")
.SetVerbosity(Verbosity.Verbose));
}
else
{
var msBuildSettings = new MSBuildSettings()
.SetConfiguration(configuration)
.SetPlatformTarget(PlatformTarget.MSIL)
.WithProperty("Windows", "True")
.UseToolVersion(MSBuildToolVersion.VS2015)
.SetVerbosity(Verbosity.Minimal)
.SetNodeReuse(false);

if (BuildSystem.AppVeyor.IsRunningOnAppVeyor)
{
msBuildSettings = msBuildSettings
.WithProperty("GitVersion_NuGetVersion", nugetVersion)
.WithProperty("GitVersion_SemVer", semVersion)
.WithProperty("GitVersion_MajorMinorPatch", version)
.WithProperty("GitVersion_PreReleaseTag", preReleaseTag);
}
MSBuild("./src/GitVersion.sln", msBuildSettings);
}
}

Task("DogfoodBuild")
.IsDependentOn("NuGet-Package-Restore")
.Does(() =>
{
Build(configuration, nugetVersion, semVersion, version, preReleaseTag);
});

Task("Version")
.IsDependentOn("DogfoodBuild")
.Does(() =>
{
GitVersion(new GitVersionSettings
{
UpdateAssemblyInfo = true,
LogFilePath = "console",
OutputType = GitVersionOutput.BuildServer,
ToolPath = @"src\GitVersionExe\bin\Release\GitVersion.exe"
});
GitVersion assertedVersions = GitVersion(new GitVersionSettings
{
OutputType = GitVersionOutput.Json,
ToolPath = @"src\GitVersionExe\bin\Release\GitVersion.exe"
});

version = assertedVersions.MajorMinorPatch;
nugetVersion = assertedVersions.NuGetVersion;
preReleaseTag = assertedVersions.PreReleaseTag;
semVersion = assertedVersions.LegacySemVerPadded;
});

Task("NuGet-Package-Restore")
.Does(() =>
{
NuGetRestore("./src/GitVersion.sln");
});

Task("Build")
.IsDependentOn("Version")
.IsDependentOn("NuGet-Package-Restore")
.Does(() =>
{
Build(configuration, nugetVersion, semVersion, version, preReleaseTag);
});

Task("Run-NUnit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new NUnit3Settings();
if(IsRunningOnUnix())
{
settings.Where = "cat != NoMono";
}
NUnit3(new [] {
"src/GitVersionCore.Tests/bin/" + configuration + "/GitVersionCore.Tests.dll",
"src/GitVersionExe.Tests/bin/" + configuration + "/GitVersionExe.Tests.dll",
"src/GitVersionTask.Tests/bin/" + configuration + "/GitVersionTask.Tests.dll" },
settings);
if (AppVeyor.IsRunningOnAppVeyor)
{
Information("Uploading test results");
AppVeyor.UploadTestResults("TestResult.xml", AppVeyorTestResultsType.NUnit3);
}
});

Task("Zip-Files")
.IsDependentOn("Run-NUnit-Tests")
.Does(() =>
{
Zip("./build/NuGetCommandLineBuild/Tools/", "build/GitVersion_" + nugetVersion + ".zip");
});

Task("Create-Release-Notes")
.IsDependentOn("Build")
.Does(() =>
{
var releaseNotesExitCode = StartProcess(
@"tools\GitReleaseNotes\tools\gitreleasenotes.exe",
new ProcessSettings { Arguments = ". /o build/releasenotes.md" });
if (string.IsNullOrEmpty(System.IO.File.ReadAllText("./build/releasenotes.md")))
System.IO.File.WriteAllText("./build/releasenotes.md", "No issues closed since last release");

if (releaseNotesExitCode != 0) throw new Exception("Failed to generate release notes");
});

Task("Package")
.IsDependentOn("Create-Release-Notes")
.IsDependentOn("Zip-Files");

Task("Upload-AppVeyor-Artifacts")
.IsDependentOn("Package")
.WithCriteria(() => AppVeyor.IsRunningOnAppVeyor)
.Does(() =>
{
var gem = string.IsNullOrEmpty(preReleaseTag) ?
"gitversion-" + version + ".gem" :
"gitversion-" + version + "." + preReleaseTag + ".gem";

System.IO.File.WriteAllLines("build/artifacts", new[]{
"NuGetExeBuild:GitVersion.Portable." + nugetVersion +".nupkg",
"NuGetCommandLineBuild:GitVersion.CommandLine." + nugetVersion +".nupkg",
"NuGetRefBuild:GitVersion." + nugetVersion +".nupkg",
"NuGetTaskBuild:GitVersionTask." + nugetVersion +".nupkg",
"GitVersionTfsTaskBuild:gittools.gitversion." + semVersion +".vsix",
"GemBuild:" + gem,
"zip:GitVersion_" + nugetVersion + ".zip",
"releaseNotes:releasenotes.md"
});

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("build/GitVersion_" + nugetVersion + ".zip");
AppVeyor.UploadArtifact("build/GemBuild/" + gem);
});


Task("Travis")
.IsDependentOn("Run-NUnit-Tests");

Task("Default")
.IsDependentOn("Upload-AppVeyor-Artifacts");

RunTarget(target);
Loading