2017-01-11 00:59:16 +03:00
|
|
|
version: '{branch}.{build}'
|
2017-11-17 02:42:17 +03:00
|
|
|
|
2017-01-11 00:59:16 +03:00
|
|
|
branches:
|
|
|
|
# whitelist
|
2017-01-11 01:03:57 +03:00
|
|
|
#only:
|
2017-01-11 00:59:16 +03:00
|
|
|
|
|
|
|
# blacklist
|
|
|
|
except:
|
|
|
|
- PHP-7.0-Linux
|
|
|
|
- PHP5
|
|
|
|
|
|
|
|
environment:
|
2017-01-17 01:32:05 +03:00
|
|
|
# MSSQL credentials from https://www.appveyor.com/docs/services-databases/
|
2017-05-01 21:20:53 +03:00
|
|
|
TEST_PHP_SQL_PWD: Password12!
|
|
|
|
TEST_PHP_SQL_UID: sa
|
|
|
|
SQLSRV_DBNAME: msphpsql_sqlsrv
|
|
|
|
PDOSQLSRV_DBNAME: msphpsql_pdosqlsrv
|
2017-01-11 00:59:16 +03:00
|
|
|
PHP_DEPSVER: 7.0
|
|
|
|
PHP_SDK: c:\projects\php
|
2017-11-17 02:42:17 +03:00
|
|
|
matrix:
|
2017-11-22 21:11:38 +03:00
|
|
|
- BUILD_PLATFORM: x86
|
2017-11-21 19:39:54 +03:00
|
|
|
TEST_PHP_SQL_SERVER: (local)\SQL2016
|
|
|
|
SQL_INSTANCE: SQL2016
|
|
|
|
PHP_VC: 14
|
|
|
|
PHP_MAJOR_VER: 7.1
|
|
|
|
PHP_MINOR_VER: latest
|
2017-11-22 21:11:38 +03:00
|
|
|
PHP_SDK_DIR: c:\projects\php\x86
|
|
|
|
PHP_INSTALL_DIR: c:\projects\php\x86\bin
|
2017-11-21 19:39:54 +03:00
|
|
|
PHP_ZTS: --disable-zts
|
2017-11-22 21:11:38 +03:00
|
|
|
platform: x86
|
2017-11-19 04:12:16 +03:00
|
|
|
- BUILD_PLATFORM: x64
|
|
|
|
TEST_PHP_SQL_SERVER: (local)\SQL2012SP1
|
|
|
|
SQL_INSTANCE: SQL2012SP1
|
|
|
|
PHP_VC: 14
|
2017-11-22 21:58:16 +03:00
|
|
|
PHP_MAJOR_VER: 7.1
|
2017-11-17 21:29:19 +03:00
|
|
|
PHP_MINOR_VER: latest
|
2017-11-22 21:58:16 +03:00
|
|
|
PHP_SDK_DIR: c:\projects\php\x64
|
|
|
|
PHP_INSTALL_DIR: c:\projects\php\x64\bin
|
|
|
|
platform: x64
|
2017-11-17 02:42:17 +03:00
|
|
|
|
2017-01-11 00:59:16 +03:00
|
|
|
# PHP_MAJOR_VER is PHP major version to build (7.0, 7.1)
|
2017-11-17 02:42:17 +03:00
|
|
|
# PHP_MINOR_VER is PHP point release number (or latest for latest release)
|
2017-01-11 00:59:16 +03:00
|
|
|
# PHP_INSTALL_DIR is where the built PHP binaries go
|
|
|
|
# PHP_SDK_DIR is where PHP source is extracted to (e.g. PHP_SDK_DIR\php-7.0.14-src)
|
|
|
|
# PHP_SDK is where PHP sdk binary tools are extracted to
|
|
|
|
# PHP_VC is the Visual C++ version
|
|
|
|
# PHP_ZTS is defined to disable thread safe build
|
2017-11-17 02:42:17 +03:00
|
|
|
|
2017-01-11 00:59:16 +03:00
|
|
|
# Build worker image (VM template)
|
|
|
|
image: Visual Studio 2015
|
|
|
|
|
|
|
|
matrix:
|
|
|
|
fast_finish: true
|
2017-11-17 02:42:17 +03:00
|
|
|
|
2017-01-11 00:59:16 +03:00
|
|
|
#services:
|
|
|
|
#- mssql2012sp1
|
2017-11-17 02:42:17 +03:00
|
|
|
|
2017-01-11 00:59:16 +03:00
|
|
|
# clone directory (or %APPVEYOR_BUILD_FOLDER%)
|
|
|
|
clone_folder: c:\projects\sqlphp
|
|
|
|
|
|
|
|
build:
|
|
|
|
parallel: true # enable MSBuild parallel builds
|
|
|
|
|
|
|
|
install:
|
|
|
|
- echo start SQL Server
|
|
|
|
# Based on http://www.appveyor.com/docs/services-databases
|
|
|
|
- ps: >-
|
|
|
|
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null ;
|
|
|
|
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | Out-Null ;
|
|
|
|
|
|
|
|
$instanceName = $env:SQL_INSTANCE;
|
|
|
|
$uri = "ManagedComputer[@Name='$env:COMPUTERNAME']/ServerInstance[@Name='$instanceName']/ServerProtocol[@Name='Tcp']";
|
|
|
|
$wmi = New-Object ('Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer');
|
|
|
|
$tcp = $wmi.GetSmoObject($uri);
|
|
|
|
$tcp.IsEnabled = $true;
|
|
|
|
$tcp.Alter();
|
|
|
|
Start-Service "MSSQL`$$instanceName";
|
|
|
|
|
|
|
|
Set-Service SQLBrowser -StartupType Manual;
|
|
|
|
Start-Service SQLBrowser;
|
|
|
|
- echo Set PHP version...
|
2018-02-21 03:22:51 +03:00
|
|
|
- $client = New-Object Net.WebClient
|
|
|
|
- $client.Headers.Add("user-agent", "appveyor-ci-build")
|
|
|
|
- $client.DownloadFile("http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110915.zip", "c:\projects\php-sdk-binary-tools-20110915.zip")
|
|
|
|
#- appveyor DownloadFile http://windows.php.net/downloads/releases/sha1sum.txt
|
2017-01-11 00:59:16 +03:00
|
|
|
# determine latest PHP versions
|
|
|
|
- ps: >-
|
|
|
|
If ($env:PHP_MINOR_VER -Match "latest") {
|
2017-11-17 02:42:17 +03:00
|
|
|
$env:PHP_VERSION=type sha1sum.txt | where { $_ -match "php-($env:PHP_MAJOR_VER\.\d+)-src" } | foreach { $matches[1] } ;
|
2017-01-11 00:59:16 +03:00
|
|
|
} Else {
|
|
|
|
$env:PHP_VERSION=$env:PHP_MAJOR_VER + '.' + $env:PHP_MINOR_VER;
|
|
|
|
}
|
|
|
|
- echo Downloading PHP-SDK
|
2017-11-17 02:42:17 +03:00
|
|
|
- appveyor DownloadFile http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110915.zip
|
2017-01-11 00:59:16 +03:00
|
|
|
- move php-sdk-binary-tools-20110915.zip ..
|
|
|
|
- echo Downloading PHP source code [%PHP_VERSION%]
|
|
|
|
- ps: (new-object net.webclient).DownloadFile('http://windows.php.net/downloads/releases/php-' + ${env:PHP_VERSION} + '-src.zip', ${env:APPVEYOR_BUILD_FOLDER} + '\..\php.zip')
|
2017-05-08 18:12:26 +03:00
|
|
|
- echo Downloading MSODBCSQL 13.1
|
2017-05-10 18:47:42 +03:00
|
|
|
# AppVeyor build works are x64 VMs and 32-bit ODBC driver cannot be installed on it
|
2017-05-10 00:37:38 +03:00
|
|
|
- ps: (new-object net.webclient).DownloadFile('https://download.microsoft.com/download/D/5/E/D5EEF288-A277-45C8-855B-8E2CB7E25B96/x64/msodbcsql.msi', 'c:\projects\msodbcsql.msi')
|
2017-05-09 23:54:55 +03:00
|
|
|
- cmd /c start /wait msiexec /i "c:\projects\msodbcsql.msi" /q
|
2017-11-17 02:42:17 +03:00
|
|
|
- echo Checking the version of MSODBCSQL
|
2017-05-09 21:29:41 +03:00
|
|
|
- reg query "HKLM\SOFTWARE\ODBC\odbcinst.ini\ODBC Driver 13 for SQL Server"
|
2017-05-09 00:53:47 +03:00
|
|
|
- dir C:\Windows\System32\msodbcsql13.dll
|
2017-01-11 00:59:16 +03:00
|
|
|
- cd ..
|
|
|
|
- cd
|
|
|
|
- 7z x -y php-sdk-binary-tools-20110915.zip -o%PHP_SDK%
|
|
|
|
- 7z x -y php.zip -o%PHP_SDK_DIR%
|
|
|
|
- echo update SQL connection string
|
2017-06-23 23:26:51 +03:00
|
|
|
- ps: (Get-Content ${env:APPVEYOR_BUILD_FOLDER}\test\functional\pdo_sqlsrv\MsSetup.inc) | ForEach-Object { $_ -replace "TARGET_SERVER", ${env:TEST_PHP_SQL_SERVER} -replace "TARGET_DATABASE", ${env:PDOSQLSRV_DBNAME} -replace "TARGET_USERNAME", ${env:TEST_PHP_SQL_UID} -replace "TARGET_PASSWORD", ${env:TEST_PHP_SQL_PWD} } | Set-Content ${env:APPVEYOR_BUILD_FOLDER}\test\functional\pdo_sqlsrv\MsSetup.inc
|
|
|
|
- ps: Get-Content ${env:APPVEYOR_BUILD_FOLDER}\test\functional\pdo_sqlsrv\MsSetup.inc
|
|
|
|
- ps: (Get-Content ${env:APPVEYOR_BUILD_FOLDER}\test\functional\sqlsrv\MsSetup.inc) | ForEach-Object { $_ -replace "TARGET_SERVER", ${env:TEST_PHP_SQL_SERVER} -replace "TARGET_DATABASE", ${env:SQLSRV_DBNAME} -replace "TARGET_USERNAME", ${env:TEST_PHP_SQL_UID} -replace "TARGET_PASSWORD", ${env:TEST_PHP_SQL_PWD} } | Set-Content ${env:APPVEYOR_BUILD_FOLDER}\test\functional\sqlsrv\MsSetup.inc
|
|
|
|
- ps: Get-Content ${env:APPVEYOR_BUILD_FOLDER}\test\functional\sqlsrv\MsSetup.inc
|
2017-11-17 02:42:17 +03:00
|
|
|
- echo install opencppcoverage
|
2017-11-17 00:12:50 +03:00
|
|
|
- choco install opencppcoverage
|
|
|
|
- set path=C:\Program Files\OpenCppCoverage;%path%
|
2017-11-17 02:42:17 +03:00
|
|
|
|
2017-01-11 00:59:16 +03:00
|
|
|
build_script:
|
|
|
|
- '"C:\\Program Files (x86)\\Microsoft Visual Studio %PHP_VC%.0\\VC\\vcvarsall.bat" %BUILD_PLATFORM%'
|
|
|
|
- Echo copy msphp code to ext folder
|
|
|
|
- mkdir %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\sqlsrv
|
|
|
|
- mkdir %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\sqlsrv\shared
|
2017-11-17 02:42:17 +03:00
|
|
|
- mkdir %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\pdo_sqlsrv
|
2017-01-11 00:59:16 +03:00
|
|
|
- mkdir %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\pdo_sqlsrv\shared
|
2017-01-11 01:07:28 +03:00
|
|
|
- copy /Y %APPVEYOR_BUILD_FOLDER%\source\sqlsrv %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\sqlsrv
|
|
|
|
- copy /Y %APPVEYOR_BUILD_FOLDER%\source\shared %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\sqlsrv\shared
|
|
|
|
- copy /Y %APPVEYOR_BUILD_FOLDER%\source\shared %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\pdo_sqlsrv\shared
|
2017-11-17 02:42:17 +03:00
|
|
|
- copy /Y %APPVEYOR_BUILD_FOLDER%\source\pdo_sqlsrv %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\pdo_sqlsrv
|
2017-01-11 00:59:16 +03:00
|
|
|
- cd %PHP_SDK_DIR%\php-%PHP_VERSION%-src
|
|
|
|
- cd
|
2017-11-17 02:42:17 +03:00
|
|
|
- dir
|
2017-01-11 00:59:16 +03:00
|
|
|
- '%PHP_SDK%\bin\phpsdk_setvars.bat'
|
|
|
|
- buildconf.bat
|
|
|
|
# only build CLI and MSSQL extensions
|
|
|
|
- configure.bat --disable-all %PHP_ZTS% --enable-cli --enable-sqlsrv=shared --with-pdo-sqlsrv=shared --enable-pdo=shared --with-prefix=%PHP_INSTALL_DIR%
|
2017-11-17 02:42:17 +03:00
|
|
|
- copy php.ini-development php.ini
|
2017-01-11 00:59:16 +03:00
|
|
|
- echo extension_dir=%PHP_INSTALL_DIR%\ext >> php.ini
|
|
|
|
- echo extension=php_sqlsrv.dll >> php.ini
|
|
|
|
- echo extension=php_pdo_sqlsrv.dll >> php.ini
|
|
|
|
- nmake
|
|
|
|
- nmake install
|
|
|
|
- Echo copy php.ini and run-tests.php from php source to install directory.
|
|
|
|
- copy php.ini %PHP_INSTALL_DIR%
|
|
|
|
- copy run-tests.php %PHP_INSTALL_DIR%
|
2017-11-17 02:42:17 +03:00
|
|
|
- dir %PHP_INSTALL_DIR%
|
2017-01-11 00:59:16 +03:00
|
|
|
|
|
|
|
test_script:
|
2017-11-17 02:42:17 +03:00
|
|
|
- cd %PHP_INSTALL_DIR%
|
2017-01-11 00:59:16 +03:00
|
|
|
- php --ini
|
2017-05-01 21:20:53 +03:00
|
|
|
- php -i
|
2017-11-17 02:42:17 +03:00
|
|
|
- python -V
|
2017-05-09 22:59:31 +03:00
|
|
|
- Echo setup test database for SQLSRV tests - %SQLSRV_DBNAME%
|
2017-06-24 02:08:54 +03:00
|
|
|
- python %APPVEYOR_BUILD_FOLDER%\test\functional\setup\setup_dbs.py -dbname %SQLSRV_DBNAME%
|
2017-05-09 22:59:31 +03:00
|
|
|
- Echo setup test database for PDO_SQLSRV tests - %PDOSQLSRV_DBNAME%
|
2017-06-24 02:08:54 +03:00
|
|
|
- python %APPVEYOR_BUILD_FOLDER%\test\functional\setup\setup_dbs.py -dbname %PDOSQLSRV_DBNAME%
|
2017-11-22 20:20:42 +03:00
|
|
|
- ps: >-
|
|
|
|
If ($env:SQL_INSTANCE -Match "SQL2016") {
|
|
|
|
Write-Host "Running phpt tests via OpenCppCoverage..."
|
|
|
|
$ext_dir = ${env:PHP_SDK_DIR} + "\php-" + ${env:PHP_VERSION} + "-src\ext";
|
2017-11-23 01:14:34 +03:00
|
|
|
OpenCppCoverage.exe --sources $ext_dir\sqlsrv --sources $ext_dir\pdo_sqlsrv --modules ext\php_sqlsrv.dll --modules ext\php_pdo_sqlsrv.dll --export_type=cobertura:.\coverage.xml --quiet --cover_children --continue_after_cpp_exception --optimized_build -- .\php.exe run-tests.php -P ${env:APPVEYOR_BUILD_FOLDER}\test\functional\ | out-file -filePath ${env:APPVEYOR_BUILD_FOLDER}\test\functional\tests.log -encoding UTF8;
|
2017-11-22 21:58:16 +03:00
|
|
|
type ${env:APPVEYOR_BUILD_FOLDER}\test\functional\tests.log;
|
2017-11-22 20:20:42 +03:00
|
|
|
ls *.xml
|
2017-11-22 21:58:16 +03:00
|
|
|
} Else {
|
|
|
|
Write-Host "Running phpt tests the regular way..."
|
|
|
|
.\php.exe run-tests.php -P ${env:APPVEYOR_BUILD_FOLDER}\test\functional\sqlsrv\*.phpt | out-file -filePath ${env:APPVEYOR_BUILD_FOLDER}\test\functional\sqlsrv.log -encoding UTF8;
|
|
|
|
type ${env:APPVEYOR_BUILD_FOLDER}\test\functional\sqlsrv.log;
|
|
|
|
.\php.exe run-tests.php -P ${env:APPVEYOR_BUILD_FOLDER}\test\functional\pdo_sqlsrv\*.phpt | out-file -filePath ${env:APPVEYOR_BUILD_FOLDER}\test\functional\pdo_sqlsrv.log -encoding UTF8;
|
|
|
|
type ${env:APPVEYOR_BUILD_FOLDER}\test\functional\pdo_sqlsrv.log;
|
2017-11-22 20:20:42 +03:00
|
|
|
}
|
2017-11-23 01:14:34 +03:00
|
|
|
- python %APPVEYOR_BUILD_FOLDER%\test\functional\setup\cleanup_dbs.py -dbname %SQLSRV_DBNAME%
|
2017-06-24 02:08:54 +03:00
|
|
|
- python %APPVEYOR_BUILD_FOLDER%\test\functional\setup\cleanup_dbs.py -dbname %PDOSQLSRV_DBNAME%
|
2017-11-17 21:07:43 +03:00
|
|
|
- cd %PHP_INSTALL_DIR%
|
2017-11-18 07:22:39 +03:00
|
|
|
- ps: $fileExists = Test-Path "coverage.xml"
|
2017-11-17 20:32:56 +03:00
|
|
|
- ps: >-
|
2017-11-17 21:07:43 +03:00
|
|
|
If ($fileExists -eq $true) {
|
2017-11-21 03:11:53 +03:00
|
|
|
Write-Host "Running coverage analysis...";
|
2017-11-17 23:47:56 +03:00
|
|
|
$env:PATH = ${env:PHP_INSTALL_DIR} + $env:PATH;
|
|
|
|
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
|
2017-11-21 21:03:33 +03:00
|
|
|
bash codecov.sh -f "coverage.xml"
|
2017-11-17 20:32:56 +03:00
|
|
|
}
|
2017-01-11 00:59:16 +03:00
|
|
|
|
|
|
|
after_test:
|
2017-11-17 02:42:17 +03:00
|
|
|
- cd %APPVEYOR_BUILD_FOLDER%\test\functional\
|
2017-11-18 22:03:23 +03:00
|
|
|
- ps: ls *.log
|
2017-11-17 02:42:17 +03:00
|
|
|
- python output.py
|
2017-11-18 07:22:39 +03:00
|
|
|
- ps: $difffiles = Get-ChildItem sqlsrv\*.diff
|
|
|
|
- ps: $outfiles = Get-ChildItem sqlsrv\*.out
|
|
|
|
- ps: foreach($file in $difffiles){ls $file; more $file}
|
|
|
|
- ps: foreach($file in $outfiles){ls $file; more $file}
|
2017-11-18 22:03:23 +03:00
|
|
|
- ps: $diff2files = Get-ChildItem pdo_sqlsrv\*.diff
|
|
|
|
- ps: $out2files = Get-ChildItem pdo_sqlsrv\*.out
|
|
|
|
- ps: foreach($file in $diff2files){ls $file; more $file}
|
|
|
|
- ps: foreach($file in $out2files){ls $file; more $file}
|
2017-11-20 21:54:05 +03:00
|
|
|
- cd %APPVEYOR_BUILD_FOLDER%\test\functional\
|
2017-11-21 21:03:33 +03:00
|
|
|
- ps: $xmlfiles = Get-ChildItem *.xml
|
|
|
|
- ps: foreach($file in $xmlfiles){(new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $file))}
|
2017-11-22 03:37:25 +03:00
|
|
|
- ps: >-
|
2017-11-18 22:03:23 +03:00
|
|
|
If ($difffiles -ne $null -Or $diff2files -ne $null) {
|
2017-11-18 21:43:34 +03:00
|
|
|
$host.SetShouldExit(1);
|
|
|
|
Write-Host "Forcing build failure due to phpt unit test failure(s)";
|
|
|
|
}
|
2017-11-18 01:45:03 +03:00
|
|
|
|