Skip to content

Commit d228ecb

Browse files
author
Michael Fero
committed
AppVeyor enablement
- TS, NTS, x86, and x64 builds for PHP v5.5, v5.6, and 7.0 - Unit tests executed and JUnit style results uploaded - Artifacts with docs, PHP executable, and PHP DLL - Adding status badge to README
1 parent c2dc614 commit d228ecb

File tree

2 files changed

+294
-1
lines changed

2 files changed

+294
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# DataStax PHP Driver for Apache Cassandra
22

3-
[![Build Status](https://travis-ci.org/datastax/php-driver.svg)](https://travis-ci.org/datastax/php-driver)
3+
[![Build Status: Linux](https://travis-ci.org/datastax/php-driver.svg)](https://travis-ci.org/datastax/php-driver)
4+
[![Build Status: Windows](https://ci.appveyor.com/api/projects/status/8vrxpkfl4xm2f3nm?svg=true)](https://ci.appveyor.com/project/DataStax/php-driver)
45

56
A modern, [feature-rich](features) and highly tunable PHP client library for [Apache Cassandra](http://cassandra.apache.org/) (1.2+) and [DataStax Enterprise](http://www.datastax.com/products/products-index) (3.1+) using exclusively Cassandra's binary protocol and Cassandra Query Language v3.
67

appveyor.yml

Lines changed: 292 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
version: 1.x.{build}-{branch}
2+
branches:
3+
except:
4+
- gh-pages
5+
cache:
6+
- C:\projects\dependencies\libs -> appveyor.yml
7+
- C:/projects/dependencies/composer -> appveyor.yml
8+
os: Visual Studio 2015
9+
platform:
10+
- x86
11+
- x64
12+
configuration:
13+
# - Debug
14+
- Release
15+
environment:
16+
LIBUV_VERSION: 1.8.0
17+
OPENSSL_VERSION: 1.0.2h
18+
CPP_DRIVER_DEPENDENCIES_DOWNLOAD_URL_PREFIX: https://raw.githubusercontent.com/mikefero/cpp-driver-msvc-libs/master
19+
PHP_BINARY_TOOLS_ARCHIVE: php-sdk-binary-tools-20110915.zip
20+
PHP_BINARY_TOOLS_DIR: C:/projects
21+
PHP_DOWNLOAD_URL_PREFIX: https://github.com/php/php-src/archive
22+
PHP_SDK_DEPENDENCIES_DOWNLOAD_URL_PREFIX: http://windows.php.net/downloads/php-sdk
23+
PHP_SDK_LOCATION_PREFIX: C:/projects/dependencies/php-sdk
24+
DEPENDENCIES_LOCATION_PREFIX: C:/projects/dependencies/libs
25+
COMPOSER_CACHE_DIR: C:/projects/dependencies/composer
26+
CONFIGURATION_COMPLETE: False
27+
matrix:
28+
- PHP: 7.0
29+
PHP_VERSION: 7.0.7
30+
THREAD_SAFE: True
31+
CMAKE_GENERATOR: Visual Studio 14 2015
32+
VISUAL_STUDIO_INTERNAL_VERSION: 140
33+
VISUAL_STUDIO_SHORTHAND_VERSION: 14
34+
- PHP: 7.0
35+
PHP_VERSION: 7.0.7
36+
THREAD_SAFE: False
37+
CMAKE_GENERATOR: Visual Studio 14 2015
38+
VISUAL_STUDIO_INTERNAL_VERSION: 140
39+
VISUAL_STUDIO_SHORTHAND_VERSION: 14
40+
- PHP: 5.6
41+
PHP_VERSION: 5.6.22
42+
THREAD_SAFE: True
43+
CMAKE_GENERATOR: Visual Studio 11 2012
44+
VISUAL_STUDIO_INTERNAL_VERSION: 110
45+
VISUAL_STUDIO_SHORTHAND_VERSION: 11
46+
- PHP: 5.6
47+
PHP_VERSION: 5.6.22
48+
THREAD_SAFE: False
49+
CMAKE_GENERATOR: Visual Studio 11 2012
50+
VISUAL_STUDIO_INTERNAL_VERSION: 110
51+
VISUAL_STUDIO_SHORTHAND_VERSION: 11
52+
- PHP: 5.5
53+
PHP_VERSION: 5.5.36
54+
THREAD_SAFE: True
55+
CMAKE_GENERATOR: Visual Studio 11 2012
56+
VISUAL_STUDIO_INTERNAL_VERSION: 110
57+
VISUAL_STUDIO_SHORTHAND_VERSION: 11
58+
- PHP: 5.5
59+
PHP_VERSION: 5.5.36
60+
THREAD_SAFE: False
61+
CMAKE_GENERATOR: Visual Studio 11 2012
62+
VISUAL_STUDIO_INTERNAL_VERSION: 110
63+
VISUAL_STUDIO_SHORTHAND_VERSION: 11
64+
65+
init:
66+
- ps: |
67+
# Get the Visual Studio common tools directory
68+
$env:VISUAL_STUDIO_COMMON_TOOLS_DIR=(Get-Item "env:VS$($env:VISUAL_STUDIO_INTERNAL_VERSION)COMNTOOLS").Value
69+
70+
# Determine the platform and create associate environment variables
71+
If ($env:PLATFORM -Match "x86") {
72+
$env:ARCHITECTURE="32"
73+
74+
# Construct the development environment batch script location
75+
$env:VISUAL_STUDIO_DEVENV_BATCH_SCRIPT="$($env:VISUAL_STUDIO_COMMON_TOOLS_DIR)/vsvars32.bat"
76+
} Else {
77+
$env:ARCHITECTURE="64"
78+
$env:CMAKE_GENERATOR_SUFFIX=" Win64"
79+
80+
# Construct the development environment batch script location
81+
$env:VISUAL_STUDIO_DEVENV_BATCH_SCRIPT="$($env:VISUAL_STUDIO_COMMON_TOOLS_DIR)/../../VC/bin/x86_amd64/vcvarsx86_amd64.bat"
82+
}
83+
84+
# Determine thread safety and debug command arguments for PHP configuration
85+
If ($env:THREAD_SAFE -Match "True") {
86+
$env:ENABLE_DISABLE_THREAD_SAFETY="--enable-zts"
87+
$env:TS_OR_NTS="ts"
88+
} Else {
89+
$env:ENABLE_DISABLE_THREAD_SAFETY="--disable-zts"
90+
$env:TS_OR_NTS="nts"
91+
}
92+
If ($env:CONFIGURATION -Match "Debug") {
93+
$env:ENABLE_DEBUG="--enable-debug"
94+
}
95+
96+
# Assign common use environment variables
97+
$env:LIB_ARCHITECTURE="lib$($env:ARCHITECTURE)"
98+
$env:WINDOWS_ARCHITECTURE="win$($env:ARCHITECTURE)"
99+
$env:CPP_DRIVER_SOURCE_LOCATION="$($env:APPVEYOR_BUILD_FOLDER)/lib/cpp-driver"
100+
101+
# Generate the PHP environment variable
102+
$env:PHP_DEPENDENCIES_ARCHIVE="deps-$($env:PHP)-vc$($env:VISUAL_STUDIO_SHORTHAND_VERSION)-$($env:PLATFORM).7z"
103+
$env:PHP_ARCHIVE="php-$($env:PHP_VERSION).zip"
104+
105+
# Generate the environment for the dependencies root directory
106+
$env:DEPENDENCIES_LOCATION="$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:Platform)/$($env:VISUAL_STUDIO_INTERNAL_VERSION)"
107+
108+
# Generate the libuv environment variables
109+
$env:LIBUV_ARCHIVE="libuv-$($env:LIBUV_VERSION)-$($env:WINDOWS_ARCHITECTURE)-msvc$($env:VISUAL_STUDIO_INTERNAL_VERSION).zip"
110+
$env:LIBUV_ROOT_DIR="$($env:DEPENDENCIES_LOCATION)/libuv-$($env:LIBUV_VERSION)"
111+
112+
# Generate the OpenSSL environment variables
113+
$env:OPENSSL_ARCHIVE="openssl-$($env:OPENSSL_VERSION)-$($env:WINDOWS_ARCHITECTURE)-msvc$($env:VISUAL_STUDIO_INTERNAL_VERSION).zip"
114+
$env:OPENSSL_ROOT_DIR="$($env:DEPENDENCIES_LOCATION)/openssl-$($env:OPENSSL_VERSION)"
115+
116+
# Generate the archive name for the driver artifact
117+
$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"
118+
# Setup the Visual Studio command line development environment
119+
- cmd: CALL "%VISUAL_STUDIO_DEVENV_BATCH_SCRIPT%"
120+
121+
install:
122+
- ps: |
123+
# Install the dependencies (if needed)
124+
New-Item -ItemType Directory -Force -Path "$($env:DEPENDENCIES_LOCATION)"
125+
Push-Location "$($env:DEPENDENCIES_LOCATION)"
126+
127+
# Determine if PHP archive should be downloaded (cached)
128+
If (!(Test-Path -Path "$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:PHP_ARCHIVE)")) {
129+
# Download the PHP archive
130+
Start-FileDownload "$($env:PHP_DOWNLOAD_URL_PREFIX)/$($env:PHP_ARCHIVE)" -FileName "$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:PHP_ARCHIVE)"
131+
}
132+
133+
# Determine if PHP binary tools archive should be downloaded (cached)
134+
If (!(Test-Path -Path "$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:PHP_BINARY_TOOLS_ARCHIVE)")) {
135+
# Download the PHP binary tools archive
136+
Start-FileDownload "$($env:PHP_SDK_DEPENDENCIES_DOWNLOAD_URL_PREFIX)/$($env:PHP_BINARY_TOOLS_ARCHIVE)" -FileName "$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:PHP_BINARY_TOOLS_ARCHIVE)"
137+
}
138+
139+
# Determine if PHP libraries archive should be downloaded (cached)
140+
If (!(Test-Path -Path "$($env:PHP_DEPENDENCIES_ARCHIVE)")) {
141+
# Download the PHP dependencies archive
142+
Start-FileDownload "$($env:PHP_SDK_DEPENDENCIES_DOWNLOAD_URL_PREFIX)/$($env:PHP_DEPENDENCIES_ARCHIVE)" -FileName $env:PHP_DEPENDENCIES_ARCHIVE
143+
}
144+
145+
# Determine if libuv should be installed (cached)
146+
If (!(Test-Path -Path "libuv-$($env:LIBUV_VERSION)")) {
147+
# Download and extract the dependency
148+
Start-FileDownload "$($env:CPP_DRIVER_DEPENDENCIES_DOWNLOAD_URL_PREFIX)/libuv/$($env:LIBUV_VERSION)/$($env:LIBUV_ARCHIVE)" -FileName $env:LIBUV_ARCHIVE
149+
7z -o"libuv-$($env:LIBUV_VERSION)" x $env:LIBUV_ARCHIVE
150+
151+
# Only keep the static libraries
152+
Move-Item "libuv-$($env:LIBUV_VERSION)/static/lib" "libuv-$($env:LIBUV_VERSION)/lib"
153+
Remove-Item "libuv-$($env:LIBUV_VERSION)/static" -Force -Recurse
154+
Remove-Item "libuv-$($env:LIBUV_VERSION)/shared" -Force -Recurse
155+
156+
# Delete the binary archive
157+
Remove-Item $env:LIBUV_ARCHIVE
158+
}
159+
160+
# Determine if OpenSSL should be installed (cached)
161+
If (!(Test-Path -Path "openssl-$($env:OPENSSL_VERSION)")) {
162+
# Download and extract the dependency
163+
Start-FileDownload "$($env:CPP_DRIVER_DEPENDENCIES_DOWNLOAD_URL_PREFIX)/openssl/$($env:OPENSSL_VERSION)/$($env:OPENSSL_ARCHIVE)" -FileName $env:OPENSSL_ARCHIVE
164+
7z -o"openssl-$($env:OPENSSL_VERSION)" x $env:OPENSSL_ARCHIVE
165+
166+
# Only keep the static libaries
167+
Move-Item "openssl-$($env:OPENSSL_VERSION)/static/lib" "openssl-$($env:OPENSSL_VERSION)/lib"
168+
Remove-Item "openssl-$($env:OPENSSL_VERSION)/static" -Force -Recurse
169+
Remove-Item "openssl-$($env:OPENSSL_VERSION)/shared" -Force -Recurse
170+
171+
# Delete the binary archive
172+
Remove-Item $env:OPENSSL_ARCHIVE
173+
}
174+
175+
# Remove pre-installed OpenSSL (resolve conflicts)
176+
Remove-Item "C:/OpenSSL-*" -Force -Recurse
177+
178+
# Setup the build tree for PHP (Update the PATH for the binary tools)
179+
New-Item -ItemType Directory -Force -Path "$($env:PHP_SDK_LOCATION_PREFIX)"
180+
7z -o"$($env:PHP_SDK_LOCATION_PREFIX)" x "$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:PHP_BINARY_TOOLS_ARCHIVE)"
181+
7z -o"$($env:PHP_SDK_LOCATION_PREFIX)" x "$($env:DEPENDENCIES_LOCATION_PREFIX)/$($env:PHP_ARCHIVE)"
182+
7z -o"$($env:PHP_SDK_LOCATION_PREFIX)" x $env:PHP_DEPENDENCIES_ARCHIVE
183+
$env:PHP_SOURCE_DIR="$($env:PHP_SDK_LOCATION_PREFIX)/php-src-php-$($env:PHP_VERSION)"
184+
$env:PHP_DEPENDENCIES_DIR="$($env:PHP_SDK_LOCATION_PREFIX)/deps"
185+
$env:PATH+=";$($env:PHP_SDK_LOCATION_PREFIX)/bin"
186+
Copy-Item "libuv-$($env:LIBUV_VERSION)/*" "$($env:PHP_DEPENDENCIES_DIR)" -Force -Recurse
187+
Copy-Item "openssl-$($env:OPENSSL_VERSION)/*" "$($env:PHP_DEPENDENCIES_DIR)" -Force -Recurse
188+
189+
# Move back to original directory
190+
Pop-Location
191+
192+
before_build:
193+
- cmd: git submodule update --init --recursive
194+
- ps: |
195+
# Navigate to the C/C++ driver dependency
196+
Push-Location "$($env:CPP_DRIVER_SOURCE_LOCATION)"
197+
198+
# Determine the version number for the C/C++ driver dependency
199+
$env:CPP_DRIVER_VERSION_MAJOR=(grep CASS_VERSION_MAJOR include/cassandra.h | sed 's/[^0-9]*//g').trim()
200+
$env:CPP_DRIVER_VERSION_MINOR=(grep CASS_VERSION_MINOR include/cassandra.h | sed 's/[^0-9]*//g').trim()
201+
$env:CPP_DRIVER_VERSION_PATCH=(grep CASS_VERSION_PATCH include/cassandra.h | sed 's/[^0-9]*//g').trim()
202+
$env:CPP_DRIVER_VERSION="$($env:CPP_DRIVER_VERSION_MAJOR).$($env:CPP_DRIVER_VERSION_MINOR).$($env:CPP_DRIVER_VERSION_PATCH)"
203+
$env:CPP_DRIVER_VERSION_SHA=(git rev-parse --short HEAD).trim()
204+
205+
# Determine if C/C++ driver should be built and installed (cached)
206+
if (!(Test-Path -Path "$($env:DEPENDENCIES_LOCATION)/$($env:CPP_DRIVER_VERSION)/$($env:CPP_DRIVER_VERSION_SHA)")) {
207+
# Create and navigate to the build directory (build outside tree)
208+
New-Item -ItemType Directory -Force -Path build
209+
Push-Location build
210+
211+
# Configure the build via CMake
212+
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 ..
213+
214+
# Move back to C/C++ directory
215+
Pop-Location
216+
217+
# Build and install the C/C++ driver
218+
cmake --build build --config "$($env:CONFIGURATION)" --target install
219+
}
220+
221+
# Move back to working directory
222+
Pop-Location
223+
224+
# Add C/C++ driver to the PHP dependencies
225+
Copy-Item "$($env:DEPENDENCIES_LOCATION)/$($env:CPP_DRIVER_VERSION)/$($env:CPP_DRIVER_VERSION_SHA)/*" "$($env:PHP_DEPENDENCIES_DIR)" -Force -Recurse
226+
227+
# Navigate to the PHP source directory
228+
Push-Location "$($env:PHP_SOURCE_DIR)"
229+
# Configure PHP and the PHP driver extension
230+
- cmd: buildconf.bat --force --add-modules-dir="%APPVEYOR_BUILD_FOLDER%"
231+
- cmd: configure.bat --with-prefix="%APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%" --disable-all --enable-cli --enable-com-dotnet --enable-session --enable-zlib --with-gmp --with-openssl --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%
232+
- ps: $env:CONFIGURATION_COMPLETE=$TRUE
233+
234+
build_script:
235+
# Build and install PHP and the driver extension
236+
- cmd: NMAKE all
237+
- cmd: NMAKE install
238+
- ps: |
239+
# Add PHP artifacts directory to the environment (PHP executable)
240+
$env:PATH+=";$($env:APPVEYOR_BUILD_FOLDER)/$($env:CONFIGURATION)"
241+
242+
# Move back to working directory
243+
Pop-Location
244+
245+
# Configure PHP to use the PHP driver extension
246+
If (Test-Path -Path $env:CONFIGURATION/ext) {
247+
Add-Content "$($env:CONFIGURATION)/php.ini" "extension=ext\php_cassandra.dll"
248+
} Else {
249+
Add-Content "$($env:CONFIGURATION)/php.ini" "extension=.\php_cassandra.dll"
250+
}
251+
252+
after_build:
253+
- ps: |
254+
# Create the artifact structure for the driver
255+
New-Item -ItemType Directory -Force -Path $env:TEMP/php-driver-artifact
256+
Copy-Item $env:CONFIGURATION/php*.* $env:TEMP/php-driver-artifact
257+
If (Test-Path -Path $env:CONFIGURATION/ext) {
258+
Copy-Item $env:CONFIGURATION/ext $env:TEMP/php-driver-artifact -Recurse
259+
}
260+
Copy-Item ext/doc $env:TEMP/php-driver-artifact -Recurse
261+
262+
# Create the driver archive artifact
263+
7z a -tzip $env:DRIVER_ARTIFACT_ARCHIVE -r $env:TEMP/php-driver-artifact/*
264+
265+
# Publish/Upload the artifacts to AppVeyor (Artifacts tab in UI)
266+
Push-AppveyorArtifact $env:DRIVER_ARTIFACT_ARCHIVE -DeploymentName "DataStax PHP Driver Extension (w/ PHP v$env:PHP_VERSION Executable and DLL)"
267+
# Install composer
268+
- cmd: php -r "readfile('https://getcomposer.org/installer');" | php
269+
- cmd: php composer.phar install
270+
# Run the unit tests
271+
- cmd: bin/phpunit --testsuite unit --log-junit junit-results.xml
272+
# Upload/Publish the results
273+
- ps: |
274+
$wc=New-Object 'System.Net.WebClient'
275+
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\junit-results.xml))
276+
277+
#on_finish:
278+
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
279+
280+
on_failure:
281+
- ps: |
282+
# Write the CMake output and error logs to the console
283+
If ($env:CONFIGURATION_COMPLETE -eq "False") {
284+
If (Test-Path "$($env:CPP_DRIVER_SOURCE_LOCATION)/build/CMakeFiles/CMakeOutput.log") {
285+
Write-Output "C/C++ Driver CMakeOutput.log"
286+
cat "$($env:CPP_DRIVER_SOURCE_LOCATION)/build/CMakeFiles/CMakeOutput.log"
287+
}
288+
If (Test-Path "$($env:CPP_DRIVER_SOURCE_LOCATION)/build/CMakeFiles/CMakeError.log") {
289+
Write-Output "C/C++ Driver CMakeError.log"
290+
cat "$($env:CPP_DRIVER_SOURCE_LOCATION)/build/CMakeFiles/CMakeError.log"
291+
}
292+
}

0 commit comments

Comments
 (0)