Skip to content
This repository has been archived by the owner on Oct 12, 2019. It is now read-only.

add ci pipelines #2

Merged
merged 1 commit into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
111 changes: 111 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
* Install addins.
*/
#addin "nuget:?package=Cake.Coverlet&version=2.2.1"
#addin "nuget:?package=Cake.Json&version=3.0.1"
#addin "nuget:?package=Newtonsoft.Json&version=11.0.2"
#addin "nuget:?package=Cake.Gitter&version=0.11.0"

/*
* Install tools.
*/
#tool "nuget:?package=GitReleaseNotes&version=0.7.1"
#tool "nuget:?package=GitVersion.CommandLine&version=4.0.0"
#tool "nuget:?package=ReportGenerator&version=4.1.5"
#tool "nuget:?package=xunit.runner.console&version=2.4.1"

/*
* Variables
*/
bool publishingError = false;
DirectoryPath artifactDir = (DirectoryPath)Directory("./.artifacts");

/*
* Tasks
*/
Task("Clean")
.Does(() =>
{
CleanDirectory(artifactDir.FullPath);

CleanDirectories($"./**/bin/{configuration}");
CleanDirectories("./**/obj");
});

Task("Restore")
.IsDependentOn("Clean")
.Does(() =>
{
foreach (var project in GetFiles("./**/*.csproj"))
{
DotNetCoreRestore(project.FullPath);
}
});

Task("Build")
.IsDependentOn("Restore")
.Does(() =>
{
DotNetCoreBuildSettings settings = new DotNetCoreBuildSettings
{
NoRestore = true,
Configuration = configuration
};

foreach (var project in GetFiles("./src/**/*.csproj"))
{
DotNetCoreBuild(project.FullPath, settings);
}
});

Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
DotNetCoreTestSettings settings = new DotNetCoreTestSettings
{
Configuration = configuration
};

foreach (var project in GetFiles("./test/**/*.csproj"))
{
DotNetCoreTest(project.FullPath, settings);
}
});

Task("Pack")
.IsDependentOn("Test")
.Does(() =>
{
DotNetCorePackSettings settings = new DotNetCorePackSettings
{
NoBuild = true,
Configuration = configuration
};

foreach (var project in GetFiles("./src/**/*.csproj"))
{
DotNetCorePack(project.FullPath, settings);
}
});

Task("Copy")
.IsDependentOn("Pack")
.Does(() =>
{
CopyFiles(GetFiles("./src/**/*.nupkg"), artifactDir.FullPath);
});

Task("Default")
.IsDependentOn("Copy")
.Does(() =>
{

});

/*
* Execution
*/
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
RunTarget(target);
2 changes: 2 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@ECHO OFF
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE"
Loading