forked from nanodbc/nanodbc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.appveyor.yml
259 lines (234 loc) · 10.8 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
version: 1.0.{build}
os: Visual Studio 2017
platform: x64
configuration: Release
branches:
only:
- master
- latest
- release
clone_depth: 1
notifications:
- provider: Webhook
url: https://webhooks.gitter.im/e/70a268802a5c8a54e09b
on_build_success: true
on_build_failure: true
on_build_status_changed: true
environment:
matrix:
- DB: MSSQL2016
G: "Visual Studio 15 2017 Win64"
- DB: MSSQL2016
G: "Visual Studio 15 2017 Win64"
ENABLE_UNICODE: ON
- DB: MSSQL2014
G: "Visual Studio 15 2017 Win64"
- DB: MSSQL2014
G: "Visual Studio 15 2017 Win64"
ENABLE_UNICODE: ON
- DB: MSSQL2012
G: "Visual Studio 14 2015 Win64"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- DB: MSSQL2012
G: "Visual Studio 14 2015 Win64"
ENABLE_UNICODE: ON
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- DB: MSSQL2008
G: "Visual Studio 14 2015 Win64"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- DB: MSSQL2008
G: "Visual Studio 14 2015 Win64"
ENABLE_UNICODE: ON
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- DB: MySQL
G: "Visual Studio 15 2017 Win64"
- DB: PostgreSQL
G: "Visual Studio 15 2017 Win64"
- DB: SQLite
G: "Visual Studio 15 2017 Win64"
- DB: SQLite
P: x86-32
G: "Visual Studio 15 2017"
- DB: SQLite
G: "MinGW Makefiles"
P: x86-64
DISABLE_ASYNC: ON
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- G: "Visual Studio 15 2017 Win64"
ANALYSIS: "/p:RunCodeAnalysis=true /p:EnableCppCoreCheck=true"
- G: "Visual Studio 15 2017"
ANALYSIS: "/p:RunCodeAnalysis=true /p:EnableCppCoreCheck=true"
matrix:
allow_failures:
- G: "Visual Studio 15 2017"
ANALYSIS: "/p:RunCodeAnalysis=true /p:EnableCppCoreCheck=true"
- G: "Visual Studio 15 2017 Win64"
ANALYSIS: "/p:RunCodeAnalysis=true /p:EnableCppCoreCheck=true"
cache:
- c:\downloads\
init:
# For MinGW make to work correctly sh.exe must NOT be in your path.
- set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
- if "%G%"=="NMake Makefiles" if "%P%"=="x86-32" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
- if "%G%"=="NMake Makefiles" if "%P%"=="x86-64" "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
install:
- ps: |
if ($env:DB -Match "SQLite") {
$sqliteodbc64Path = "c:\downloads\sqliteodbc_w64.exe"
$sqliteodbc32Path = "c:\downloads\sqliteodbc.exe"
if (-not (Test-Path c:\downloads -PathType Container)) {
New-Item -ItemType Directory -Path c:\downloads
}
if (-not (Test-Path $sqliteodbc64Path -PathType Leaf)) {
Write-Host "Downloading 64-bit SQLite ODBC Driver" -ForegroundColor Magenta
(New-Object Net.WebClient).DownloadFile('http://www.ch-werner.de/sqliteodbc/sqliteodbc_w64.exe', $sqliteodbc64Path)
}
if (-not (Test-Path $sqliteodbc32Path -PathType Leaf)) {
Write-Host "Downloading 32-bit SQLite ODBC Driver" -ForegroundColor Magenta
(New-Object Net.WebClient).DownloadFile('http://www.ch-werner.de/sqliteodbc/sqliteodbc.exe', $sqliteodbc32Path)
}
Write-Host "Installing 64-bit SQLite ODBC Driver" -ForegroundColor Magenta
cmd /c start /wait $sqliteodbc64Path /S
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
Write-Host "Installing 32-bit SQLite ODBC Driver" -ForegroundColor Magenta
cmd /c start /wait $sqliteodbc32Path /S
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
}
- ps: |
Write-Host "Installed ODBC drivers:" -ForegroundColor Magenta
Get-OdbcDriver -Platform 64-bit | Select-Object -ExpandProperty Name
- ps: |
if ($env:G -Match "MinGW") {
if ($env:P -Match "x86-32") {
$env:Path += ";C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin"
} else {
$env:Path += ";C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin"
}
g++ --version
}
before_build:
- ps: if (-not $env:DISABLE_ASYNC) { $env:DISABLE_ASYNC="OFF" }
- ps: if (-not $env:ENABLE_BOOST) { $env:ENABLE_BOOST="OFF" }
- ps: if (-not $env:ENABLE_UNICODE) { $env:ENABLE_UNICODE="OFF" }
- ps: if (-not $env:DISABLE_EXAMPLES) { $env:DISABLE_EXAMPLES="ON" }
- ps: if (-not $env:DISABLE_TESTS) { $env:DISABLE_TESTS="OFF" }
- ps: if (-not $env:DISABLE_INSTALL) { $env:DISABLE_INSTALL="ON" }
- ps: if ($env:G -Match "NMake") { $env:DISABLE_INSTALL="OFF" }
- ps: |
if ($env:ANALYSIS) {
$env:MSBUILD_ARGS="/warnaserror $env:ANALYSIS"
$env:DISABLE_EXAMPLES="ON"
$env:DISABLE_TESTS="ON"
}
build_script:
- ps: 'Write-Host "Running cmake: $env:G" -ForegroundColor Magenta'
- cmake.exe -G "%G%" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DNANODBC_ENABLE_BOOST=%ENABLE_BOOST% -DNANODBC_ENABLE_UNICODE=%ENABLE_UNICODE% -DNANODBC_DISABLE_ASYNC=%DISABLE_ASYNC% -DNANODBC_DISABLE_EXAMPLES=%DISABLE_EXAMPLES% -DNANODBC_DISABLE_TESTS=%DISABLE_TESTS% -DNANODBC_DISABLE_INSTALL=%DISABLE_INSTALL% %APPVEYOR_BUILD_FOLDER%
- ps: 'Write-Host "Running cmake --build:" -ForegroundColor Magenta'
- cmake --build . --config %CONFIGURATION% -- %MSBUILD_ARGS%
before_test:
- ps: |
if ($env:ANALYSIS) {
Write-Host "Static analysis, skipping database services configuration" -ForegroundColor Magenta
} else {
Write-Host "Configuring $env:DB service" -ForegroundColor Magenta
if ($env:DB -Match "MSSQL2008") {
Start-Service 'MSSQL$SQL2008R2SP2'
} elseif ($env:DB -Match "MSSQL2012") {
Start-Service 'MSSQL$SQL2012SP1'
} elseif ($env:DB -Match "MSSQL2014") {
Start-Service 'MSSQL$SQL2014'
} elseif ($env:DB -Match "MSSQL2016") {
Start-Service 'MSSQL$SQL2016'
} elseif ($env:DB -Match "MySQL") {
Start-Service MySQL57
$env:MYSQL_PWD="Password12!"
$cmd = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql" -e "create database nanodbc_test;" --user=root'
iex "& $cmd"
} elseif ($env:DB -Match "PostgreSQL") {
Start-Service postgresql-x64-9.5
$env:PGUSER="postgres"
$env:PGPASSWORD="Password12!"
$cmd = '"C:\Program Files\PostgreSQL\9.6\bin\createdb" nanodbc_test'
iex "& $cmd"
}
}
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
test_script:
- ps: |
if ($env:ANALYSIS) {
Write-Host "Static analysis, skipping tests" -ForegroundColor Magenta
} else {
$test_name = "utility_test"
Write-Host "Running $Env:CONFIGURATION build test: $test_name" -ForegroundColor Magenta
$cmd = 'ctest -V --output-on-failure -C ' + $Env:CONFIGURATION + ' -R ' + $test_name
iex "& $cmd"
if ($LastExitCode -ne 0) {
Write-Host "Tests failure, uploading Testing/Temporary/LastTest.log to artifacts" -ForegroundColor Magenta
Push-AppveyorArtifact Testing\Temporary\LastTest.log
$host.SetShouldExit($LastExitCode)
}
if ($env:DB -Match "MSSQL2008") {
$test_driver = "ODBC Driver 11 for SQL Server"
$env:NANODBC_TEST_CONNSTR_MSSQL="Driver={${test_driver}};Server=(local)\SQL2008R2SP2;Database=master;UID=sa;PWD=Password12!;"
$test_name = "mssql_test"
} elseif ($env:DB -Match "MSSQL2012") {
$test_driver = "ODBC Driver 11 for SQL Server"
$env:NANODBC_TEST_CONNSTR_MSSQL="Driver={${test_driver}};Server=(local)\SQL2012SP1;Database=master;UID=sa;PWD=Password12!;"
$test_name = "mssql_test"
} elseif ($env:DB -Match "MSSQL2014") {
$test_driver = "ODBC Driver 11 for SQL Server"
$env:NANODBC_TEST_CONNSTR_MSSQL="Driver={${test_driver}};Server=(local)\SQL2014;Database=master;UID=sa;PWD=Password12!;"
$test_name = "mssql_test"
} elseif ($env:DB -Match "MSSQL2016") {
$test_driver = "ODBC Driver 11 for SQL Server"
$env:NANODBC_TEST_CONNSTR_MSSQL="Driver={${test_driver}};Server=(local)\SQL2016;Database=master;UID=sa;PWD=Password12!;"
$test_name = "mssql_test"
} elseif ($env:DB -Match "MySQL") {
$test_driver = "MySQL ODBC 5.3 ANSI Driver"
$env:NANODBC_TEST_CONNSTR_MYSQL="Driver={${test_driver}};Server=127.0.0.1;Database=nanodbc_test;User=root;Password=Password12!;big_packets=1;"
$test_name = "mysql_test"
} elseif ($env:DB -Match "PostgreSQL") {
$test_driver = "PostgreSQL ANSI(x64)"
$env:NANODBC_TEST_CONNSTR_PGSQL="Driver={${test_driver}};Server=127.0.0.1;Port=5432;Database=nanodbc_test;Uid=postgres;Pwd=Password12!;"
$test_name = "postgresql_test"
} elseif ($env:DB -Match "SQLite") {
$test_driver = "SQLite3 ODBC Driver"
$test_name = "sqlite_test"
} else {
throw 'Database ' + $env:DB + ' not configured yet'
}
if ($env:P -Match "x86-32") {
Add-OdbcDsn -Name testdsn -DriverName "$test_driver" -Platform "32-bit" -DsnType System -SetPropertyValue @("Database=db01")
} else {
Add-OdbcDsn -Name testdsn -DriverName "$test_driver" -DsnType System -SetPropertyValue @("Database=db01")
}
Write-Host "Installed ODBC data sources:" -ForegroundColor Magenta
Get-OdbcDsn | Select-Object -ExpandProperty Name
Write-Host "Running $Env:CONFIGURATION build test: $test_name" -ForegroundColor Magenta
$cmd = 'ctest -V --output-on-failure -C ' + $Env:CONFIGURATION + ' -R ' + $test_name
iex "& $cmd"
if ($LastExitCode -ne 0) {
Write-Host "Tests failure, uploading Testing/Temporary/LastTest.log to artifacts" -ForegroundColor Magenta
Push-AppveyorArtifact Testing\Temporary\LastTest.log
$host.SetShouldExit($LastExitCode)
}
}
after_test:
- ps: |
if ($env:G -Match "NMake") {
Write-Host "Running install:" -ForegroundColor Magenta
cmake --build . --target install
}
- ps: |
if ($env:G -Match "NMake") {
Write-Host "Building example/client based on nanodbc package configuration:" -ForegroundColor Magenta
cd $env:APPVEYOR_BUILD_FOLDER\example\client
cmake.exe -G $env:G -DCMAKE_BUILD_TYPE=Release .
cmake --build . --config Release
}
# If you need to debug AppVeyor session (https://www.appveyor.com/docs/how-to/rdp-to-build-worker), then:
# 1. Uncomment the on_finish section below:
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# 2. Add this line to the init section below
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))