-
Notifications
You must be signed in to change notification settings - Fork 3
/
RakeFile
75 lines (61 loc) · 2.27 KB
/
RakeFile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
require 'fileutils'
require 'rubygems'
require 'albacore'
require 'yaml'
def build_settings
YAML.load_file('./Build/buildSettings.yml')
end
def get_build_output
File.join(FileUtils.pwd , build_settings['buildOutputDirectoryName'])
end
require './Build/teamcity.rb'
task :default => 'test:run_all_tests'
configuration = ENV['configuration'] || 'Debug'
log_level = :verbose
build_command = File.join(ENV['windir'], 'Microsoft.NET', 'Framework', build_settings['dotNetFramework'], 'MSBuild.exe')
namespace :build do
desc 'Clean build output directory'
task :clean_build_output do
FileUtils.rm_rf get_build_output
FileUtils.mkdir_p get_build_output
end
desc 'Build the solution'
msbuild :build_solution => ['build:clean_build_output'] do |msb|
msb.log_level = log_level
msb.command = build_command
msb.properties = { :configuration => configuration, :platform => 'x86', :outputpath => get_build_output }
msb.targets :Rebuild
msb.solution = build_settings['solutionFilePath']
end
end
namespace :test do
desc "Create test results output directory"
task :create_test_output_dir do
mkdir_p 'Artefacts/nUnitTestResults'
end
desc "Create spec results directory"
task :create_mspec_directory do
mkdir_p('Artefacts/SpecResults/')
end
desc "Run all tests"
task :run_all_tests => ['build:build_solution'] do
Rake::Task["test:run_unit_tests"].invoke unless (build_settings['nunit_test_assemblies'].nil?)
Rake::Task["test:run_specs"].invoke unless (build_settings['mspec_test_assemblies'].nil?)
end
desc "Run the unit tests"
nunit :run_unit_tests => ['create_test_output_dir'] do |runner|
runner.log_level = log_level
runner.xml_output = 'Artefacts/nUnitTestResults/NUnit.Tests-results.xml'
runner.command = './Build/Tools/Nunit/nunit-console-x86.exe'
runner.assemblies = build_settings['nunit_test_assemblies']
end
desc "Run Machine.Specifications specs"
mspec :run_specs => ['create_mspec_directory'] do |runner|
runner.log_level = log_level
runner.command = './Build/Tools/mspec/mspec-clr4.exe'
runner.html_output = './Artefacts/SpecResults/index.html'
runner.assemblies build_settings['mspec_test_assemblies']
runner.parameters = '--teamcity'
runner.options '--exclude "Integration,Database"'
end
end