-
Notifications
You must be signed in to change notification settings - Fork 153
/
appveyor.yml
304 lines (264 loc) · 13.6 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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
version: 1.x.{build}-{branch}
skip_commits:
files:
- '**/*.bat'
- '**/*.md'
- '**/*.ini'
- '**/*.sh'
- '**/*.xml'
- '**/.gitignore'
- '**/LICENSE'
- ext/doc/*
- ext/CREDITS
- ext/debug.php
- .clang-format
- .travis.yml
- docs.yaml
- doxyfile
- doxygen.rb
- Rakefile
- Vagrantfile
branches:
except:
- gh-pages
cache:
- C:\projects\dependencies\libs -> appveyor.yml
- C:\projects\dependencies\composer -> appveyor.yml
os: Visual Studio 2015
platform:
- x86
- x64
configuration:
# - Debug
- Release
environment:
LIBUV_VERSION: 1.13.1
CPP_DRIVER_DEPENDENCIES_DOWNLOAD_URL_PREFIX: https://raw.githubusercontent.com/mikefero/cpp-driver-msvc-libs/master
PHP_BINARY_TOOLS_ARCHIVE: php-sdk-binary-tools-20110915.zip
PHP_BINARY_TOOLS_DIR: C:/projects
PHP_DOWNLOAD_URL_PREFIX: https://github.com/php/php-src/archive
PHP_SDK_DEPENDENCIES_DOWNLOAD_URL_PREFIX: http://windows.php.net/downloads/php-sdk
PHP_SDK_LOCATION_PREFIX: C:/projects/dependencies/php-sdk
DEPENDENCIES_LOCATION_PREFIX: C:/projects/dependencies/libs
COMPOSER_CACHE_DIR: C:/projects/dependencies/composer
CONFIGURATION_COMPLETE: False
matrix:
- PHP: 5.6
PHP_VERSION: 5.6.31
THREAD_SAFE: True
CMAKE_GENERATOR: Visual Studio 11 2012
VISUAL_STUDIO_INTERNAL_VERSION: 110
VISUAL_STUDIO_SHORTHAND_VERSION: 11
- PHP: 5.6
PHP_VERSION: 5.6.31
THREAD_SAFE: False
CMAKE_GENERATOR: Visual Studio 11 2012
VISUAL_STUDIO_INTERNAL_VERSION: 110
VISUAL_STUDIO_SHORTHAND_VERSION: 11
- PHP: 7.0
PHP_VERSION: 7.0.21
THREAD_SAFE: True
CMAKE_GENERATOR: Visual Studio 14 2015
VISUAL_STUDIO_INTERNAL_VERSION: 140
VISUAL_STUDIO_SHORTHAND_VERSION: 14
- PHP: 7.0
PHP_VERSION: 7.0.21
THREAD_SAFE: False
CMAKE_GENERATOR: Visual Studio 14 2015
VISUAL_STUDIO_INTERNAL_VERSION: 140
VISUAL_STUDIO_SHORTHAND_VERSION: 14
- PHP: 7.1
PHP_VERSION: 7.1.7
THREAD_SAFE: True
CMAKE_GENERATOR: Visual Studio 14 2015
VISUAL_STUDIO_INTERNAL_VERSION: 140
VISUAL_STUDIO_SHORTHAND_VERSION: 14
- PHP: 7.1
PHP_VERSION: 7.1.7
THREAD_SAFE: False
CMAKE_GENERATOR: Visual Studio 14 2015
VISUAL_STUDIO_INTERNAL_VERSION: 140
VISUAL_STUDIO_SHORTHAND_VERSION: 14
init:
- ps: |
# Get the Visual Studio common tools directory
$env:VISUAL_STUDIO_COMMON_TOOLS_DIR=(Get-Item "env:VS$($env:VISUAL_STUDIO_INTERNAL_VERSION)COMNTOOLS").Value
# Determine the platform and create associate environment variables
If ($env:PLATFORM -Match "x86") {
$env:ARCHITECTURE="32"
# Construct the development environment batch script location
$env:VISUAL_STUDIO_DEVENV_BATCH_SCRIPT="$($env:VISUAL_STUDIO_COMMON_TOOLS_DIR)/vsvars32.bat"
} Else {
$env:ARCHITECTURE="64"
$env:CMAKE_GENERATOR_SUFFIX=" Win64"
# Construct the development environment batch script location
$env:VISUAL_STUDIO_DEVENV_BATCH_SCRIPT="$($env:VISUAL_STUDIO_COMMON_TOOLS_DIR)/../../VC/bin/x86_amd64/vcvarsx86_amd64.bat"
}
# Determine thread safety and debug command arguments for PHP configuration
If ($env:THREAD_SAFE -Match "True") {
$env:ENABLE_DISABLE_THREAD_SAFETY="--enable-zts"
$env:TS_OR_NTS="ts"
} Else {
$env:ENABLE_DISABLE_THREAD_SAFETY="--disable-zts"
$env:TS_OR_NTS="nts"
}
If ($env:CONFIGURATION -Match "Debug") {
$env:ENABLE_DEBUG="--enable-debug"
}
# Determine if OpenSSL extension should have default linking enabled
If ($env:PHP -Match "5.6") {
$env:WITH_OPENSSL_DEFAULT_SHARED="--with-openssl"
} Else {
$env:WITH_OPENSSL_DEFAULT_SHARED="--with-openssl=shared"
}
# Assign common use environment variables
$env:LIB_ARCHITECTURE="lib$($env:ARCHITECTURE)"
$env:WINDOWS_ARCHITECTURE="win$($env:ARCHITECTURE)"
$env:CPP_DRIVER_SOURCE_LOCATION="$($env:APPVEYOR_BUILD_FOLDER)/lib/cpp-driver"
# Generate the PHP environment variable
$env:PHP_DEPENDENCIES_ARCHIVE="deps-$($env:PHP)-vc$($env:VISUAL_STUDIO_SHORTHAND_VERSION)-$($env:PLATFORM).7z"
$env:PHP_ARCHIVE="php-$($env:PHP_VERSION).zip"
$env:PHP_DEPENDENCIES_DIR="$($env:PHP_SDK_LOCATION_PREFIX)/deps"
# Generate the environment for the dependencies root directory
$env:DEPENDENCIES_LOCATION="$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:Platform)/$($env:VISUAL_STUDIO_INTERNAL_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 and zlib environment variables
$env:OPENSSL_ROOT_DIR="$($env:PHP_DEPENDENCIES_DIR)"
$env:ZLIB_ROOT_DIR="$($env:PHP_DEPENDENCIES_DIR)"
# Generate the archive name for the driver artifact
$env:DRIVER_ARTIFACT_ARCHIVE="cassandra-php-driver-ci-artifact-$($env:APPVEYOR_BUILD_VERSION)-$($env:PHP)-$($env:TS_OR_NTS)-vc$($env:VISUAL_STUDIO_SHORTHAND_VERSION)-$($env:PLATFORM).zip"
# Setup the Visual Studio command line development environment
- cmd: CALL "%VISUAL_STUDIO_DEVENV_BATCH_SCRIPT%"
install:
- ps: |
# Install the dependencies (if needed)
New-Item -ItemType Directory -Force -Path "$($env:DEPENDENCIES_LOCATION)"
Push-Location "$($env:DEPENDENCIES_LOCATION)"
# Determine if PHP archive should be downloaded (cached)
If (!(Test-Path -Path "$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:PHP_ARCHIVE)")) {
# Download the PHP archive
Start-FileDownload "$($env:PHP_DOWNLOAD_URL_PREFIX)/$($env:PHP_ARCHIVE)" -FileName "$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:PHP_ARCHIVE)"
}
# Determine if PHP binary tools archive should be downloaded (cached)
If (!(Test-Path -Path "$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:PHP_BINARY_TOOLS_ARCHIVE)")) {
# Download the PHP binary tools archive
Start-FileDownload "$($env:PHP_SDK_DEPENDENCIES_DOWNLOAD_URL_PREFIX)/$($env:PHP_BINARY_TOOLS_ARCHIVE)" -FileName "$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:PHP_BINARY_TOOLS_ARCHIVE)"
}
# Determine if PHP libraries archive should be downloaded (cached)
If (!(Test-Path -Path "$($env:PHP_DEPENDENCIES_ARCHIVE)")) {
# Download the PHP dependencies archive
Start-FileDownload "$($env:PHP_SDK_DEPENDENCIES_DOWNLOAD_URL_PREFIX)/$($env:PHP_DEPENDENCIES_ARCHIVE)" -FileName $env:PHP_DEPENDENCIES_ARCHIVE
}
# Determine if libuv should be installed (cached)
If (!(Test-Path -Path "libuv-$($env:LIBUV_VERSION)")) {
# Download and extract the dependency
Start-FileDownload "$($env:CPP_DRIVER_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
}
# Remove pre-installed OpenSSL (resolve conflicts)
Remove-Item "C:/OpenSSL-*" -Force -Recurse
# Setup the build tree for PHP (Update the PATH for the binary tools)
New-Item -ItemType Directory -Force -Path "$($env:PHP_SDK_LOCATION_PREFIX)"
7z -o"$($env:PHP_SDK_LOCATION_PREFIX)" x "$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:PHP_BINARY_TOOLS_ARCHIVE)"
7z -o"$($env:PHP_SDK_LOCATION_PREFIX)" x "$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:PHP_ARCHIVE)"
7z -o"$($env:PHP_SDK_LOCATION_PREFIX)" x "$($env:PHP_DEPENDENCIES_ARCHIVE)"
$env:PHP_SOURCE_DIR="$($env:PHP_SDK_LOCATION_PREFIX)/php-src-php-$($env:PHP_VERSION)"
$env:PATH+=";$($env:PHP_SDK_LOCATION_PREFIX)/bin"
Copy-Item "libuv-$($env:LIBUV_VERSION)/*" "$($env:PHP_DEPENDENCIES_DIR)" -Force -Recurse
# Move back to original directory
Pop-Location
before_build:
- cmd: git submodule update --init --recursive
- ps: |
# Navigate to the C/C++ driver dependency
Push-Location "$($env:CPP_DRIVER_SOURCE_LOCATION)"
# Determine the version number for the C/C++ driver dependency
$env:CPP_DRIVER_VERSION_MAJOR=(grep CASS_VERSION_MAJOR include/cassandra.h | sed 's/[^0-9]*//g').trim()
$env:CPP_DRIVER_VERSION_MINOR=(grep CASS_VERSION_MINOR include/cassandra.h | sed 's/[^0-9]*//g').trim()
$env:CPP_DRIVER_VERSION_PATCH=(grep CASS_VERSION_PATCH include/cassandra.h | sed 's/[^0-9]*//g').trim()
$env:CPP_DRIVER_VERSION="$($env:CPP_DRIVER_VERSION_MAJOR).$($env:CPP_DRIVER_VERSION_MINOR).$($env:CPP_DRIVER_VERSION_PATCH)"
$env:CPP_DRIVER_VERSION_SHA=(git rev-parse --short HEAD).trim()
# Determine if C/C++ driver should be built and installed (cached)
if (!(Test-Path -Path "$($env:DEPENDENCIES_LOCATION)/$($env:CPP_DRIVER_VERSION)/$($env:CPP_DRIVER_VERSION_SHA)")) {
# 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="$($env:DEPENDENCIES_LOCATION)/$($env:CPP_DRIVER_VERSION)/$($env:CPP_DRIVER_VERSION_SHA)" -DCASS_MULTICORE_COMPILATION=ON -DCMAKE_BUILD_TYPE=$env:CONFIGURATION -DCASS_BUILD_STATIC=On -DCASS_USE_STATIC_LIBS=On -DCASS_USE_ZLIB=On ..
# Move back to C/C++ directory
Pop-Location
# Build and install the C/C++ driver
cmake --build build --config "$($env:CONFIGURATION)" --target install
}
# Move back to working directory
Pop-Location
# Add C/C++ driver to the PHP dependencies
Copy-Item "$($env:DEPENDENCIES_LOCATION)/$($env:CPP_DRIVER_VERSION)/$($env:CPP_DRIVER_VERSION_SHA)/*" "$($env:PHP_DEPENDENCIES_DIR)" -Force -Recurse
# Navigate to the PHP source directory
Push-Location "$($env:PHP_SOURCE_DIR)"
# Configure PHP and the PHP driver extension
- cmd: buildconf.bat --force --add-modules-dir="%APPVEYOR_BUILD_FOLDER%"
- cmd: configure.bat --with-prefix="%APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%" --disable-all --enable-cli --enable-com-dotnet --enable-session --enable-zlib --with-gmp %WITH_OPENSSL_DEFAULT_SHARED% --enable-cassandra=shared --enable-phar --enable-json --enable-filter --enable-hash --enable-ctype --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --enable-tokenizer --enable-zip --with-libxml --with-dom --with-iconv %ENABLE_DISABLE_THREAD_SAFETY% %ENABLE_DEBUG%
- ps: $env:CONFIGURATION_COMPLETE=$TRUE
build_script:
# Build and install PHP and the driver extension
- cmd: NMAKE all
- cmd: NMAKE install
- ps: |
# Add PHP artifacts directory to the environment (PHP executable)
$env:PATH+=";$($env:APPVEYOR_BUILD_FOLDER)/$($env:CONFIGURATION)"
# Move back to working directory
Pop-Location
# Copy OpenSSL libraries for artifact and test execution
Copy-Item "$($env:PHP_DEPENDENCIES_DIR)/bin/libeay32.dll" "$($env:CONFIGURATION)" -Force -Recurse
Copy-Item "$($env:PHP_DEPENDENCIES_DIR)/bin/ssleay32.dll" "$($env:CONFIGURATION)" -Force -Recurse
# Configure PHP to use the PHP driver extension
Add-Content "$($env:CONFIGURATION)/php.ini" "extension=ext\php_cassandra.dll"
If ($env:PHP -NotMatch "5.6") {
Add-Content "$($env:CONFIGURATION)/php.ini" "extension=ext\php_openssl.dll"
}
after_build:
- ps: |
# Create the artifact structure for the driver (Copy OpenSSL libraries)
New-Item -ItemType Directory -Force -Path $env:TEMP/php-driver-artifact
Copy-Item $env:CONFIGURATION/*.* $env:TEMP/php-driver-artifact
If (Test-Path -Path $env:CONFIGURATION/ext) {
Copy-Item $env:CONFIGURATION/ext $env:TEMP/php-driver-artifact -Recurse
}
Copy-Item ext/doc $env:TEMP/php-driver-artifact -Recurse
# Create the driver archive artifact
7z a -tzip $env:DRIVER_ARTIFACT_ARCHIVE -r $env:TEMP/php-driver-artifact/*
# Publish/Upload the artifacts to AppVeyor (Artifacts tab in UI)
Push-AppveyorArtifact $env:DRIVER_ARTIFACT_ARCHIVE -DeploymentName "DataStax PHP Driver Extension (w/ PHP v$env:PHP_VERSION Executable and DLL)"
# Install composer
- cmd: php -r "readfile('https://getcomposer.org/installer');" | php
- cmd: php composer.phar install
# Run the unit tests
- cmd: bin/phpunit --testsuite unit --log-junit junit-results.xml
# Upload/Publish the results
- ps: |
$wc=New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\junit-results.xml))
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
on_failure:
- ps: |
# Write the CMake output and error logs to the console
If ($env:CONFIGURATION_COMPLETE -eq "False") {
If (Test-Path "$($env:CPP_DRIVER_SOURCE_LOCATION)/build/CMakeFiles/CMakeOutput.log") {
Write-Output "C/C++ Driver CMakeOutput.log"
cat "$($env:CPP_DRIVER_SOURCE_LOCATION)/build/CMakeFiles/CMakeOutput.log"
}
If (Test-Path "$($env:CPP_DRIVER_SOURCE_LOCATION)/build/CMakeFiles/CMakeError.log") {
Write-Output "C/C++ Driver CMakeError.log"
cat "$($env:CPP_DRIVER_SOURCE_LOCATION)/build/CMakeFiles/CMakeError.log"
}
}