forked from zephir-lang/zephir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor.yml
179 lines (150 loc) · 6.63 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#---------------------------------#
# general configuration #
#---------------------------------#
# version format
version: 0.10.3-{build}
# branches to build
branches:
# whitelist
only:
- master
- development
#---------------------------------#
# environment configuration #
#---------------------------------#
# environment variables
environment:
matrix:
- PHP_TARGET: 5.6
PHP_VC: 11
PHP_SDK: c:\projects\php-sdk
PHP_DEVPACK: c:\projects\php-devpack
# clone entire repository history if not defined
clone_depth: 1
# clone directory
clone_folder: c:\projects\zephir
# scripts that are called at very beginning, before repo cloning
init:
- SET ANSICON=121x90 (121x90)
- SET COMPOSER_NO_INTERACTION=1
- SET PARSER_VERSION=1.1.0
- SET PARSER_RELEASE=261
- ps: IF ($env:APPVEYOR_REPO_BRANCH -eq "development") {$env:APPVEYOR_CACHE_SKIP_SAVE = "true"}
# build cache to preserve files/folders between builds
cache:
- vendor -> composer.json
- composer.phar -> composer.json
matrix:
# immediately finish build once one of the jobs fails
fast_finish: true
# Operating system (build VM template)
os: Windows Server 2012 R2
#---------------------------------#
# build configuration #
#---------------------------------#
# add platforms to build matrix (i.e. x86, x64, AnyCPU):
platform:
- x86
# disable automatic builds
build: false
# scripts that run after cloning repository
install:
# ==================================================
- echo Setting PHP version...
# ==================================================
- appveyor DownloadFile http://windows.php.net/downloads/releases/sha1sum.txt
- ps: |
$matched_versions = type sha1sum.txt | where { $_ -match "php-(${env:PHP_TARGET}\.\d+)-src" } | foreach { $matches[1] }
$cleaned_version = $matched_versions.Split(' ')[-1]
$env:PHP_VERSION=${cleaned_version}
- ps: $env:PARSER_DOWNLOAD_URL="https://github.com/phalcon/php-zephir-parser/releases/download/v${env:PARSER_VERSION}/zephir_parser_${env:PLATFORM}_vc${env:PHP_VC}_php${env:PHP_TARGET}_${env:PARSER_VERSION}-${env:PARSER_RELEASE}.zip"
# ==================================================
- echo Initializing Build...
# ==================================================
- cd %APPVEYOR_BUILD_FOLDER%
- git submodule update --init --recursive
- echo Preparing zephir win32 build...
# ==================================================
- echo Downloading PHP source code [http://windows.php.net/downloads/releases/php-%PHP_VERSION%-Win32-VC%PHP_VC%-%PLATFORM%.zip]
# ==================================================
- ps: (new-object net.webclient).DownloadFile('http://windows.php.net/downloads/releases/php-' + ${env:PHP_VERSION} + '-Win32-VC' + ${env:PHP_VC} + '-' + ${env:PLATFORM} + '.zip', ${env:APPVEYOR_BUILD_FOLDER} + '\..\php.zip')
- cd ..
- 'mkdir php && mv php.zip php\php.zip && cd php'
- 7z.exe x php.zip | FIND /V "ing "
- cd ..
- echo Downloading PHP-SDK
- mkdir php-sdk && cd php-sdk
- ps: (new-object net.webclient).DownloadFile('http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110915.zip', ${env:APPVEYOR_BUILD_FOLDER} + '\..\php-sdk.zip')
- '7z.exe x ..\php-sdk.zip | FIND /V "ing "'
- cd ..
# ==================================================
- echo Install PHP Dev pack
# ==================================================
- ps: >-
If ($env:PHP_TYPE -Match "nts-Win32") {
$env:DEVEL_PACK_VERSION="${env:PHP_VERSION}-nts-Win32-VC${env:PHP_VC}-${env:PLATFORM}"
} Else {
$env:DEVEL_PACK_VERSION="${env:PHP_VERSION}-Win32-VC${env:PHP_VC}-${env:PLATFORM}"
}
# ==================================================
- echo Downloading PHP Dev pack source code [http://windows.php.net/downloads/releases/php-devel-pack-%DEVEL_PACK_VERSION%.zip]
# ==================================================
- ps: (new-object net.webclient).DownloadFile('http://windows.php.net/downloads/releases/php-devel-pack-' + ${env:DEVEL_PACK_VERSION} + '.zip', ${env:APPVEYOR_BUILD_FOLDER} + '\..\php-dev.zip')
- 7z.exe x php-dev.zip | FIND /V "ing "
- mv php-%PHP_VERSION%-devel-VC11-%PLATFORM% php-devpack
- echo Enable Zephir Parser
- 'cd %APPVEYOR_BUILD_FOLDER%\..\php\ext'
# ==================================================
- echo Downloading Zephir Parser [%PARSER_DOWNLOAD_URL%]
# ==================================================
- curl --location --silent --show-error %PARSER_DOWNLOAD_URL% --output zephir_parser.zip
- 7z.exe x zephir_parser.zip | FIND /V "ing "
- echo Building PHP [%PHP_VERSION%]
- '"%VS110COMNTOOLS%\VsDevCmd" %PLATFORM%'
- '%PHP_SDK%\bin\phpsdk_setvars'
- 'cd %APPVEYOR_BUILD_FOLDER%\..\php'
- 'echo extension_dir=%APPVEYOR_BUILD_FOLDER%\..\php\ext > php.ini'
- 'echo extension=php_openssl.dll >> php.ini'
- 'echo extension=php_pdo_sqlite.dll >> php.ini'
- 'echo extension=php_gmp.dll >> php.ini'
- 'echo extension=php_zephir_parser.dll >> php.ini'
- 'set PATH=%cd%;%PATH%'
- php --ri "Zephir Parser"
#---------------------------------#
# tests configuration #
#---------------------------------#
# disable automatic tests
test: off
# scripts to run before tests
before_test:
- ps: Write-Host "Download tests dependencies.."
- cd %APPVEYOR_BUILD_FOLDER%
- if not exist vendor (php -r "readfile('https://getcomposer.org/installer');" | php && php composer.phar --version)
- if not exist vendor (php composer.phar update --quiet --no-ansi --no-interaction --no-progress --optimize-autoloader --dev --prefer-dist --no-suggest)
- php composer.phar dump-autoload
- ps: Write-Host "Start custom build.."
- cd %APPVEYOR_BUILD_FOLDER%
- 'bin\zephir build -Wnonexistent-function -Wnonexistent-class -Wunused-variable'
- 'cd %APPVEYOR_BUILD_FOLDER%\..\php'
- 'echo extension=%APPVEYOR_BUILD_FOLDER%\ext\Release_TS\php_test.dll >> php.ini'
# run custom scripts instead of automatic tests
test_script:
- ps: Write-Host "Start unit test.."
- cd %APPVEYOR_BUILD_FOLDER%
- 'php unit-tests/phpunit -c phpunit.xml.dist --not-exit --debug'
#---------------------------------#
# global handlers #
#---------------------------------#
# on build failure
on_failure:
- 'dir'
- ps: >-
IF (Test-Path -Path compile-errors.log) {
type compile-errors.log
}
IF (Test-Path -Path compile.log) {
type compile.log
}
IF (Test-Path -Path configure.js) {
type configure.js
}