appveyor.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. build: false
  2. platform: 'x64'
  3. clone_folder: c:\projects\cakephp
  4. cache:
  5. - '%LOCALAPPDATA%\Composer\files -> composer.lock'
  6. - C:\ProgramData\chocolatey\bin -> .appveyor.yml
  7. - C:\ProgramData\chocolatey\lib -> .appveyor.yml
  8. - C:\php -> .appveyor.yml
  9. branches:
  10. only:
  11. - master
  12. - 3.next
  13. - 4.x
  14. environment:
  15. global:
  16. PHP: "C:/PHP"
  17. php_ver_target: 7.2
  18. matrix:
  19. - db: 2012
  20. db_dsn: 'sqlserver://sa:Password12!@.\SQL2012SP1/cakephp?MultipleActiveResultSets=false'
  21. services:
  22. - mssql2012sp1
  23. init:
  24. - SET PATH=C:\Program Files\OpenSSL;C:\php;%PATH%
  25. - SET COMPOSER_NO_INTERACTION=1
  26. - SET PHP=1 # This var is connected to PHP install cache
  27. - SET ANSICON=121x90 (121x90)
  28. install:
  29. - IF EXIST C:\php (SET PHP=0)
  30. - ps: appveyor-retry cinst --params '""/InstallDir:C:\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
  31. - cd C:\php
  32. - copy php.ini-production php.ini /Y
  33. - echo date.timezone="UTC" >> php.ini
  34. - echo extension_dir=ext >> php.ini
  35. - echo extension=php_openssl.dll >> php.ini
  36. - echo extension=php_mbstring.dll >> php.ini
  37. - echo extension=php_intl.dll >> php.ini
  38. - echo extension=php_fileinfo.dll >> php.ini
  39. - curl -fsS https://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/5.2.0/php_pdo_sqlsrv-5.2.0-7.2-nts-vc15-x64.zip -o pdosqlsrv.zip
  40. - 7z x pdosqlsrv.zip -oC:\php\ext php_pdo_sqlsrv.dll > nul
  41. - curl -fsS https://windows.php.net/downloads/pecl/releases/sqlsrv/5.2.0/php_sqlsrv-5.2.0-7.2-nts-vc15-x64.zip -o sqlsrv.zip
  42. - 7z x sqlsrv.zip -oC:\php\ext php_sqlsrv.dll > nul
  43. - echo extension=php_pdo_sqlsrv.dll >> php.ini
  44. - echo extension=php_sqlsrv.dll >> php.ini
  45. - curl -fsS https://windows.php.net/downloads/pecl/releases/wincache/2.0.0.8/php_wincache-2.0.0.8-7.2-nts-vc15-x64.zip -o wincache.zip
  46. - 7z x wincache.zip -oC:\php\ext php_wincache.dll > nul
  47. - echo extension=php_wincache.dll >> php.ini
  48. - echo wincache.enablecli = 1 >> php.ini
  49. - cd C:\projects\cakephp
  50. - appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
  51. - php composer.phar install --no-progress
  52. - php -i | grep "ICU version"
  53. before_test:
  54. # This script solves the "Database 'model' is being recovered. Waiting until recovery is finished."
  55. # This solution comes from https://gist.github.com/jonathanhickford/1cb0d6665adab8b9c664
  56. # and is follow by http://help.appveyor.com/discussions/suggestions/264-database-mssqlsystemresource-is-being-recovered-waiting-for-sql-server-to-start
  57. - ps: >-
  58. $tries = 5;
  59. $pause = 10; # Seconds to wait between tries
  60. While ($tries -gt 0) {
  61. try {
  62. $ServerConnectionString = "Data Source=(local)\SQL2012SP1;Initial Catalog=master;User Id=sa;PWD=Password12!";
  63. $ServerConnection = new-object system.data.SqlClient.SqlConnection($ServerConnectionString);
  64. $query = "exec sp_configure 'clr enabled', 1;`n"
  65. $query = $query + "RECONFIGURE;`n"
  66. $cmd = new-object system.data.sqlclient.sqlcommand($query, $ServerConnection);
  67. $ServerConnection.Open();
  68. "Running:"
  69. $query
  70. if ($cmd.ExecuteNonQuery() -ne -1) {
  71. "SQL Error";
  72. } else {
  73. "Success"
  74. }
  75. $ServerConnection.Close();
  76. $tries = 0;
  77. } catch {
  78. "Error:"
  79. $_.Exception.Message
  80. "Retry in $pause seconds. Attempts left: $tries";
  81. Start-Sleep -s $pause;
  82. }
  83. $tries = $tries -1;
  84. }
  85. test_script:
  86. - sqlcmd -S ".\SQL2012SP1" -U sa -P Password12! -Q "create database cakephp;"
  87. - cd C:\projects\cakephp
  88. - vendor\bin\phpunit.bat