Skip to content

Commit 9dd26d5

Browse files
committed
Refactored AppVeyor builds
1 parent 5c97e28 commit 9dd26d5

File tree

3 files changed

+487
-189
lines changed

3 files changed

+487
-189
lines changed

.appveyor.yml

Lines changed: 52 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,50 @@
11
version: 1.1.3-{build}
22

3-
#---------------------------------#
4-
# environment configuration #
5-
#---------------------------------#
6-
7-
# environment variables
83
environment:
94
matrix:
10-
- PHP_TARGET: 7.0
11-
PHP_VC: 14
12-
PHP_MAJOR: 7
13-
PHP_BUILD_TYPE: "Win32"
5+
- PHP_MINOR: 7.0
6+
VC_VERSION: 14
7+
BUILD_TYPE: "Win32"
148
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
15-
- PHP_TARGET: 7.0
16-
PHP_VC: 14
17-
PHP_MAJOR: 7
18-
PHP_BUILD_TYPE: "nts-Win32"
9+
- PHP_MINOR: 7.0
10+
VC_VERSION: 14
11+
BUILD_TYPE: "nts-Win32"
1912
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
20-
- PHP_TARGET: 7.1
21-
PHP_VC: 14
22-
PHP_MAJOR: 7
23-
PHP_BUILD_TYPE: "Win32"
13+
- PHP_MINOR: 7.1
14+
VC_VERSION: 14
15+
BUILD_TYPE: "Win32"
2416
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
25-
- PHP_TARGET: 7.1
26-
PHP_VC: 14
27-
PHP_MAJOR: 7
28-
PHP_BUILD_TYPE: "nts-Win32"
17+
- PHP_MINOR: 7.1
18+
VC_VERSION: 14
19+
BUILD_TYPE: "nts-Win32"
2920
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
30-
- PHP_TARGET: 7.2
31-
PHP_VC: 15
32-
PHP_MAJOR: 7
33-
PHP_BUILD_TYPE: "Win32"
21+
- PHP_MINOR: 7.2
22+
VC_VERSION: 15
23+
BUILD_TYPE: "Win32"
3424
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
35-
- PHP_TARGET: 7.2
36-
PHP_VC: 15
37-
PHP_MAJOR: 7
38-
PHP_BUILD_TYPE: "nts-Win32"
25+
- PHP_MINOR: 7.2
26+
VC_VERSION: 15
27+
BUILD_TYPE: "nts-Win32"
3928
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
40-
PHP_DIR: c:\projects\php
41-
PHP_SDK: c:\projects\php-sdk
42-
PHP_DEVPACK: c:\projects\php-devpack
43-
PHP_SDK_BINARY_TOOLS_VER: php-sdk-2.0.7
29+
PHP_PATH: C:\Projects\php
30+
PHP_SDK_PATH: C:\Projects\php-sdk
31+
DEVPACK_PATH: C:\Projects\php-devpack
32+
PHP_SDK_VERSION: 2.0.7
4433
NO_INTERACTION: 1
4534
REPORT_EXIT_STATUS: 1
35+
PACKAGE_PREFIX: zephir_parser
36+
EXTENSION_NAME: "Zephir Parser"
37+
EXTENSION_FILE: php_zephir_parser.dll
4638

47-
# this is how to allow failing jobs in the matrix
4839
matrix:
49-
# immediately finish build once one of the jobs fails
5040
fast_finish: true
5141

52-
# clone entire repository history if not defined
53-
clone_depth: 1
54-
55-
# clone directory
56-
clone_folder: c:\projects\parser
42+
cache:
43+
- 'C:\Downloads -> .appveyor.yml'
5744

58-
#---------------------------------#
59-
# build configuration #
60-
#---------------------------------#
45+
clone_depth: 1
46+
clone_folder: C:\Projects\php-zephir-parser
6147

