forked from datastax/cpp-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
216 lines (185 loc) · 10.3 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
version: 2.x.{build}-{branch}
branches:
except:
- gh-pages
skip_tags: true
shallow_clone: true
cache:
- C:\projects\dependencies\libs -> appveyor.yml
platform:
- x86
- x64
configuration:
# - Debug
- Release
environment:
appveyor_build_worker_cloud: gce
BOOST_FILENAME_VERSION: 1_64_0
BOOST_VERSION: 1.64.0
LIBSSH2_VERSION: 1.8.0
LIBUV_VERSION: 1.14.1
OPENSSL_VERSION: 1.0.2l
DOWNLOADS_URL_PREFIX: http://downloads.datastax.com/cpp-driver/windows/dependencies
TEST_DEPENDENCIES_DOWNLOAD_URL_PREFIX: https://raw.githubusercontent.com/mikefero/cpp-driver-msvc-libs/master
DEPENDENCIES_LOCATION_PREFIX: C:/projects/dependencies/libs
CONFIGURATION_COMPLETE: False
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
CMAKE_GENERATOR: Visual Studio 10 2010
VISUAL_STUDIO_INTERNAL_VERSION: 100
VISUAL_STUDIO_VERSION: 10.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
CMAKE_GENERATOR: Visual Studio 11 2012
VISUAL_STUDIO_INTERNAL_VERSION: 110
VISUAL_STUDIO_VERSION: 11.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_GENERATOR: Visual Studio 12 2013
VISUAL_STUDIO_INTERNAL_VERSION: 120
VISUAL_STUDIO_VERSION: 12.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_GENERATOR: Visual Studio 14 2015
VISUAL_STUDIO_INTERNAL_VERSION: 140
VISUAL_STUDIO_VERSION: 14.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_GENERATOR: Visual Studio 15 2017
VISUAL_STUDIO_INTERNAL_VERSION: 141
VISUAL_STUDIO_VERSION: 14.1
init:
- ps: |
# Determine the platform and create associate environment variables
If ($env:Platform -Match "x86") {
$env:ARCHITECTURE="32"
} Else {
$env:ARCHITECTURE="64"
$env:CMAKE_GENERATOR_SUFFIX=" Win64"
}
$env:LIB_ARCHITECTURE="lib$($env:ARCHITECTURE)"
$env:WINDOWS_ARCHITECTURE="win$($env:ARCHITECTURE)"
# Generate the environment for the dependencies root directory
$env:DEPENDENCIES_LOCATION="$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:Platform)/$($env:VISUAL_STUDIO_INTERNAL_VERSION)"
# Generate the default Boost environment variables
$env:BOOST_ROOT="C:/Libraries/boost_$($env:BOOST_FILENAME_VERSION)"
$env:BOOST_INCLUDEDIR="$($env:BOOST_ROOT)"
$env:BOOST_LIBRARYDIR="$($env:BOOST_ROOT)/$($env:LIB_ARCHITECTURE)-msvc-$($env:VISUAL_STUDIO_VERSION)"
$env:BOOST_ARCHIVE="boost_$($env:BOOST_FILENAME_VERSION)-bin-msvc-$($env:VISUAL_STUDIO_VERSION)-$($env:ARCHITECTURE).7z"
# Generate the libssh2 environment variables
$env:LIBSSH2_ARCHIVE="libssh2-$($env:LIBSSH2_VERSION)-$($env:WINDOWS_ARCHITECTURE)-msvc$($env:VISUAL_STUDIO_INTERNAL_VERSION).zip"
$env:LIBSSH2_ROOT_DIR="$($env:DEPENDENCIES_LOCATION)/libssh2-$($env:LIBSSH2_VERSION)"
# Generate the libuv environment variables
$env:LIBUV_ARCHIVE="libuv-$($env:LIBUV_VERSION)-$($env:WINDOWS_ARCHITECTURE)-msvc$($env:VISUAL_STUDIO_INTERNAL_VERSION).zip"
$env:LIBUV_ROOT_DIR="$($env:DEPENDENCIES_LOCATION)/libuv-$($env:LIBUV_VERSION)"
# Generate the OpenSSL environment variables
$env:OPENSSL_ARCHIVE="openssl-$($env:OPENSSL_VERSION)-$($env:WINDOWS_ARCHITECTURE)-msvc$($env:VISUAL_STUDIO_INTERNAL_VERSION).zip"
$env:OPENSSL_ROOT_DIR="$($env:DEPENDENCIES_LOCATION)/openssl-$($env:OPENSSL_VERSION)"
# Generate the archive name for the driver artifact
$env:DRIVER_ARTIFACT_ARCHIVE="cassandra-cpp-driver-ci-artifact-$env:APPVEYOR_BUILD_VERSION-win$env:ARCHITECTURE-msvc$env:VISUAL_STUDIO_INTERNAL_VERSION.zip"
install:
- ps: |
# Install the dependencies (if needed)
New-Item -ItemType Directory -Force -Path "$($env:DEPENDENCIES_LOCATION)"
Push-Location "$($env:DEPENDENCIES_LOCATION)"
# Determine if Boost should be installed (pre-installed)
If (!(Test-Path -Path "$($env:BOOST_LIBRARYDIR)")) {
# Update the Boost environment variables for CMake to find installation
$env:BOOST_ROOT="$($env:DEPENDENCIES_LOCATION)/boost_$($env:BOOST_FILENAME_VERSION)"
$env:BOOST_INCLUDEDIR="$($env:BOOST_ROOT)"
$env:BOOST_LIBRARYDIR="$($env:BOOST_ROOT)/$($env:LIB_ARCHITECTURE)-msvc-$($env:VISUAL_STUDIO_VERSION)"
# Determine if Boost should be installed (cached)
If (!(Test-Path -Path "$($env:BOOST_LIBRARYDIR)")) {
# Download and extract the dependency (silently due to amount of files)
Start-FileDownload "$($env:TEST_DEPENDENCIES_DOWNLOAD_URL_PREFIX)/boost/$($env:BOOST_VERSION)/$($env:BOOST_ARCHIVE)" -FileName $env:BOOST_ARCHIVE
Write-Output "Extracting Boost v$($env:BOOST_VERSION) for $($env:CMAKE_GENERATOR)$($env:CMAKE_GENERATOR_SUFFIX)"
7z x $env:BOOST_ARCHIVE > $NULL
# Delete the binary archive
Remove-Item $env:BOOST_ARCHIVE
}
}
# Determine if libssh2 should be installed (cached)
If (!(Test-Path -Path "libssh2-$($env:LIBSSH2_VERSION)")) {
# Download and extract the dependency
#Start-FileDownload "$($env:DOWNLOADS_URL_PREFIX)/libssh2/v$($env:LIBSSH2_VERSION)/$($env:LIBSSH2_ARCHIVE)" -FileName $env:LIBSSH2_ARCHIVE
Start-FileDownload "$($env:TEST_DEPENDENCIES_DOWNLOAD_URL_PREFIX)/libssh2/$($env:LIBSSH2_VERSION)/$($env:LIBSSH2_ARCHIVE)" -FileName $env:LIBSSH2_ARCHIVE
7z -o"libssh2-$($env:LIBSSH2_VERSION)" x $env:LIBSSH2_ARCHIVE
# Delete the binary archive
Remove-Item $env:LIBSSH2_ARCHIVE
}
# Determine if libuv should be installed (cached)
If (!(Test-Path -Path "libuv-$($env:LIBUV_VERSION)")) {
# Download and extract the dependency
#Start-FileDownload "$($env:DOWNLOADS_URL_PREFIX)/libuv/v$($env:LIBUV_VERSION)/$($env:LIBUV_ARCHIVE)" -FileName $env:LIBUV_ARCHIVE
Start-FileDownload "$($env:TEST_DEPENDENCIES_DOWNLOAD_URL_PREFIX)/libuv/$($env:LIBUV_VERSION)/$($env:LIBUV_ARCHIVE)" -FileName $env:LIBUV_ARCHIVE
7z -o"libuv-$($env:LIBUV_VERSION)" x $env:LIBUV_ARCHIVE
# Only keep the static libraries
Move-Item "libuv-$($env:LIBUV_VERSION)/static/lib" "libuv-$($env:LIBUV_VERSION)/lib"
Remove-Item "libuv-$($env:LIBUV_VERSION)/static" -Force -Recurse
Remove-Item "libuv-$($env:LIBUV_VERSION)/shared" -Force -Recurse
# Delete the binary archive
Remove-Item $env:LIBUV_ARCHIVE
}
# Determine if OpenSSL should be installed (cached)
If (!(Test-Path -Path "openssl-$($env:OPENSSL_VERSION)")) {
# Download and extract the dependency
#Start-FileDownload "$($env:DOWNLOADS_URL_PREFIX)/openssl/v$($env:OPENSSL_VERSION)/$($env:OPENSSL_ARCHIVE)" -FileName $env:OPENSSL_ARCHIVE
Start-FileDownload "$($env:TEST_DEPENDENCIES_DOWNLOAD_URL_PREFIX)/openssl/$($env:OPENSSL_VERSION)/$($env:OPENSSL_ARCHIVE)" -FileName $env:OPENSSL_ARCHIVE
7z -o"openssl-$($env:OPENSSL_VERSION)" x $env:OPENSSL_ARCHIVE
# Only keep the static libaries
Move-Item "openssl-$($env:OPENSSL_VERSION)/static/lib" "openssl-$($env:OPENSSL_VERSION)/lib"
Remove-Item "openssl-$($env:OPENSSL_VERSION)/static" -Force -Recurse
Remove-Item "openssl-$($env:OPENSSL_VERSION)/shared" -Force -Recurse
# Delete the binary archive
Remove-Item $env:OPENSSL_ARCHIVE
}
# Remove pre-installed OpenSSL (resolve conflicts)
Remove-Item "C:/OpenSSL-*" -Force -Recurse
# Move back to original directory
Pop-Location
before_build:
- ps: |
# Create and navigate to the build directory (build outside tree)
New-Item -ItemType Directory -Force -Path build
Push-Location build
# Configure the build via CMake
cmake -G "$($env:CMAKE_GENERATOR)$($env:CMAKE_GENERATOR_SUFFIX)" -DCMAKE_INSTALL_PREFIX=lib -DCASS_MULTICORE_COMPILATION=ON -DCMAKE_BUILD_TYPE=$env:CONFIGURATION -DCASS_BUILD_STATIC=ON -DCASS_USE_STATIC_LIBS=ON -DCASS_BUILD_EXAMPLES=ON -DCASS_BUILD_TESTS=ON -DCASS_USE_LIBSSH2=ON ..
# Move back to working directory
Pop-Location
build_script:
- ps: $env:CONFIGURATION_COMPLETE=$TRUE
- ps: cmake --build build --config "$($env:CONFIGURATION)"
after_build:
- ps: |
# Create the artifact structure for the driver
New-Item -ItemType Directory -Force -Path $env:TEMP/cpp-driver-artifact/bin
Copy-Item build/$env:CONFIGURATION/cassandra.dll $env:TEMP/cpp-driver-artifact/bin
New-Item -ItemType Directory -Force -Path $env:TEMP/cpp-driver-artifact/include
Copy-Item include/* $env:TEMP/cpp-driver-artifact/include
New-Item -ItemType Directory -Force -Path $env:TEMP/cpp-driver-artifact/lib
Copy-Item build/$env:CONFIGURATION/cassandra.lib $env:TEMP/cpp-driver-artifact/lib
Copy-Item build/$env:CONFIGURATION/cassandra_static.lib $env:TEMP/cpp-driver-artifact/lib
# Create the driver archive artifact
7z a -tzip $env:DRIVER_ARTIFACT_ARCHIVE -r $env:TEMP/cpp-driver-artifact/*
# Publish/Upload the artifacts to AppVeyor (Artifacts tab in UI)
Push-AppveyorArtifact $env:DRIVER_ARTIFACT_ARCHIVE -DeploymentName "DataStax C/C++ Driver"
Push-AppveyorArtifact build/test/integration_tests/$env:CONFIGURATION/cassandra_integration_tests.exe -DeploymentName "DataStax C/C++ Driver Integration Tests"
Push-AppveyorArtifact build/$env:CONFIGURATION/cassandra-integration-tests.exe -DeploymentName "DataStax C/C++ Driver Integration Tests (Google)"
Push-AppveyorArtifact build/$env:CONFIGURATION/cassandra-unit-tests.exe -DeploymentName "DataStax C/C++ Driver Unit Tests (Google)"
test_script:
- ps: Start-Process -FilePath "build/$env:CONFIGURATION/cassandra-unit-tests.exe" -ArgumentList "--gtest_output=xml:unit-tests-gtest-results.xml" -Wait -NoNewWindow
on_finish:
- ps: |
# Publish/Upload the results to AppVeyor (Tests tab in UI)
If (Test-Path .\unit-tests-gtest-results.xml) {
(New-Object System.Net.WebClient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\unit-tests-gtest-results.xml))
}
on_failure:
- ps: |
# Write the CMake output and error logs to the console
If ($env:CONFIGURATION_COMPLETE -eq "False") {
If (Test-Path build/CMakeFiles/CMakeOutput.log) {
Write-Output "CMakeOutput.log"
cat build/CMakeFiles/CMakeOutput.log
}
If (Test-Path build/CMakeFiles/CMakeError.log) {
Write-Output "CMakeError.log"
cat build/CMakeFiles/CMakeError.log
}
}