.appveyor.yml 5.19 KB
Newer Older
1 2 3 4 5 6
build: false
platform:
  - x64
#matrix:
#  fast_finish: true # kills the build at the first failure
clone_folder: C:\projects\dbal
7
clone_depth: 2
8 9 10 11

cache:
  - C:\ProgramData\chocolatey\bin -> .appveyor.yml
  - C:\ProgramData\chocolatey\lib -> .appveyor.yml
Walt Sorensen's avatar
Walt Sorensen committed
12
  - C:\tools\php -> .appveyor.yml
13 14
  - C:\tools\cacert -> .appveyor.yml
  - C:\tools\composer -> .appveyor.yml
15
  - '%LOCALAPPDATA%\Composer\files -> composer.json'
16 17 18 19 20 21 22

## Build matrix for lowest and highest possible targets
environment:
  matrix:
  - db: mssql
    driver: sqlsrv
    db_version: sql2012sp1
23
    php: 7.3
24 25 26
  - db: mssql
    driver: sqlsrv
    db_version: sql2017
27
    php: 7.3
28 29 30
  - db: mssql
    driver: pdo_sqlsrv
    db_version: sql2017
31
    php: 7.3
32 33

init:
Grégoire Paris's avatar
Grégoire Paris committed
34
  - SET PATH=C:\Program Files\OpenSSL;c:\tools\php;C:\tools\composer;%PATH%
35 36 37 38 39 40 41 42
  - SET COMPOSER_NO_INTERACTION=1
  - SET ANSICON=121x90 (121x90)

## Install PHP and composer, and run the appropriate composer command
install:
    - ps: |
        # Check if installation is cached
        if (!(Test-Path c:\tools\php)) {
43
          appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version 7.3.12
44 45 46 47 48 49 50 51 52
          # install sqlite
          appveyor-retry cinst -y sqlite
          Get-ChildItem -Path c:\tools\php
          cd c:\tools\php

          # Set PHP environment items that are always needed
          copy php.ini-production php.ini
          Add-Content php.ini "`n date.timezone=UTC"
          Add-Content php.ini "`n extension_dir=ext"
53
          Add-Content php.ini "`n memory_limit=1G"
54 55 56 57 58
          Add-Content php.ini "`n extension=php_openssl.dll"
          Add-Content php.ini "`n extension=php_mbstring.dll"
          Add-Content php.ini "`n extension=php_fileinfo.dll"
          Add-Content php.ini "`n extension=php_pdo_sqlite.dll"
          Add-Content php.ini "`n extension=php_sqlite3.dll"
59
          Add-Content php.ini "`n extension=php_curl.dll"
60
          Add-Content php.ini "`n curl.cainfo=C:\tools\cacert\bundle.pem"
61

62 63
          # Get and install the latest stable sqlsrv DLL's
          $DLLVersion = (Invoke-WebRequest "https://pecl.php.net/rest/r/sqlsrv/stable.txt").Content
Walt Sorensen's avatar
Walt Sorensen committed
64 65 66 67 68 69 70 71 72
          cd c:\tools\php\ext
          $source = "https://windows.php.net/downloads/pecl/releases/sqlsrv/$($DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip"
          $destination = "c:\tools\php\ext\php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip"
          Invoke-WebRequest $source -OutFile $destination
          7z x -y php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip > $null
          $source = "https://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip"
          $destination = "c:\tools\php\ext\php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip"
          Invoke-WebRequest $source -OutFile $destination
          7z x -y php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip > $null
73 74 75
          $DLLVersion = (Invoke-WebRequest "https://pecl.php.net/rest/r/pcov/stable.txt").Content
          Invoke-WebRequest https://windows.php.net/downloads/pecl/releases/pcov/$($DLLVersion)/php_pcov-$($DLLVersion)-7.3-nts-vc15-$($env:platform).zip -OutFile pcov.zip
          7z x -y pcov.zip > $null
Walt Sorensen's avatar
Walt Sorensen committed
76 77 78 79
          Remove-Item c:\tools\php\* -include .zip
          cd c:\tools\php
          Add-Content php.ini "`nextension=php_sqlsrv.dll"
          Add-Content php.ini "`nextension=php_pdo_sqlsrv.dll"
80
          Add-Content php.ini "`nextension=php_pcov.dll"
Walt Sorensen's avatar
Walt Sorensen committed
81
          Add-Content php.ini "`n"
82

83 84 85 86 87 88 89
          # download Composer
          if (!(Test-Path C:\tools\composer)) {
            New-Item -path c:\tools -name composer -itemtype directory
          }
          if (!(Test-Path c:\tools\composer\composer.phar)) {
            appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar -Filename C:\tools\composer\composer.phar
            Set-Content -path 'C:\tools\composer\composer.bat' -Value ('@php C:\tools\composer\composer.phar %*')
90
          }
91

92 93 94 95 96 97
          # download CA bundle
          if (!(Test-Path C:\tools\cacert)) {
            New-Item -path c:\tools\ -name cacert -itemtype directory
          }
          if (!(Test-Path c:\tools\cacert\bundle.pem)) {
            appveyor-retry appveyor DownloadFile https://curl.haxx.se/ca/cacert.pem -Filename C:\tools\cacert\bundle.pem
98
          }
99 100
        }
    # install composer dependencies
101 102
    - cd C:\projects\dbal
    - appveyor-retry composer self-update
103
    - appveyor-retry composer install --no-progress --prefer-dist
104 105 106 107 108 109

before_test:
# Selectively start the services
  - ps: >-
      if ($env:db -eq "mssql") {
        $instanceName = $env:db_version.ToUpper()
110
        net start "MSSQL`$$instanceName"
111 112 113 114 115
      }

test_script:
  - ps: >-
      if ($env:db_version) {
116
        $env:phpunit_config = "ci\appveyor\$($env:db).$($env:db_version).$($env:driver).appveyor.xml"
117
      } else {
118
        $env:phpunit_config = "ci\appveyor\$($env:db).$($env:driver).appveyor.xml"
119
      }
120

121
      vendor\bin\phpunit -c $($env:phpunit_config) --coverage-clover clover.xml
122 123 124 125

      if ($LastExitCode -ne 0) {
        $host.SetShouldExit($LastExitCode)
      }
126 127 128 129

after_test:
  - appveyor DownloadFile https://codecov.io/bash -FileName codecov.sh
  - bash codecov.sh -f clover.xml