62-
# build platform, i.e. x86, x64, AnyCPU
6348
platform:
6449
- x86
6550
- x64
@@ -69,165 +54,44 @@ branches:
6954
- master
7055
- development
7156

72-
# scripts that are called at very beginning, before repo cloning
73-
init:
74-
- SET PATH=C:\Program Files (x86)\MSBuild\%PHP_VC%.0\Bin;C:\Program Files (x86)\Microsoft Visual Studio %PHP_VC%.0\VC;C:\Program Files (x86)\Microsoft Visual Studio %PHP_VC%.0\VC\bin;%PHP_SDK%\bin;%PHP_DIR%\bin;%PHP_DIR%;%PATH%
75-
- SET ANSICON=121x90 (121x90)
76-
# ==================================================
77-
- echo Setting PHP version...
78-
# ==================================================
79-
- appveyor DownloadFile http://windows.php.net/downloads/releases/sha1sum.txt
80-
- ps: |
81-
$versions = type sha1sum.txt | where { $_ -match "php-(${env:PHP_TARGET}\.\d+)-src" } | foreach { $matches[1] }
82-
$version = $versions.Split(' ')[-1]
83-
$env:PHP_VERSION=${version}
84-
- cmd: rm sha1sum.txt
85-
- ps: >-
86-
If ($env:PHP_VC -eq '14') {
87-
$env:VSCOMNTOOLS=$env:VS120COMNTOOLS
88-
} elseif ($env:PHP_VC -eq '15') {
89-
$env:VSCOMNTOOLS=$env:VS140COMNTOOLS
90-
}
91-
- ps: >-
92-
If ($env:PLATFORM -eq 'x86') {
93-
$env:ARCH='x86'
94-
If ($env:PHP_BUILD_TYPE -Match "nts-Win32") {
95-
$env:RELEASE_FOLDER="Release"
96-
} Else {
97-
$env:RELEASE_FOLDER="Release_TS"
98-
}
99-
} Else {
100-
$env:ARCH='x86_amd64'
101-
If ($env:PHP_BUILD_TYPE -Match "nts-Win32") {
102-
$env:RELEASE_FOLDER="x64\Release"
103-
} Else {
104-
$env:RELEASE_FOLDER="x64\Release_TS"
105-
}
106-
}
107-
- ps: >-
108-
If ($env:PHP_BUILD_TYPE -Match "nts-Win32") {
109-
$env:RELEASE_ZIPBALL="zephir_parser_${env:PLATFORM}_vc${env:PHP_VC}_php${env:PHP_TARGET}-nts_${env:APPVEYOR_BUILD_VERSION}"
110-
} Else {
111-
$env:RELEASE_ZIPBALL="zephir_parser_${env:PLATFORM}_vc${env:PHP_VC}_php${env:PHP_TARGET}_${env:APPVEYOR_BUILD_VERSION}"
112-
}
113-
- ps: $env:DEVEL_PACK_VERSION="${env:PHP_VERSION}-${env:PHP_BUILD_TYPE}-vc${env:PHP_VC}-${env:PLATFORM}"
114-
115-
# scripts that run after cloning repository
11657
install:
117-
# ==================================================
118-
# Install PHP SDK binary tools
119-
# ==================================================
120-
- ps: (new-object net.webclient).DownloadFile('https://github.com/OSTC/php-sdk-binary-tools/archive/' + ${env:PHP_SDK_BINARY_TOOLS_VER} + '.zip', ${env:APPVEYOR_BUILD_FOLDER} + '\php-sdk-binary-tools-' + ${env:PHP_SDK_BINARY_TOOLS_VER} + '.zip')
121-
- 7z x -y php-sdk-binary-tools-%PHP_SDK_BINARY_TOOLS_VER%.zip -oC:\projects
122-
- move C:\projects\php-sdk-binary-tools-%PHP_SDK_BINARY_TOOLS_VER% %PHP_SDK%
123-
# ==================================================
124-
# Downloading PHP source code
125-
# ==================================================
126-
- ps: (new-object net.webclient).DownloadFile('http://windows.php.net/downloads/releases/php-' + ${env:PHP_VERSION} + '-' + ${env:PHP_BUILD_TYPE} + '-vc' + ${env:PHP_VC} + '-' + ${env:PLATFORM} + '.zip', ${env:APPVEYOR_BUILD_FOLDER} + '\php.zip')
127-
- 'mkdir %PHP_DIR% && mv php.zip %PHP_DIR%\php.zip && cd %PHP_DIR%'
128-
- 7z.exe x php.zip | FIND /V "ing "
129-
# ==================================================
130-
# Install PHP Dev pack
131-
# ==================================================
132-
- 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')
133-
- cd %APPVEYOR_BUILD_FOLDER%
134-
- 7z.exe x php-dev.zip | FIND /V "ing "
135-
- move %APPVEYOR_BUILD_FOLDER%\php-%PHP_VERSION%-devel-VC%PHP_VC%-%PLATFORM% %PHP_DEVPACK%
58+
- git submodule update --init
59+
- ps: Import-Module .\tests\ci\AppVeyor.psm1
60+
- ps: AppendSessionPath
61+
- ps: SetupPhpVersionString
62+
- ps: EnsureRequiredDirectoriesPresent
63+
- ps: Ensure7ZipIsInstalled
64+
- ps: InstallSdk
65+
- ps: InstallPhp
66+
- ps: InstallPhpDevPack
67+
- ps: TuneUpPhp
13668

