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
|
2018-04-21 01:55:43 +03:00
|
|
|
PYTHON: c:\Python36
|
|
|
|
# For details about Appveyor build worker images (VM template): https://www.appveyor.com/docs/build-environment/#build-worker-images
|
2017-11-17 02:42:17 +03:00
|
|
|
matrix:
|
2018-04-21 02:54:30 +03:00
|
|
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
|
|
|
BUILD_PLATFORM: x64
|
2018-04-24 17:37:53 +03:00
|
|
|
TEST_PHP_SQL_SERVER: (local)\SQL2017
|
|
|
|
SQL_INSTANCE: SQL2017
|
2018-04-21 02:54:30 +03:00
|
|
|
PHP_VC: 15
|
|
|
|
PHP_MAJOR_VER: 7.2
|
2018-12-08 02:03:48 +03:00
|
|
|
PHP_MINOR_VER: 11
|
2018-04-21 02:54:30 +03:00
|
|
|
PHP_EXE_PATH: x64\Release_TS
|
|
|
|
THREAD: ts
|
|
|
|
platform: x64
|
2018-04-24 06:33:49 +03:00
|
|
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
|
|
|
BUILD_PLATFORM: x86
|
2018-04-24 17:37:53 +03:00
|
|
|
TEST_PHP_SQL_SERVER: (local)\SQL2016
|
|
|
|
SQL_INSTANCE: SQL2016
|
2018-04-24 06:33:49 +03:00
|
|
|
PHP_VC: 14
|
|
|
|
PHP_MAJOR_VER: 7.1
|
|
|
|
PHP_MINOR_VER: latest
|
|
|
|
PHP_EXE_PATH: Release
|
|
|
|
THREAD: nts
|
|
|
|
platform: x86
|
2017-11-17 02:42:17 +03:00
|
|
|
|
2018-04-21 01:55:43 +03:00
|
|
|
# PHP_MAJOR_VER is PHP major version to build (7.2, 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_VC is the Visual C++ version
|
2018-04-21 01:55:43 +03:00
|
|
|
# PHP_EXE_PATH is the relative path from php src folder to php executable
|
|
|
|
# THREAD is either non-thread-safe (nts) or thread-safe (ts)
|
2017-01-11 00:59:16 +03:00
|
|
|
|
|
|
|
matrix:
|
|
|
|
fast_finish: true
|
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: >-
|
2018-04-21 01:55:43 +03:00
|
|
|
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null;
|
|
|
|
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | Out-Null;
|
2017-01-11 00:59:16 +03:00
|
|
|
|
|
|
|
$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;
|
2018-02-21 19:57:05 +03:00
|
|
|
- echo Downloading prerequisites
|
2018-02-21 20:10:22 +03:00
|
|
|
- ps: |
|
|
|
|
$client = New-Object Net.WebClient;
|
|
|
|
$client.Headers.Add("user-agent", "appveyor-ci-build2");
|
2018-02-21 19:57:05 +03:00
|
|
|
$client.DownloadFile("http://windows.php.net/downloads/releases/sha1sum.txt", "c:\projects\sha1sum.txt");
|
2017-01-11 00:59:16 +03:00
|
|
|
If ($env:PHP_MINOR_VER -Match "latest") {
|
2018-02-21 03:46:53 +03:00
|
|
|
$env:PHP_VERSION=type c:\projects\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;
|
|
|
|
}
|
2018-07-21 03:24:48 +03:00
|
|
|
- echo Downloading MSODBCSQL 17.2
|
2017-05-10 18:47:42 +03:00
|
|
|
# AppVeyor build works are x64 VMs and 32-bit ODBC driver cannot be installed on it
|
2018-07-21 03:24:48 +03:00
|
|
|
- ps: (new-object net.webclient).DownloadFile('https://download.microsoft.com/download/E/6/B/E6BFDC7A-5BCD-4C51-9912-635646DA801E/en-US/msodbcsql_17.2.0.1_x64.msi', 'c:\projects\msodbcsql_17.2.0.1_x64.msi')
|
|
|
|
- cmd /c start /wait msiexec /i "c:\projects\msodbcsql_17.2.0.1_x64.msi" /q IACCEPTMSODBCSQLLICENSETERMS=YES ADDLOCAL=ALL
|
2017-11-17 02:42:17 +03:00
|
|
|
- echo Checking the version of MSODBCSQL
|
2018-04-20 21:21:29 +03:00
|
|
|
- reg query "HKLM\SOFTWARE\ODBC\odbcinst.ini\ODBC Driver 17 for SQL Server"
|
|
|
|
- dir %WINDIR%\System32\msodbcsql*.dll
|
2018-02-21 03:32:16 +03:00
|
|
|
- cd c:\projects
|
2017-01-11 00:59:16 +03:00
|
|
|
- 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
|
2018-04-21 01:55:43 +03:00
|
|
|
- ps: Select-String ${env:SQL_INSTANCE} ${env:APPVEYOR_BUILD_FOLDER}\test\functional\pdo_sqlsrv\MsSetup.inc
|
|
|
|
- ps: Select-String ${env:PDOSQLSRV_DBNAME} ${env:APPVEYOR_BUILD_FOLDER}\test\functional\pdo_sqlsrv\MsSetup.inc
|
2017-06-23 23:26:51 +03:00
|
|
|
- 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
|
2018-04-21 01:55:43 +03:00
|
|
|
- ps: Select-String ${env:SQL_INSTANCE} ${env:APPVEYOR_BUILD_FOLDER}\test\functional\sqlsrv\MsSetup.inc
|
|
|
|
- ps: Select-String ${env:SQLSRV_DBNAME} ${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
|
2018-04-21 01:55:43 +03:00
|
|
|
- set path=C:\Program Files\OpenCppCoverage;%PYTHON%;%PYTHON%\Scripts;%path%
|
2017-11-17 02:42:17 +03:00
|
|
|
|
2017-01-11 00:59:16 +03:00
|
|
|
build_script:
|
2018-04-21 01:55:43 +03:00
|
|
|
- copy %APPVEYOR_BUILD_FOLDER%\buildscripts\*.py c:\projects
|
|
|
|
- cd c:\projects
|
|
|
|
- python -V
|
2018-04-23 19:05:21 +03:00
|
|
|
- python builddrivers.py --PHPVER=%PHP_VERSION% --ARCH=%BUILD_PLATFORM% --THREAD=%THREAD% --SOURCE=%APPVEYOR_BUILD_FOLDER%\source --TESTING --NO_RENAME
|
2018-04-21 01:55:43 +03:00
|
|
|
- cd c:\projects\php-sdk\phpdev\vc%PHP_VC%\%BUILD_PLATFORM%\php-%PHP_VERSION%-src\
|
|
|
|
- set PHP_SRC_DIR=%CD%\ext
|
|
|
|
- cd %PHP_EXE_PATH%
|
|
|
|
- set PHP_EXE_PATH=%CD%
|
2018-04-24 06:08:38 +03:00
|
|
|
- echo Showing the last few lines of php.ini
|
|
|
|
- ps: Get-Content ${env:PHP_EXE_PATH}\php.ini -Tail 5
|
2018-04-21 01:55:43 +03:00
|
|
|
- php --ini
|
|
|
|
- php -m
|
2017-01-11 00:59:16 +03:00
|
|
|
|
|
|
|
test_script:
|
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: >-
|
2018-04-21 01:55:43 +03:00
|
|
|
If ($env:BUILD_PLATFORM -Match "x86") {
|
2017-11-22 20:20:42 +03:00
|
|
|
Write-Host "Running phpt tests via OpenCppCoverage..."
|
2018-04-24 05:07:44 +03:00
|
|
|
OpenCppCoverage.exe --sources ${env:PHP_SRC_DIR}\*sqlsrv --modules ${env:PHP_EXE_PATH}\php*sqlsrv.dll --export_type=cobertura:c:\projects\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;
|
2018-04-21 01:55:43 +03:00
|
|
|
Write-Host "Showing the last 25 lines of the log file..."
|
|
|
|
Get-Content ${env:APPVEYOR_BUILD_FOLDER}\test\functional\tests.log -Tail 25;
|
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;
|
2018-04-21 01:55:43 +03:00
|
|
|
Write-Host "Showing the last 25 lines of the log file..."
|
|
|
|
Get-Content ${env:APPVEYOR_BUILD_FOLDER}\test\functional\sqlsrv.log -Tail 25;
|
2017-11-22 21:58:16 +03:00
|
|
|
.\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;
|
2018-04-21 01:55:43 +03:00
|
|
|
Write-Host "Showing the last 25 lines of the log file..."
|
|
|
|
Get-Content ${env:APPVEYOR_BUILD_FOLDER}\test\functional\pdo_sqlsrv.log -Tail 25;
|
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%
|
2018-04-21 01:55:43 +03:00
|
|
|
- cd %PHP_EXE_PATH%
|
2018-04-24 05:07:44 +03:00
|
|
|
- ps: $fileExists = Test-Path "c:\projects\coverage.xml"
|
2017-11-17 20:32:56 +03:00
|
|
|
- ps: >-
|
2017-11-17 21:07:43 +03:00
|
|
|
If ($fileExists -eq $true) {
|
2018-04-24 05:07:44 +03:00
|
|
|
cd c:\projects
|
2017-11-21 03:11:53 +03:00
|
|
|
Write-Host "Running coverage analysis...";
|
2018-04-24 00:54:26 +03:00
|
|
|
Write-Host "Showing the packages...";
|
|
|
|
Select-String package .\coverage.xml;
|
2017-11-17 23:47:56 +03:00
|
|
|
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
|
2018-04-24 06:08:38 +03:00
|
|
|
bash codecov.sh -f "coverage.xml"
|
2018-04-24 05:07:44 +03:00
|
|
|
cd ${env:PHP_EXE_PATH}
|
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
|
|
|
|