msphpsql/appveyor.yml

184 строки
8.4 KiB
YAML

version: '{branch}.{build}'
branches:
# whitelist
#only:
# blacklist
except:
- PHP-7.0-Linux
- PHP5
environment:
# MSSQL credentials from https://www.appveyor.com/docs/services-databases/
MSSQL_PASSWORD: Password12!
MSSQL_USERNAME: sa
PHP_DEPSVER: 7.0
PHP_SDK: c:\projects\php
matrix:
- BUILD_PLATFORM: x64
MSSQL_SERVERNAME: (local)\SQL2012SP1
SQL_INSTANCE: SQL2012SP1
PHP_VC: 14
PHP_MAJOR_VER: 7.0
PHP_MINOR_VER: latest
PHP_SDK_DIR: c:\projects\php\x64
PHP_INSTALL_DIR: c:\projects\php\x64\bin
PHP_ZTS: --disable-zts
platform: x64
- BUILD_PLATFORM: x86
MSSQL_SERVERNAME: (local)\SQL2014
SQL_INSTANCE: SQL2014
PHP_VC: 14
PHP_MAJOR_VER: 7.0
PHP_MINOR_VER: latest
PHP_SDK_DIR: c:\projects\php\x86
PHP_INSTALL_DIR: c:\projects\php\x86\bin
platform: x86
- BUILD_PLATFORM: x64
MSSQL_SERVERNAME: (local)\SQL2016
SQL_INSTANCE: SQL2016
PHP_VC: 14
PHP_MAJOR_VER: 7.1
PHP_MINOR_VER: latest
PHP_SDK_DIR: c:\projects\php\x64
PHP_INSTALL_DIR: c:\projects\php\x64\bin
platform: x64
- BUILD_PLATFORM: x86
MSSQL_SERVERNAME: (local)\SQL2008R2SP2
SQL_INSTANCE: SQL2008R2SP2
PHP_VC: 14
PHP_MAJOR_VER: 7.1
PHP_MINOR_VER: latest
PHP_SDK_DIR: c:\projects\php\x86
PHP_INSTALL_DIR: c:\projects\php\x86\bin
PHP_ZTS: --disable-zts
platform: x86
# PHP_MAJOR_VER is PHP major version to build (7.0, 7.1)
# PHP_MINOR_VER is PHP point release number (or latest for latest release)
# 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
# Build worker image (VM template)
image: Visual Studio 2015
matrix:
fast_finish: true
#services:
#- mssql2012sp1
# 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...
- appveyor DownloadFile http://windows.php.net/downloads/releases/sha1sum.txt
# determine latest PHP versions
- ps: >-
If ($env:PHP_MINOR_VER -Match "latest") {
$env:PHP_VERSION=type sha1sum.txt | where { $_ -match "php-($env:PHP_MAJOR_VER\.\d+)-src" } | foreach { $matches[1] } ;
} Else {
$env:PHP_VERSION=$env:PHP_MAJOR_VER + '.' + $env:PHP_MINOR_VER;
}
- echo Downloading PHP-SDK
- appveyor DownloadFile http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110915.zip
- 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')
#- echo Downloading PHP deps [%PHP_DEPSVER%]
#- ps: (new-object net.webclient).DownloadFile('http://windows.php.net/downloads/php-sdk/deps-' + ${env:PHP_DEPSVER} + '-vc' + ${env:PHP_VC} + '-' + ${env:BUILD_PLATFORM} + '.7z', ${env:APPVEYOR_BUILD_FOLDER} + '\..\deps.7z')
- echo Downloading MSODBCSQL 13
- ps: (new-object net.webclient).DownloadFile('https://download.microsoft.com/download/1/E/7/1E7B1181-3974-4B29-9A47-CC857B271AA2/English/' + ${env:BUILD_PLATFORM} + '/msodbcsql.msi', 'msodbcsql.msi')
- ps: msiexec /i msodbcsql.msi /quiet /qn /norestart
- 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
- ps: (Get-Content ${env:APPVEYOR_BUILD_FOLDER}\test\pdo_sqlsrv\autonomous_setup.php) | ForEach-Object { $_ -replace "localhost", ${env:MSSQL_SERVERNAME} -replace "<YourStrong!Passw0rd>", ${env:MSSQL_PASSWORD} } | Set-Content ${env:APPVEYOR_BUILD_FOLDER}\test\pdo_sqlsrv\autonomous_setup.php
- ps: Get-Content ${env:APPVEYOR_BUILD_FOLDER}\test\pdo_sqlsrv\autonomous_setup.php
- ps: (Get-Content ${env:APPVEYOR_BUILD_FOLDER}\test\sqlsrv\autonomous_setup.php) | ForEach-Object { $_ -replace "localhost", ${env:MSSQL_SERVERNAME} -replace "<YourStrong!Passw0rd>", ${env:MSSQL_PASSWORD} } | Set-Content ${env:APPVEYOR_BUILD_FOLDER}\test\sqlsrv\autonomous_setup.php
- ps: Get-Content ${env:APPVEYOR_BUILD_FOLDER}\test\sqlsrv\autonomous_setup.php
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
- mkdir %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\pdo_sqlsrv
- mkdir %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\pdo_sqlsrv\shared
- 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
- copy /Y %APPVEYOR_BUILD_FOLDER%\source\pdo_sqlsrv %PHP_SDK_DIR%\php-%PHP_VERSION%-src\ext\pdo_sqlsrv
- cd %PHP_SDK_DIR%\php-%PHP_VERSION%-src
- cd
- dir
- '%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%
- copy php.ini-development php.ini
- 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%
- dir %PHP_INSTALL_DIR%
test_script:
- cd %PHP_INSTALL_DIR%
- php --ini
- php -i
- php run-tests.php -p php.exe %APPVEYOR_BUILD_FOLDER%\test\sqlsrv\*.phpt > %APPVEYOR_BUILD_FOLDER%\test\sqlsrv.log 2>&1
- type %APPVEYOR_BUILD_FOLDER%\test\sqlsrv.log
- php run-tests.php -p php.exe %APPVEYOR_BUILD_FOLDER%\test\pdo_sqlsrv\*.phpt > %APPVEYOR_BUILD_FOLDER%\test\pdo_sqlsrv.log 2>&1
- type %APPVEYOR_BUILD_FOLDER%\test\pdo_sqlsrv.log
after_test:
- cd %APPVEYOR_BUILD_FOLDER%\test\
- python output.py
- ps: $files = Get-ChildItem sqlsrv\*.diff
- ps: foreach($file in $files){ls $file; more $file; more "$file.out"}
- ps: $files = Get-ChildItem pdo_sqlsrv\*.diff
- ps: foreach($file in $files){ls $file; more $file; more "$file.out"}
- ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\nativeresult1.xml))
- ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\nativeresult2.xml))
- ps: >-
[xml]$results = Get-Content nativeresult1.xml ;
[xml]$results2 = Get-Content nativeresult2.xml ;
$failure = $results.SelectSingleNode("//failure");
$failure2 = $results2.SelectSingleNode("//failure");
if ($failure -ne $null -Or $failure2 -ne $null)
{
$host.SetShouldExit(1);
Write-Host "Forcing build failure due to phpt unit test failure(s)";
}