-
Notifications
You must be signed in to change notification settings - Fork 1
/
MSBuild.xml
88 lines (71 loc) · 4.17 KB
/
MSBuild.xml
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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RGSqlComparePath>C:\Program Files (x86)\Red Gate\SQL Compare 10\SQLCompare.exe</RGSqlComparePath>
<RGSqlDataComparePath>C:\Program Files (x86)\Red Gate\SQL Data Compare 10\SQLDataCompare.exe</RGSqlDataComparePath>
<SqlCmdPath>C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe</SqlCmdPath>
<SqlCIDb>RGDemo_CI</SqlCIDb>
</PropertyGroup>
<Import
Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"
Condition="Exists('$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets')"
/>
<Target Name="UpdateDatabaseVersion"
Condition="Exists('$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets')"
>
<Message Text="==================================================" />
<Message Text="== Update Database Version: $(DatabaseVersion)" />
<Message Text="==" />
<FileUpdate
Files="RedGateScripts/Functions/dbo.DATABASE_VERSION.sql"
Regex="RETURN.*'.*'"
ReplacementText="RETURN '$(DatabaseVersion)'" />
<Message Text="==================================================" />
</Target>
<Target Name="DeployEnvironment">
<Message Text="==================================================" />
<Message Text="== Deploy to $(DestinationEnvironment)" />
<Message Text="==" />
<Message Text="== Synching Schema" />
<Exec Command=""$(RGSqlComparePath)" /argfile RedGateArgFiles\$(DestinationEnvironment)_SQLCompare.xml" />
<Message Text="== Done" />
<Message Text="==" />
<Message Text="== Synching Data" />
<Exec Command=""$(RGSqlDataComparePath)" /argfile RedGateArgFiles\$(DestinationEnvironment)_SQLDataCompare.xml" />
<Message Text="== Done" />
<Message Text="==" />
<Message Text="==================================================" />
</Target>
<Target Name="DeployCI">
<Message Text="==================================================" />
<Message Text="== Deploy to CI Environment (used by Jenkins to confirm build)" />
<Message Text="==" />
<Message Text="==" />
<Message Text="== Creating Continuous Integration database" />
<Exec Command=""$(SqlCmdPath)" -i CIScripts/CreateDatabase.sql -S localhost -d master -v DATABASE_NAME="$(SqlCIDb)" -b -E" />
<Message Text="== Done" />
<Message Text="==" />
<Message Text="== Updating Schema" />
<Exec Command=""$(RGSqlComparePath)" /scr1 RedGateScripts /s2 localhost /db2 $(SqlCIDb) /Include Assembly /Include Function /Include StoredProcedure /Include Table /Include View /Include UserDefinedType /Include Contract /Include MessageType /Include Queue /Include Service /Include Additional /Include Different /Include Missing /Include Identical /sf UpdateSchema_JenkinsCI.SQLCompare.sql /force /sync" />
<Message Text="== Done" />
<Message Text="==" />
<Message Text="== Updating Data (this may take a while)" />
<Exec Command=""$(RGSqlDataComparePath)" /scr1 RedGateScripts /s2 localhost /db2 $(SqlCIDb) /Include Additional /Include Different /Include Missing /Include Identical /sf UpdateData_JenkinsCI.SQLDataCompare.sql /force /sync" />
<Message Text="== Done" />
<Message Text="==" />
<Message Text="== Run Tests" />
<Exec Command=""$(SqlCmdPath)" -i CIScripts/RunTests.sql -S localhost -d $(SqlCIDb) -v DATABASE_NAME="$(SqlCIDb)" -b -E" />
<Message Text="== Done" />
<Message Text="==" />
<Message Text="== Get Test Results" />
<Exec Command=""$(SqlCmdPath)" -i CIScripts/GetTestResults.sql -S localhost -d $(SqlCIDb) -v DATABASE_NAME="$(SqlCIDb)" -b -o TestResults.tSQLtResults.xml -E" />
<Message Text="== Done" />
<Message Text="==" />
<Message Text="== Dropping Continuous Integration database" />
<Exec Command=""$(SqlCmdPath)" -i CIScripts/DropDatabase.sql -S localhost -d master -v DATABASE_NAME="$(SqlCIDb)" -b -E" />
<Message Text="== Done" />
<Message Text="==" />
<Message Text="==" />
<Message Text="==================================================" />
</Target>
</Project>