Skip to content

Commit

Permalink
Merge pull request #58 from remyvd/changeDeploymentModel
Browse files Browse the repository at this point in the history
ISO 4217 Amendment Number 165 and Deconstructers
  • Loading branch information
Rémy van Duijkeren authored Dec 17, 2017
2 parents 42cae62 + 6dcc51f commit c85d7fe
Show file tree
Hide file tree
Showing 26 changed files with 563 additions and 1,202 deletions.
5 changes: 2 additions & 3 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
mode: ContinuousDeployment
continuous-delivery-fallback-tag: rc
mode: ContinuousDelivery
next-version: 1.0.0
branches: {}
ignore:
sha: []
sha: []
403 changes: 0 additions & 403 deletions NodaMoney.sln.DotSettings

This file was deleted.

8 changes: 1 addition & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,4 @@ deploy:
#---------------------------------#
# notifications #
#---------------------------------#
notifications:
- provider: Slack
incoming_webhook:
secure: HzeM1/SGr4DgedFcdh1D17XdOCLKRG81irFVeMPTC5rg7O/WRFm0xEIJgOs92wb7UrOqQIe4dWujPHAVC8mCcmMPZ/U4dYDwvCUC6Jkltxc=
on_build_success: false
on_build_failure: false
on_build_status_changed: true
notifications:
74 changes: 66 additions & 8 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#tool "xunit.runner.console"
#tool "GitVersion.CommandLine"
#addin "Cake.Figlet"
#tool nuget:?package=xunit.runner.console
#tool nuget:?package=GitVersion.CommandLine
#tool nuget:?package=OpenCover
#tool nuget:?package=coveralls.net
#addin nuget:?package=Cake.Figlet
#addin nuget:?package=Cake.Coveralls

var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
Expand Down Expand Up @@ -74,12 +77,14 @@ Task("Build")
.IsDependentOn("Version")
.Does(() =>
{
DotNetCoreBuild(solutionFile, new DotNetCoreBuildSettings { Configuration = configuration });
DotNetCoreBuild(solutionFile, new DotNetCoreBuildSettings
{
Configuration = configuration,
ArgumentCustomization = arg => arg.AppendSwitch("/p:DebugType","=","Full") // needed for OpenCover
});
});

Task("Test")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.IsDependentOn("Build")
.Does(() =>
{
Expand All @@ -89,10 +94,31 @@ Task("Test")
}
});

Task("Package")
.IsDependentOn("Build")
Task("Coverage")
.IsDependentOn("Test")
.Does(() =>
{
var openCoverSettings = new OpenCoverSettings
{
OldStyle = true,
MergeOutput = true
}
.WithFilter("+[NodaMoney*]* -[*.Tests*]*");

var xunit2Settings = new XUnit2Settings { ShadowCopy = false };

foreach(var testLib in GetFiles("./tests/**/bin/Release/*/NodaMoney*.Tests.dll"))
{
OpenCover(
context => { context.XUnit2(testLib.FullPath, xunit2Settings); },
artifactsDir.Path + "/coverage.xml",
openCoverSettings);
}
});

Task("Package")
.IsDependentOn("Coverage")
.Does(() =>
{
var packSettings = new DotNetCorePackSettings
{
Expand All @@ -107,6 +133,36 @@ Task("Package")
}
});

Task("Upload-Coverage-CoverallsIo")
.WithCriteria(() => HasEnvironmentVariable("COVERALLS_REPO_TOKEN"))
.WithCriteria(() => !AppVeyor.Environment.PullRequest.IsPullRequest)
.IsDependentOn("Coverage")
.Does(() =>
{
if (AppVeyor.IsRunningOnAppVeyor)
{
CoverallsNet(artifactsDir.Path + "/coverage.xml", CoverallsNetReportType.OpenCover, new CoverallsNetSettings()
{
RepoToken = EnvironmentVariable("COVERALLS_REPO_TOKEN"),
CommitId = AppVeyor.Environment.Repository.Commit.Id,
CommitBranch = AppVeyor.Environment.Repository.Branch,
CommitAuthor = AppVeyor.Environment.Repository.Commit.Author,
CommitEmail = AppVeyor.Environment.Repository.Commit.Email,
CommitMessage = AppVeyor.Environment.Repository.Commit.Message,
JobId = Convert.ToInt32(EnvironmentVariable("APPVEYOR_BUILD_NUMBER")),
ServiceName = "appveyor"
});
}
else
{
CoverallsNet(artifactsDir.Path + "/coverage.xml", CoverallsNetReportType.OpenCover, new CoverallsNetSettings()
{
RepoToken = EnvironmentVariable("COVERALLS_REPO_TOKEN"),
ServiceName = "local"
});
}
});

