-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1485 from arturcic/feature/build-scripts
Build scripts for Packaging and Publishing GitVersion
- Loading branch information
Showing
64 changed files
with
3,499 additions
and
432 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,17 +1,20 @@ | ||
language: csharp | ||
sudo: required | ||
dist: trusty | ||
dotnet: 2.1.105 | ||
dotnet: 2.1.401 | ||
mono: | ||
- latest | ||
os: | ||
- linux | ||
- osx | ||
before_install: | ||
- git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags | ||
- git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags | ||
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" | ||
- git fetch origin | ||
- bash <(wget -O - https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.sh) | ||
script: | ||
- ./build.sh -v Diagnostic | ||
- pwsh ./run.ps1 -script run.cake -target Default | ||
env: | ||
global: | ||
- DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | ||
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
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,18 +1,15 @@ | ||
image: Visual Studio 2017 | ||
install: | ||
npm i -g tfx-cli | ||
|
||
assembly_info: | ||
patch: false | ||
|
||
configuration: | ||
- Debug | ||
install: | ||
- set PATH=C:\Ruby25-x64\bin;%PATH% | ||
|
||
build_script: | ||
- ps: .\build.ps1 | ||
- pwsh: ./run.ps1 -script run.cake -target Default | ||
|
||
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 |
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,37 @@ | ||
jobs: | ||
- job: macOS | ||
pool: | ||
vmImage: 'macOS 10.13' | ||
steps: | ||
- task: DotNetCoreInstaller@0 | ||
displayName: 'Use .NET Core sdk 2.1.401' | ||
inputs: | ||
version: 2.1.401 | ||
- powershell: ./run.ps1 -script run.cake -target Default | ||
displayName: 'Cake build' | ||
- job: Linux | ||
pool: | ||
vmImage: 'Ubuntu 16.04' | ||
steps: | ||
- task: DotNetCoreInstaller@0 | ||
displayName: 'Use .NET Core sdk 2.1.401' | ||
inputs: | ||
version: 2.1.401 | ||
- task: UseRubyVersion@0 | ||
inputs: | ||
addToPath: true # Optional | ||
- powershell: ./run.ps1 -script run.cake -target Default | ||
displayName: 'Cake build' | ||
- job: Windows | ||
pool: | ||
vmImage: 'VS2017-Win2016' | ||
steps: | ||
- task: DotNetCoreInstaller@0 | ||
displayName: 'Use .NET Core sdk 2.1.401' | ||
inputs: | ||
version: 2.1.401 | ||
- task: UseRubyVersion@0 | ||
inputs: | ||
addToPath: true # Optional | ||
- powershell: ./run.ps1 -script run.cake -target Default | ||
displayName: 'Cake build' |
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 |
---|---|---|
@@ -0,0 +1,95 @@ | ||
public class BuildPackages | ||
{ | ||
public ICollection<BuildPackage> All { get; private set; } | ||
public ICollection<BuildPackage> Nuget { get; private set; } | ||
public ICollection<BuildPackage> Chocolatey { get; private set; } | ||
|
||
public static BuildPackages GetPackages( | ||
DirectoryPath nugetRooPath, | ||
string semVersion, | ||
string[] packageIds, | ||
string[] chocolateyPackageIds) | ||
{ | ||
var toNugetPackage = BuildPackage(nugetRooPath, semVersion); | ||
var toChocolateyPackage = BuildPackage(nugetRooPath, semVersion, isChocolateyPackage: true); | ||
var nugetPackages = packageIds.Select(toNugetPackage).ToArray(); | ||
var chocolateyPackages = chocolateyPackageIds.Select(toChocolateyPackage).ToArray(); | ||
|
||
return new BuildPackages { | ||
All = nugetPackages.Union(chocolateyPackages).ToArray(), | ||
Nuget = nugetPackages, | ||
Chocolatey = chocolateyPackages | ||
}; | ||
} | ||
|
||
private static Func<string, BuildPackage> BuildPackage( | ||
DirectoryPath nugetRooPath, | ||
string semVersion, | ||
bool isChocolateyPackage = false) | ||
{ | ||
return package => new BuildPackage( | ||
id: package, | ||
nuspecPath: string.Concat("./nuspec/", package, ".nuspec"), | ||
packagePath: nugetRooPath.CombineWithFilePath(string.Concat(package, ".", semVersion, ".nupkg")), | ||
isChocolateyPackage: isChocolateyPackage); | ||
} | ||
} | ||
|
||
public class BuildPackage | ||
{ | ||
public string Id { get; private set; } | ||
public FilePath NuspecPath { get; private set; } | ||
public FilePath PackagePath { get; private set; } | ||
public bool IsChocolateyPackage { get; private set; } | ||
public string PackageName { get; private set; } | ||
|
||
|
||
public BuildPackage( | ||
string id, | ||
FilePath nuspecPath, | ||
FilePath packagePath, | ||
bool isChocolateyPackage) | ||
{ | ||
Id = id; | ||
NuspecPath = nuspecPath; | ||
PackagePath = packagePath; | ||
IsChocolateyPackage = isChocolateyPackage; | ||
PackageName = PackagePath.GetFilename().ToString(); | ||
} | ||
} | ||
|
||
public class BuildArtifacts | ||
{ | ||
public ICollection<BuildArtifact> All { get; private set; } | ||
|
||
public static BuildArtifacts GetArtifacts(FilePath[] artifacts) | ||
{ | ||
var toBuildArtifact = BuildArtifact("build-artifact"); | ||
var buildArtifacts = artifacts.Select(toBuildArtifact).ToArray(); | ||
|
||
return new BuildArtifacts { | ||
All = buildArtifacts.ToArray(), | ||
}; | ||
} | ||
|
||
private static Func<FilePath, BuildArtifact> BuildArtifact(string containerName) | ||
{ | ||
return artifactPath => new BuildArtifact(containerName: containerName, artifactPath: artifactPath); | ||
} | ||
} | ||
|
||
public class BuildArtifact | ||
{ | ||
public string ContainerName { get; private set; } | ||
public FilePath ArtifactPath { get; private set; } | ||
public string ArtifactName { get; private set; } | ||
|
||
public BuildArtifact( | ||
string containerName, | ||
FilePath artifactPath) | ||
{ | ||
ContainerName = containerName; | ||
ArtifactPath = artifactPath.FullPath; | ||
ArtifactName = ArtifactPath.GetFilename().ToString(); | ||
} | ||
} |
Oops, something went wrong.