Skip to content

Commit eab0106

Browse files
author
Simona Avornicesei
committed
ccnet#267 Integrate with AppVeyor
- added cake - added versioning based on GitVersion - added appVeyor build script - update NAnt .xsd schema url
1 parent eb45d5c commit eab0106

21 files changed

+219
-68
lines changed

.appveyor.yml

+16-5
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,29 @@ image: Visual Studio 2017
66
#---------------------------------#
77
# build configuration #
88
#---------------------------------#
9+
platform: Any CPU
10+
configuration: Release
11+
912
build_script:
10-
- cmd: build.bat
13+
- ps: build.ps1 --target=build
1114

1215
#---------------------------------#
1316
# tests configuration #
1417
#---------------------------------#
1518
test_script:
16-
- cmd: build-tests.bat
17-
after_test:
18-
- cmd:
19+
- ps: build.ps1 --target=run-tests
20+
build_success:
21+
- ps: build.ps1 --target=package
1922

2023

2124
#---------------------------------#
2225
# artifacts configuration #
23-
#---------------------------------#
26+
#---------------------------------#
27+
artifacts:
28+
- path: 'Publish\**'
29+
30+
#---------------------------------#
31+
# global handlers #
32+
#---------------------------------#
33+
on_success:
34+
- ps: Write-Host 'Succesfuly build'

.gitignore