137-
# to run custom scripts instead of automatic MSBuild
13869
build_script:
139-
# ==================================================
140-
# Initializing Build...
141-
# ==================================================
142-
- cd %APPVEYOR_BUILD_FOLDER%
143-
- git submodule update --init --recursive
70+
- ps: InitializeBuildVars
14471
- '"%VSCOMNTOOLS%\VsDevCmd" %PLATFORM%'
14572
- '"%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat" %ARCH%'
146-
# ==================================================
147-
# Build Zephir Parser
148-
# ==================================================
149-
- cd %APPVEYOR_BUILD_FOLDER%
150-
- '%PHP_SDK%\bin\phpsdk_setvars'
151-
- cmd /c build-win32-php%PHP_MAJOR%.bat
152-
- '%PHP_DEVPACK%\phpize.bat'
153-
- configure --disable-all --enable-zephir_parser=shared
73+
- '%PHP_SDK_PATH%\bin\phpsdk_setvars'
74+
- cmd /c build-win32-php7.bat
75+
- '%DEVPACK_PATH%\phpize.bat'
76+
- 'configure --with-prefix=%PHP_PATH% --with-php-build=%DEVPACK_PATH% --disable-all --enable-zephir_parser=shared'
15477
- nmake 2> compile-errors.log 1> compile.log
155-
- 'cd %PHP_DIR%'
156-
- 'echo extension_dir=%PHP_DIR%\ext > php.ini'
157-
- 'echo extension=%APPVEYOR_BUILD_FOLDER%\%RELEASE_FOLDER%\php_zephir_parser.dll >> php.ini'
158-
- php -v
159-
- php --ri "Zephir Parser"
78+
- ps: InitializeReleaseVars
79+
- ps: EnableExtension
16080

