forked from braintree/braintree_dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
138 lines (109 loc) · 5.69 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
task :default => "test"
def use_verbose_mode
ENV["USE_VERBOSE_MODE"] ? " -v n" : ""
end
task :clean do
sh "rm -rf src/Braintree/bin"
sh "rm -rf src/Braintree/obj"
sh "rm -rf test/Braintree.Tests/bin"
sh "rm -rf test/Braintree.Tests/obj"
sh "rm -rf test/Braintree.TestUtil/bin"
sh "rm -rf test/Braintree.TestUtil/obj"
sh "rm -rf test/Braintree.Tests.Integration/bin"
sh "rm -rf test/Braintree.Tests.Integration/obj"
end
namespace :core do
task :compile => [:clean, "sanity:test"] do
sh "dotnet restore src/Braintree && dotnet build -f netstandard1.3 src/Braintree"
sh "dotnet restore test/Braintree.TestUtil && dotnet build -f netcoreapp1.0 test/Braintree.TestUtil"
sh "dotnet restore test/Braintree.Tests && dotnet build -f netcoreapp1.0 test/Braintree.Tests"
sh "dotnet restore test/Braintree.Tests.Integration && dotnet build -f netcoreapp1.0 test/Braintree.Tests.Integration"
end
desc "run tests"
namespace :test do
task :unit => [:compile] do
sh "dotnet test #{use_verbose_mode} test/Braintree.Tests/Braintree.Tests.csproj -f netcoreapp1.0"
end
task :integration => [:compile] do
sh "dotnet test #{use_verbose_mode} test/Braintree.Tests.Integration/Braintree.Tests.Integration.csproj -f netcoreapp1.0"
end
task :all => [:compile] do
sh "dotnet test #{use_verbose_mode} test/Braintree.Tests/Braintree.Tests.csproj -f netcoreapp1.0 && dotnet test test/Braintree.Tests.Integration/Braintree.Tests.Integration.csproj -f netcoreapp1.0"
end
end
namespace :test_focus do
desc "e.g. rake core:test_focus:unit[ToXml_IncludesDeviceData]"
task :unit, [:test_name] => [:compile] do |t, args|
sh "dotnet test #{use_verbose_mode} --filter Name~#{args[:test_name]} test/Braintree.Tests/Braintree.Tests.csproj -f netcoreapp1.0"
end
desc "e.g. rake core:test_focus:integration[Delete_DeletesPayPalAccount]"
task :integration, [:test_name] => [:compile] do |t, args|
sh "dotnet test #{use_verbose_mode} --filter Name~#{args[:test_name]} test/Braintree.Tests.Integration/Braintree.Tests.Integration.csproj -f netcoreapp1.0"
end
end
end
namespace :core2 do
task :compile => [:clean, "sanity:test"] do
sh "dotnet restore src/Braintree && dotnet build -f netstandard1.3 src/Braintree"
sh "dotnet restore test/Braintree.TestUtil && dotnet build -f netcoreapp2.0 test/Braintree.TestUtil"
sh "dotnet restore test/Braintree.Tests && dotnet build -f netcoreapp2.0 test/Braintree.Tests"
sh "dotnet restore test/Braintree.Tests.Integration && dotnet build -f netcoreapp2.0 test/Braintree.Tests.Integration"
end
desc "run tests"
namespace :test do
task :unit => [:compile] do
sh "dotnet test #{use_verbose_mode} test/Braintree.Tests/Braintree.Tests.csproj -f netcoreapp2.0"
end
task :integration => [:compile] do
sh "dotnet test #{use_verbose_mode} test/Braintree.Tests.Integration/Braintree.Tests.Integration.csproj -f netcoreapp2.0"
end
task :all => [:compile] do
sh "dotnet test #{use_verbose_mode} test/Braintree.Tests/Braintree.Tests.csproj -f netcoreapp2.0 && dotnet test test/Braintree.Tests.Integration/Braintree.Tests.Integration.csproj -f netcoreapp2.0"
end
end
namespace :test_focus do
desc "e.g. rake core2:test_focus:unit[ToXml_IncludesDeviceData]"
task :unit, [:test_name] => [:compile] do |t, args|
sh "dotnet test #{use_verbose_mode} --filter Name~#{args[:test_name]} test/Braintree.Tests/Braintree.Tests.csproj -f netcoreapp2.0"
end
desc "e.g. rake core2:test_focus:integration[Delete_DeletesPayPalAccount]"
task :integration, [:test_name] => [:compile] do |t, args|
sh "dotnet test #{use_verbose_mode} --filter Name~#{args[:test_name]} test/Braintree.Tests.Integration/Braintree.Tests.Integration.csproj -f netcoreapp2.0"
end
end
end
namespace :mono do
task :compile => [:clean, "sanity:test"] do
sh "MONO_BASE_PATH=/usr/lib/mono/ FrameworkPathOverride=$MONO_BASE_PATH/4.5-api/ dotnet build --framework net452"
end
desc "run tests"
namespace :test do
task :unit => [:compile] do
sh "mono test/lib/NUnit-3.4.1/bin/Release/nunit3-console.exe test/Braintree.Tests/bin/Debug/net452/Braintree.Tests.dll"
end
task :integration => [:compile] do
sh "mono test/lib/NUnit-3.4.1/bin/Release/nunit3-console.exe test/Braintree.Tests.Integration/bin/Debug/net452/Braintree.Tests.Integration.dll"
end
task :all => [:compile] do
sh "mono test/lib/NUnit-3.4.1/bin/Release/nunit3-console.exe test/Braintree.Tests/bin/Debug/net452/Braintree.Tests.dll"
sh "mono test/lib/NUnit-3.4.1/bin/Release/nunit3-console.exe test/Braintree.Tests.Integration/bin/Debug/net452/Braintree.Tests.Integration.dll"
end
end
namespace :test_focus do
desc "e.g. rake mono:test_focus:unit[Braintree.Tests.PaymentMethodTest.ToXml_IncludesDeviceData]"
task :unit, [:test_name] => [:compile] do |t, args|
sh "mono test/lib/NUnit-3.4.1/bin/Release/nunit3-console.exe test/Braintree.Tests/bin/Debug/net452/Braintree.Tests.dll --test=#{args[:test_name]}"
end
desc "e.g. rake mono:test_focus:integration[Braintree.Tests.Integration.PaymentMethodIntegrationTest.Delete_DeletesPayPalAccount]"
task :integration, [:test_name] => [:compile] do |t, args|
sh "mono test/lib/NUnit-3.4.1/bin/Release/nunit3-console.exe test/Braintree.Tests.Integration/bin/Debug/net452/Braintree.Tests.Integration.dll --test=#{args[:test_name]}"
end
end
end
namespace :sanity do
desc "run sanity tests"
task :test do
sh "(! grep -rnw . --include=\*.cs -e double && echo 'PASS') || (echo 'FAIL: Use decimal instead of double for amounts and quantities for more reliable precision.' && exit 1)"
end
end
task :test => "mono:test:all"