+8-1
Original file line numberDiff line numberDiff line change
@@ -359,4 +359,11 @@ MigrationBackup/
359359
_site/
360360
.sass-cache/
361361
.jekyll-cache/
362-
.jekyll-metadata
362+
.jekyll-metadata
363+
364+
#Rider
365+
.idea/
366+
367+
#cake
368+
Tools/Cake/*
369+
!Tools/Cake/packages.config

README.md

+48-8
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,64 @@ Releases up to 1.8.5 can be downloaded from [sourceforge.net](https://sourceforg
99
## How to build
1010
We provide the following build scripts with CruiseControl.NET:
1111

12-
1. ```build.bat/.sh```
12+
### Windows
13+
1. ```ps build.ps1 --target=default```
1314

14-
Use this if you want to specify a special target to build.
15-
Example: ```$ build.sh myNAntTargetToRun```
15+
It will display the existing targets in the cake build script.
1616

17-
2. ```build-all.bat/sh```
17+
2. ```ps build.ps1 --target=build```
1818

19-
This is the same target that runs on our build server.
19+
Use this if you want to build the project.
20+
21+
3. ```ps build.ps1 --target=build-all```
22+
23+
Full build, including running tests, doing some code analysis and packaging artifacts.
2024
Cleanup -> Init -> Build -> Unit Tests -> code Analysis -> Packaging
2125

22-
3. ```build-tests.bat/sh```
26+
4. ```ps build.ps1 --target=run-tests```
2327

24-
This will call only the runUnitTests target in our NAnt script.
28+
This will call only the runUnitTests target in ccnet.build script.
2529
Cleanup -> Init -> Build -> Unit Tests
2630

27-
4. ```build-package.bat/sh```
31+
5. ```ps build.ps1 --target=package```
2832

2933
This only build and package the CruiseControl.NET distribution.
3034
Cleanup -> Init -> Build -> Packaging
3135

3236
The packaged distribution can be found in the "Publish" folder.
37+
38+
6. ```ps build.ps1 --target=web-packages```
39+
40+
This builds and packages the project WebDashboards.
41+
42+
### Linux
43+
If you just cloned the CruiseControl.NET repository, run ```chmod u+x build.sh``` so you have execute permission on the build script.
44+
45+
1. ```./build.sh --target=default```
46+
47+
It will display the existing targets in the cake build script.
48+
49+
2. ```./build.sh --target=build```
50+
51+
Use this if you want to build the project.
52+
53+
3. ```./build.sh --target=build-all```
54+
55+
Full build, including running tests, doing some code analysis and packaging artifacts.
56+
Cleanup -> Init -> Build -> Unit Tests -> code Analysis -> Packaging
57+
58+
4. ```./build.sh --target=run-tests```
59+
60+
This will call only the runUnitTests target in ccnet.build script.
61+
Cleanup -> Init -> Build -> Unit Tests
62+
63+
5. ```./build.sh --target=package```
64+
65+
This only build and package the CruiseControl.NET distribution.
66+
Cleanup -> Init -> Build -> Packaging
67+
68+
The packaged distribution can be found in the "Publish" folder.
69+
70+
6. ```./build.sh --target=web-packages```
71+
72+
This builds and packages the project WebDashboards.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Cake" version="0.33.0" />
4-
</packages>
4+
</packages>

Tools/ccnet-help.inc.build

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22

3-
<project name="CruiseControl.NET" xmlns="http://nant.sf.net/release/0.86-beta1/nant.xsd">
3+
<project name="CruiseControl.NET" xmlns="http://nant.sourceforge.net/release/0.92/nant.xsd">
44

55
<target name="showHelp" description="Shows available targets">
66
<echo message="Major targets :" />
@@ -18,8 +18,12 @@
1818
<echo message=" ==> ${nant.verbosity} "/>
1919
<echo message=" build.target.framework : build agains this framework "/>
2020
<echo message=" ==> ${build.target.framework} "/>
21-
<echo message=" CCNetLabel : the label generated by CCNet"/>
22-
<echo message=" ==> ${CCNetLabel} "/>
21+
<echo message=" version : project official/ assembly version in the Major.Minor.Patch format"/>
22+
<echo message=" ==> ${version} "/>
23+
<echo message=" fversion : project assembly file version in the Major.Minor.Patch.Revision format"/>
24+
<echo message=" ==> ${fversion} "/>
25+
<echo message=" iversion : project assembly file informal version, containing Git branch and commit sha-1"/>
26+
<echo message=" ==> ${iversion} "/>
2327
<echo message=" codemetrics.output.type: output format of the tools"/>
2428
<echo message=" ==> ${codemetrics.output.type} "/>
2529
<echo message=" gendarme.project : the assemblylist file used by gendarme"/>

Tools/ccnet-packaging-webdashboard-packages.inc.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22

3-
<project name="CruiseControl.NET" xmlns="http://nant.sf.net/release/0.86-beta1/nant.xsd">
3+
<project name="CruiseControl.NET" xmlns="http://nant.sourceforge.net/release/0.92/nant.xsd">
44

55
<target name="build.packages" description="Generates the dashboard packages"
66
depends="farm.level.packages,server.level.packages,project.level.packages,build.level.packages,theme.packages">

Tools/ccnet-packaging.inc.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22

3-
<project name="CruiseControl.NET" xmlns="http://nant.sf.net/release/0.86-beta1/nant.xsd">
3+
<project name="CruiseControl.NET" xmlns="http://nant.sourceforge.net/release/0.92/nant.xsd">
44

55
<!-- properties -->
66
<property name="webdashboard.dist.dir" value="${path::combine(dist.dir, 'WebDashboard')}" />

Tools/ccnet-utils.inc.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22

3-
<project name="CruiseControl.NET" xmlns="http://nant.sf.net/release/0.86-beta1/nant.xsd">
3+
<project name="CruiseControl.NET" xmlns="http://nant.sourceforge.net/release/0.92/nant.xsd">
44

55
<target name="cleanupDocsDictionary" description="Delete all files in the docs dictionary.">
66

build-all.bat

-5
This file was deleted.

build-all.sh

-2
This file was deleted.

build-package.bat

-5
This file was deleted.

build-prj.bat

-8
This file was deleted.

build-prj.sh

-2
This file was deleted.

build-tests.bat

-5
This file was deleted.

build-tests.sh

-2
This file was deleted.

build-web-packages.bat

-5
This file was deleted.

build.cake

+124-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,133 @@
55

66
#tool "nuget:?package=GitVersion.CommandLine&version=4.0.0"
77

8-
var target = Argument("target", "Default");
8+
//////////////////////////////////////////////////////////////////////
9+
// VARIABLES
10+
//////////////////////////////////////////////////////////////////////
11+
// Project details
12+
var product = "CruiseControl.NET";
13+
14+
var target = Argument("target", "default");
15+
var configuration = Argument("configuration", "Debug");
16+
var verbosity = Argument("verbosity", "Normal");
17+
18+
var nantExe = @".\Tools\NAnt\NAnt.exe";
19+
GitVersion gitVersionResults;
20+
21+
///////////////////////////////////////////////////////////////////////////////
22+
// SETUP / TEARDOWN
23+
///////////////////////////////////////////////////////////////////////////////
24+
25+
//NOTE: Executed BEFORE the first task.
26+
Setup(context =>
27+
{
28+
Information("Determine build environment");
29+
30+
Information("Determine build version");
31+
gitVersionResults = GitVersion(new GitVersionSettings());
32+
33+
Information("Building version {0} of {1}.", gitVersionResults.InformationalVersion, product);
34+
Information("Target: {0}.", target);
35+
});
936

10-
Task("Default")
37+
// NOTE: Executed AFTER the last task.
38+
Teardown(context =>
39+
{
40+
Information("Finished building version {0} of {1}.", gitVersionResults.InformationalVersion, product);
41+
});
42+
43+
44+
Task("default")
1145
.Does(() =>
1246
{
13-
Information("Hello World!");
47+
Information("Available targets");
48+
Information(" build : Builds the project by running the clean and build targets from ccnet.build script");
49+
Information(" build-all : Builds the project, runs tests and packages artifacts by running the all target from ccnet.build script");
50+
Information(" run-tests : Run projects tests by executing the runTests target from ccnet.build script");
51+
Information(" package : Packages project artifacts by running package target from ccnet.build script");
52+
Information(" web-packages : Packages the project webdashboards by running build.packages from ccnet.build script");
1453
});
1554

55+
Task("build")
56+
.Does(()=> {
57+
//Tools\NAnt\NAnt.exe clean build -buildfile:ccnet.build -D:codemetrics.output.type=HtmlFile -nologo -logfile:nant-build.log.txt %*
58+
using(var process = StartAndReturnProcess(nantExe,
59+
new ProcessSettings{
60+
Arguments = " clean build -buildfile:ccnet.build -D:codemetrics.output.type=HtmlFile -D:version=" + gitVersionResults.AssemblySemVer + " -D:fversion=" + gitVersionResults.AssemblySemFileVer + " -D:iversion=\"" + gitVersionResults.InformationalVersion + "\" -nologo -logfile:nant-build.log.txt %*" ,
61+
RedirectStandardError = false,
62+
RedirectStandardOutput = false,
63+
Silent = false
64+
}))
65+
{
66+
process.WaitForExit();
67+
// This should output 0 as valid arguments supplied
68+
Information("Exit code: {0}", process.GetExitCode());
69+
}
70+
});
71+
72+
Task("build-all")
73+
.Does(()=> {
74+
//Tools\NAnt\NAnt.exe clean build -buildfile:ccnet.build -D:codemetrics.output.type=HtmlFile -nologo -logfile:nant-build.log.txt %*
75+
using(var process = StartAndReturnProcess(nantExe,
76+
new ProcessSettings{
77+
Arguments = " all -buildfile:ccnet.build -D:codemetrics.output.type=HtmlFile -D:version=" + gitVersionResults.AssemblySemVer + " -D:fversion=" + gitVersionResults.AssemblySemFileVer + " -D:iversion=\"" + gitVersionResults.InformationalVersion + "\" -nologo -logfile:nant-build.log.txt %*" ,
78+
RedirectStandardError = false,
79+
RedirectStandardOutput = false,
80+
Silent = false
81+
}))
82+
{
83+
process.WaitForExit();
84+
// This should output 0 as valid arguments supplied
85+
Information("Exit code: {0}", process.GetExitCode());
86+
}
87+
});
88+
89+
Task("run-tests")
90+
.Does(()=>{
91+
//Tools\NAnt\NAnt.exe runTests -buildfile:ccnet.build -D:codemetrics.output.type=HtmlFile -nologo -logfile:nant-build-tests.log.txt %*
92+
using(var process = StartAndReturnProcess(nantExe,
93+
new ProcessSettings{
94+
Arguments = " runTests -buildfile:ccnet.build -D:codemetrics.output.type=HtmlFile -D:version=" + gitVersionResults.AssemblySemVer + " -D:fversion=" + gitVersionResults.AssemblySemFileVer + " -D:iversion=\"" + gitVersionResults.InformationalVersion + "\" -nologo -logfile:nant-build-tests.log.txt %*" ,
95+
RedirectStandardError = false,
96+
RedirectStandardOutput = false,
97+
}))
98+
{
99+
process.WaitForExit();
100+
// This should output 0 as valid arguments supplied
101+
Information("Exit code: {0}", process.GetExitCode());
102+
}
103+
});
104+
105+
Task("package")
106+
.Does(()=>{
107+
//Tools\NAnt\NAnt.exe package -buildfile:ccnet.build -D:CCNetLabel=1.5.0.0 -nologo -logfile:nant-build-package.log.txt %*
108+
using(var process = StartAndReturnProcess(nantExe,
109+
new ProcessSettings{
110+
Arguments = " package -buildfile:ccnet.build -D:version=" + gitVersionResults.AssemblySemVer + " -D:fversion=" + gitVersionResults.AssemblySemFileVer + " -D:iversion=\"" + gitVersionResults.InformationalVersion + "\" -nologo -logfile:nant-build-package.log.txt %*" ,
111+
RedirectStandardError = false,
112+
RedirectStandardOutput = false,
113+
}))
114+
{
115+
process.WaitForExit();
116+
// This should output 0 as valid arguments supplied
117+
Information("Exit code: {0}", process.GetExitCode());
118+
}
119+
});
120+
121+
Task("web-packages")
122+
.Does(()=>{
123+
//Tools\NAnt\NAnt.exe build.packages -buildfile:ccnet.build -nologo -logfile:nant-build-web-packages.log.txt %*
124+
using(var process = StartAndReturnProcess(nantExe,
125+
new ProcessSettings{
126+
Arguments = " build.packages -buildfile:ccnet.build -D:version=" + gitVersionResults.AssemblySemVer + " -D:fversion=" + gitVersionResults.AssemblySemFileVer + " -D:iversion=\"" + gitVersionResults.InformationalVersion + "\" -nologo -logfile:nant-build-web-packages.log.txt %*" ,
127+
RedirectStandardError = false,
128+
RedirectStandardOutput = false,
129+
}))
130+
{
131+
process.WaitForExit();
132+
// This should output 0 as valid arguments supplied
133+
Information("Exit code: {0}", process.GetExitCode());
134+
}
135+
});
136+
16137
RunTarget(target);

build.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ if(!$PSScriptRoot){
104104
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
105105
}
106106

107-
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
107+
$TOOLS_DIR = Join-Path $PSScriptRoot "Tools" "Cake"
108108
$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
109109
$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
110110
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"

build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# Define directories.
1010
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
11-
TOOLS_DIR=$SCRIPT_DIR/tools
11+
TOOLS_DIR=$SCRIPT_DIR/Tools/Cake
1212
ADDINS_DIR=$TOOLS_DIR/Addins
1313
MODULES_DIR=$TOOLS_DIR/Modules
1414
NUGET_EXE=$TOOLS_DIR/nuget.exe

cake.config

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ UseInProcessClient=true
66
LoadDependencies=false
77

88
[Paths]
9-
Tools=./tools
10-
Addins=./tools/Addins
11-
Modules=./tools/Modules
9+
Tools=./Tools/Cake
10+
Addins=./Tools/Cake/Addins
11+
Modules=./Tools/Cake/Modules
1212

1313
[Settings]
1414
SkipVerification=true

0 commit comments

Comments
 (0)