Task("Upload-AppVeyor-Artifacts")
.WithCriteria(() => AppVeyor.IsRunningOnAppVeyor)
.WithCriteria(() => !AppVeyor.Environment.PullRequest.IsPullRequest)
Expand All @@ -122,6 +178,7 @@ Task("Upload-AppVeyor-Artifacts")
Task("Publish-NuGet")
.WithCriteria(() => HasEnvironmentVariable("NUGET_API_KEY"))
.WithCriteria(() => AppVeyor.Environment.Repository.Branch == "master")
.WithCriteria(() => AppVeyor.Environment.Repository.Tag.IsTag)
.IsDependentOn("Package")
.Does(() =>
{
Expand All @@ -139,6 +196,7 @@ Task("Default")
Task("AppVeyor")
.IsDependentOn("Package")
.IsDependentOn("Upload-AppVeyor-Artifacts")
.IsDependentOn("Upload-Coverage-CoverallsIo")
.IsDependentOn("Publish-NuGet");

RunTarget(target);
80 changes: 43 additions & 37 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ The build script target to run.
The build configuration to use.
.PARAMETER Verbosity
Specifies the amount of information to be displayed.
.PARAMETER ShowDescription
Shows description about tasks.
.PARAMETER DryRun
Performs a dry run.
.PARAMETER Experimental
Tells Cake to use the latest Roslyn release.
.PARAMETER WhatIf
Performs a dry run of the build script.
No tasks will be executed.
Uses the nightly builds of the Roslyn script engine.
.PARAMETER Mono
Tells Cake to use the Mono scripting engine.
Uses the Mono Compiler rather than the Roslyn script engine.
.PARAMETER SkipToolPackageRestore
Skips restoring of packages.
.PARAMETER ScriptArgs
Expand All @@ -41,14 +42,14 @@ https://cakebuild.net
[CmdletBinding()]
Param(
[string]$Script = "build.cake",
[string]$Target = "Default",
[ValidateSet("Release", "Debug")]
[string]$Configuration = "Release",
[string]$Target,
[string]$Configuration,
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
[string]$Verbosity = "Verbose",
[string]$Verbosity,
[switch]$ShowDescription,
[Alias("WhatIf", "Noop")]
[switch]$DryRun,
[switch]$Experimental,
[Alias("DryRun","Noop")]
[switch]$WhatIf,
[switch]$Mono,
[switch]$SkipToolPackageRestore,
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
Expand Down Expand Up @@ -80,6 +81,15 @@ function MD5HashFile([string] $filePath)
}
}

function GetProxyEnabledWebClient
{
$wc = New-Object System.Net.WebClient
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$wc.Proxy = $proxy
return $wc
}

Write-Host "Preparing to run build script..."

if(!$PSScriptRoot){
Expand All @@ -97,26 +107,6 @@ $PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"

# Should we use mono?
$UseMono = "";
if($Mono.IsPresent) {
Write-Verbose -Message "Using the Mono based scripting engine."
$UseMono = "-mono"
}

# Should we use the new Roslyn?
$UseExperimental = "";
if($Experimental.IsPresent -and !($Mono.IsPresent)) {
Write-Verbose -Message "Using experimental version of Roslyn."
$UseExperimental = "-experimental"
}

# Is this a dry run?
$UseDryRun = "";
if($WhatIf.IsPresent) {
$UseDryRun = "-dryrun"
}

# Make sure tools folder exists
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
Write-Verbose -Message "Creating tools directory..."
Expand All @@ -125,8 +115,10 @@ if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {

# Make sure that packages.config exist.
if (!(Test-Path $PACKAGES_CONFIG)) {
Write-Verbose -Message "Downloading packages.config..."
try { (New-Object System.Net.WebClient).DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch {
Write-Verbose -Message "Downloading packages.config..."
try {
$wc = GetProxyEnabledWebClient
$wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch {
Throw "Could not download packages.config."
}
}
Expand All @@ -146,7 +138,8 @@ if (!(Test-Path $NUGET_EXE)) {
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Downloading NuGet.exe..."
try {
(New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE)
$wc = GetProxyEnabledWebClient
$wc.DownloadFile($NUGET_URL, $NUGET_EXE)
} catch {
Throw "Could not download NuGet.exe."
}
Expand Down Expand Up @@ -179,7 +172,7 @@ if(-Not $SkipToolPackageRestore.IsPresent) {
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
}
Write-Verbose -Message ($NuGetOutput | out-string)

Pop-Location
}

Expand Down Expand Up @@ -222,7 +215,20 @@ if (!(Test-Path $CAKE_EXE)) {
Throw "Could not find Cake.exe at $CAKE_EXE"
}



# Build Cake arguments
$cakeArguments = @("$Script");
if ($Target) { $cakeArguments += "-target=$Target" }
if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
if ($ShowDescription) { $cakeArguments += "-showdescription" }
if ($DryRun) { $cakeArguments += "-dryrun" }
if ($Experimental) { $cakeArguments += "-experimental" }
if ($Mono) { $cakeArguments += "-mono" }
$cakeArguments += $ScriptArgs

# Start Cake
Write-Host "Running build script..."
Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
exit $LASTEXITCODE
&$CAKE_EXE $cakeArguments
exit $LASTEXITCODE
36 changes: 3 additions & 33 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@
# Define directories.
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
TOOLS_DIR=$SCRIPT_DIR/tools
ADDINS_DIR=$TOOLS_DIR/Addins
MODULES_DIR=$TOOLS_DIR/Modules
NUGET_EXE=$TOOLS_DIR/nuget.exe
CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe
PACKAGES_CONFIG=$TOOLS_DIR/packages.config
PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum
ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config
MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config

# Define md5sum or md5 depending on Linux/OSX
MD5_EXE=
Expand Down Expand Up @@ -77,46 +73,20 @@ fi

# Restore tools from NuGet.
pushd "$TOOLS_DIR" >/dev/null
if [ ! -f "$PACKAGES_CONFIG_MD5" ] || [ "$( cat "$PACKAGES_CONFIG_MD5" | sed 's/\r$//' )" != "$( $MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' )" ]; then
if [ ! -f $PACKAGES_CONFIG_MD5 ] || [ "$( cat $PACKAGES_CONFIG_MD5 | sed 's/\r$//' )" != "$( $MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' )" ]; then
find . -type d ! -name . | xargs rm -rf
fi

mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet tools."
echo "Could not restore NuGet packages."
exit 1
fi

$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5"
$MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' >| $PACKAGES_CONFIG_MD5

popd >/dev/null

# Restore addins from NuGet.
if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then
pushd "$ADDINS_DIR" >/dev/null

mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet addins."
exit 1
fi

popd >/dev/null
fi

# Restore modules from NuGet.
if [ -f "$MODULES_PACKAGES_CONFIG" ]; then
pushd "$MODULES_DIR" >/dev/null

mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet modules."
exit 1
fi

popd >/dev/null
fi

# Make sure that Cake has been installed.
if [ ! -f "$CAKE_EXE" ]; then
echo "Could not find Cake.exe at '$CAKE_EXE'."
Expand Down
6 changes: 3 additions & 3 deletions src/Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<PackageLicenseUrl>https://github.com/remyvd/NodaMoney/blob/master/LICENSE.txt</PackageLicenseUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/remyvd/NodaMoney</RepositoryUrl>
<Version>1.0.1-extend-plus-oper0018</Version>
<Version>1.0.2-changedeployment0001</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.1.0</FileVersion>
<InformationalVersion>1.0.1-extend-plus-operator.18</InformationalVersion>
<FileVersion>1.0.2.0</FileVersion>
<InformationalVersion>1.0.2-changeDeploymentModel.1+13</InformationalVersion>
</PropertyGroup>
</Project>
Loading

0 comments on commit c85d7fe

Please sign in to comment.