forked from migaman/prefSQL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
121 lines (95 loc) · 4.31 KB
/
appveyor.yml
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
# Notes:
# - Minimal appveyor.yml file is an empty file. All sections are optional.
# - Indent each level of configuration with 2 spaces. Do not use tabs!
# - All section names are case-sensitive.
# - Section names should be unique on each level.
# - Full Reference: https://www.appveyor.com/docs/appveyor-yml
#---------------------------------#
# general configuration #
#---------------------------------#
# version format
version: 0.9.{build}
# you can use {branch} name in version format too
# version: 1.0.{build}-{branch}
# branches to build
branches:
# whitelist
only:
- master
- v2-parser
#---------------------------------#
# environment configuration #
#---------------------------------#
# Build worker image (VM template)
image: Visual Studio 2015
# enable service required for build/tests
services:
# start SQL Server 2012 SP1 Express
- mssql2012sp1
# enable patching of AssemblyInfo.* files
assembly_info:
patch: true
file: AssemblyInfo.*
assembly_version: '{version}-dev'
assembly_file_version: "{version}"
assembly_informational_version: "{version}"
# Automatically register private account and/or project AppVeyor NuGet feeds.
nuget:
project_feed: true
#---------------------------------#
# build configuration #
#---------------------------------#
# build platform, i.e. x86, x64, Any CPU. This setting is optional.
platform: Any CPU
# build Configuration, i.e. Debug, Release, etc.
configuration: Release
build:
# path to Visual Studio solution or project
# package projects with .nuspec files and push to artifacts
# add -IncludeReferencedProjects option while packaging NuGet
project: prefSQL.sln
publish_nuget: true
include_nuget_references: true
# scripts to run before build
before_build:
- nuget restore
#---------------------------------#
# tests configuration #
#---------------------------------#
# to run your custom scripts instead of automatic tests
before_test:
# to run script as a PowerShell command prepend it with ps:
# assemblypath needs apostrophe at the beginn because it is used as parameter for the sql script
- ps: |
$startPath = "$($env:appveyor_build_folder)\"
$sqlInstance = "(local)\SQL2012SP1"
$dbName = "ecommercetest"
$assemblyPath = "`"$($env:appveyor_build_folder)\SQLSkyline\bin\$($env:CONFIGURATION)\SQLSkyline.dll`""
# replace the db connection with the local instance
$config = join-path $startPath "SQLParserTest\bin\$($env:CONFIGURATION)\SQLParserTest.dll.config"
$doc = (gc $config) -as [xml]
$doc.SelectSingleNode('//connectionStrings/add[@name="localhost"]').connectionString = "Server=$sqlInstance;Database=$dbName;User ID=sa;Password=Password12!"
$doc.Save($config)
# replace the db connection with the local instance
$config = join-path $startPath "SQLParserSamplingTest\bin\$($env:CONFIGURATION)\SQLParserSamplingTest.dll.config"
$doc = (gc $config) -as [xml]
$doc.SelectSingleNode('//connectionStrings/add[@name="localhost"]').connectionString = "Server=$sqlInstance;Database=$dbName;User ID=sa;Password=Password12!"
$doc.Save($config)
# attach mdf to local instance
$mdfFile = join-path $startPath "SQLParserTest\ecommercetest.mdf"
$ldfFile = join-path $startPath "SQLParserTest\ecommercetest_log.ldf"
# sqlcmd Utility parameters
# -d db_name
# -i input_file
# -P password
# -Q "cmdline query" (and exit)
# -S [protocol:]server[\instance_name][,port]
# -U login_id
# -v var = "value"
#create test database
sqlcmd -S "$sqlInstance" -Q "Use [master]; CREATE DATABASE [$dbName] ON (FILENAME = '$mdfFile'),(FILENAME = '$ldfFile') for ATTACH"
#enable clr mode
sqlcmd -S "$sqlInstance" -Q "Use [$dbName]; EXEC sys.sp_configure @configname = N'clr enabled', @configvalue = 1;"
sqlcmd -S "$sqlInstance" -Q "Use [$dbName]; RECONFIGURE;"
#install clr assembly and stored procs that are based on assembly
sqlcmd -S "$sqlInstance" -d "$dbName" -v assemblyFile = $assemblyPath -i ".\Documents\01_Install_Assembly.sql"