161-
# scripts to run after build
16281
after_build:
163-
- cd %APPVEYOR_BUILD_FOLDER%
164-
- mkdir %APPVEYOR_BUILD_FOLDER%\package
165-
# ==================================================
166-
- echo Convert *.md files to *.html
167-
# ==================================================
168-
- cinst pandoc
169-
- pandoc -v
170-
- cmd: for %%i in (*.md) do pandoc -f markdown -t html5 %%~ni.md > package/%%~ni.html
171-
# ==================================================
172-
- echo Collect artifacts and zip
173-
# ==================================================
174-
- cd %APPVEYOR_BUILD_FOLDER%\package
175-
# dll
176-
- copy %APPVEYOR_BUILD_FOLDER%\%RELEASE_FOLDER%\php_zephir_parser.dll .\
177-
# docs
178-
- 'echo Release date: %DATE% %TIME% > RELEASE.txt'
179-
- 'echo Release version: %APPVEYOR_BUILD_VERSION% >> RELEASE.txt'
180-
- 'echo Git commit: %APPVEYOR_REPO_COMMIT% >> RELEASE.txt'
181-
- 'echo Build type: %PHP_BUILD_TYPE% >> RELEASE.txt'
182-
- 'echo Platform: %PLATFORM% >> RELEASE.txt'
183-
- 'echo Target PHP version: %PHP_TARGET% >> RELEASE.txt'
184-
- 'echo Build worker image: %APPVEYOR_BUILD_WORKER_IMAGE% >> RELEASE.txt'
185-
- cp %APPVEYOR_BUILD_FOLDER%\LICENSE .\
186-
- cp %APPVEYOR_BUILD_FOLDER%\CREDITS .\
187-
- cp %APPVEYOR_BUILD_FOLDER%\VERSION .\
188-
- cp %APPVEYOR_BUILD_FOLDER%\README.WIN32-BUILD-SYSTEM .\
189-
- cp %APPVEYOR_BUILD_FOLDER%\NO_WARRANTY .\
190-
- 7z a %RELEASE_ZIPBALL%.zip *.*
191-
- mv %RELEASE_ZIPBALL%.zip %APPVEYOR_BUILD_FOLDER%\
192-
193-
#---------------------------------#
194-
# artifacts configuration #
195-
#---------------------------------#
82+
- ps: InstallBuildDependencies
83+
- ps: PrepareReleasePackage
19684

19785
artifacts:
198-
# pushing a single file with environment variable in path and "Deployment name" specified
19986
- path: '.\$(RELEASE_ZIPBALL).zip'
20087
type: zip
20188
name: ZephirParser
20289

203-
#---------------------------------#
204-
# global handlers #
205-
#---------------------------------#
206-
207-
208-
# If you need to investigate worker on build finish uncomment this
209-
# to display Remote Desktop connection details and pause the build
210-
# until a special “lock” file on VM desktop is deleted
211-
#on_finish:
212-
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
213-
214-
on_success:
215-
- 'dir'
216-
21790
on_failure:
218-
- 'dir'
219-
- ps: >-
220-
If (Test-Path -Path ${env:APPVEYOR_BUILD_FOLDER}\compile-errors.log) {
221-
type ${env:APPVEYOR_BUILD_FOLDER}\compile-errors.log
222-
}
223-
224-
If (Test-Path -Path ${env:APPVEYOR_BUILD_FOLDER}\compile.log) {
225-
type ${env:APPVEYOR_BUILD_FOLDER}\compile.log
226-
}
227-
228-
If (Test-Path -Path ${env:APPVEYOR_BUILD_FOLDER}\configure.js) {
229-
type ${env:APPVEYOR_BUILD_FOLDER}\configure.js
230-
}
91+
- ps: PrintLogs
92+
- ps: PrintVars
93+
- ps: PrintDirectoriesContent
94+
- ps: PrintPhpInfo
23195

23296
notifications:
23397
- provider: Email

config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if (PHP_SECURITY_FLAGS == "yes") {
66
ADD_FLAG("LDFLAGS", "/NXCOMPAT /DYNAMICBASE ");
77
}
88

9-
ARG_ENABLE("zephir_parser", "whether to enable Zephir Parser", "no");
9+
ARG_ENABLE("zephir_parser", "Whether to enable Zephir Parser", "no");
1010
if (PHP_ZEPHIR_PARSER == "yes") {
1111
EXTENSION("zephir_parser", "zephir_parser.c", null, "-I" + configure_module_dirname);
1212
ADD_SOURCES(configure_module_dirname + "/parser", "parser.c scanner.c", "zephir_parser");

0 commit comments

Comments
 (0)