forked from joomla-framework/database
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.appveyor.yml
126 lines (116 loc) · 5.04 KB
/
.appveyor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
build: false
platform:
- x64
clone_folder: C:\projects\database
branches:
except:
- gh-pages
clone_depth: 2
cache:
- C:\ProgramData\chocolatey\bin -> .appveyor.yml
- C:\ProgramData\chocolatey\lib -> .appveyor.yml
- C:\tools\php -> .appveyor.yml
- C:\tools\cacert -> .appveyor.yml
- C:\tools\composer -> .appveyor.yml
- '%LOCALAPPDATA%\Composer\files -> composer.json'
## Build matrix for lowest and highest possible targets
environment:
DLLVersion: "5.8.0"
PHPBuild: "x64"
VC: "vc15"
matrix:
- db: mssql
driver: sqlsrv
db_version: sql2017
php: 7.2
DLLVersion: "5.3.0"
- db: mssql
driver: sqlsrv
db_version: sql2017
php: 7.3
- db: mssql
driver: sqlsrv
db_version: sql2017
php: 7.4
- db: mssql
driver: sqlsrv
db_version: sql2017
php: 8.0
- db: mssql
driver: sqlsrv
db_version: sql2017
php: 8.1
- db: mssql
driver: sqlsrv
db_version: sql2017
php: 8.2
init:
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;C:\tools\composer;%PATH%
- 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)) {
choco upgrade --no-progress --limit-output -y chocolatey --version 0.10.13 --allow-downgrade --force
appveyor-retry choco install --no-progress --limit-output -y --params '""/InstallDir:C:\tools\php""' --ignore-checksums php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
# install sqlite
appveyor-retry choco install --no-progress --limit-output -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"
Add-Content php.ini "`n memory_limit=1G"
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"
Add-Content php.ini "`n extension=php_curl.dll"
Add-Content php.ini "`n curl.cainfo=C:\tools\cacert\bundle.pem"
# Get and install the MSSQL DLL's
cd c:\tools\php\ext
$source = "https://windows.php.net/downloads/pecl/releases/sqlsrv/$($env:DLLVersion)/php_sqlsrv-$($env:DLLVersion)-$($env:php)-nts-$($env:VC)-$($env:PHPBuild).zip"
$destination = "c:\tools\php\ext\php_sqlsrv-$($env:DLLVersion)-$($env:php)-nts-$($env:VC)-$($env:PHPBuild).zip"
Invoke-WebRequest $source -OutFile $destination
7z x -y php_sqlsrv-$($env:DLLVersion)-$($env:php)-nts-$($env:VC)-$($env:PHPBuild).zip > $null
$source = "https://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($env:DLLVersion)/php_pdo_sqlsrv-$($env:DLLVersion)-$($env:php)-nts-$($env:VC)-$($env:PHPBuild).zip"
$destination = "c:\tools\php\ext\php_pdo_sqlsrv-$($env:DLLVersion)-$($env:php)-nts-$($env:VC)-$($env:PHPBuild).zip"
Invoke-WebRequest $source -OutFile $destination
7z x -y php_pdo_sqlsrv-$($env:DLLVersion)-$($env:php)-nts-$($env:VC)-$($env:PHPBuild).zip > $null
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"
Add-Content php.ini "`n"
# 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 %*')
}
# 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 curl -fksSL -o C:\tools\cacert\bundle.pem https://curl.haxx.se/ca/cacert.pem
}
}
# install composer dependencies
- cd C:\projects\database
- appveyor-retry composer self-update
- appveyor-retry composer install --no-progress --prefer-dist
before_test:
- ps: $instanceName = $env:db_version.ToUpper()
- ps: $sqlInstance = "(local)\$instanceName"
- ps: net start "MSSQL`$$instanceName"
- ps: $phpunitConfig = "phpunit.appveyor_$($env:db_version).xml.dist"
test_script:
- cd C:\projects\database
- ps: vendor\bin\phpunit -c $phpunitConfig