Skip to content

Commit 1985dfc

Browse files
authored
Refactor build/test processes and CIs configuration (#40)
1 parent f3afc60 commit 1985dfc

36 files changed

+570
-2528
lines changed

.appveyor.yml

Lines changed: 70 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,94 @@
11
version: 1.1.3-{build}
22

33
environment:
4-
matrix:
5-
- PHP_MINOR: 7.0
6-
VC_VERSION: 14
7-
BUILD_TYPE: "Win32"
8-
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
9-
- PHP_MINOR: 7.0
10-
VC_VERSION: 14
11-
BUILD_TYPE: "nts-Win32"
12-
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
13-
- PHP_MINOR: 7.1
14-
VC_VERSION: 14
15-
BUILD_TYPE: "Win32"
16-
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
17-
- PHP_MINOR: 7.1
18-
VC_VERSION: 14
19-
BUILD_TYPE: "nts-Win32"
20-
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
21-
- PHP_MINOR: 7.2
22-
VC_VERSION: 15
23-
BUILD_TYPE: "Win32"
24-
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
25-
- PHP_MINOR: 7.2
26-
VC_VERSION: 15
27-
BUILD_TYPE: "nts-Win32"
28-
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
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
33-
NO_INTERACTION: 1
34-
REPORT_EXIT_STATUS: 1
35-
PACKAGE_PREFIX: zephir_parser
36-
EXTENSION_NAME: "Zephir Parser"
37-
EXTENSION_FILE: php_zephir_parser.dll
4+
matrix:
5+
- PHP_MINOR: 7.0
6+
VC_VERSION: 14
7+
BUILD_TYPE: "Win32"
8+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
9+
- PHP_MINOR: 7.0
10+
VC_VERSION: 14
11+
BUILD_TYPE: "nts-Win32"
12+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
13+
- PHP_MINOR: 7.1
14+
VC_VERSION: 14
15+
BUILD_TYPE: "Win32"
16+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
17+
- PHP_MINOR: 7.1
18+
VC_VERSION: 14
19+
BUILD_TYPE: "nts-Win32"
20+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
21+
- PHP_MINOR: 7.2
22+
VC_VERSION: 15
23+
BUILD_TYPE: "Win32"
24+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
25+
- PHP_MINOR: 7.2
26+
VC_VERSION: 15
27+
BUILD_TYPE: "nts-Win32"
28+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
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
33+
NO_INTERACTION: 1
34+
REPORT_EXIT_STATUS: 1
35+
PACKAGE_PREFIX: zephir_parser
36+
EXTENSION_NAME: "Zephir Parser"
37+
EXTENSION_FILE: php_zephir_parser.dll
3838

3939
matrix:
40-
fast_finish: true
40+
fast_finish: true
4141

4242
cache:
43-
- 'C:\Downloads -> .appveyor.yml'
43+
- 'C:\Downloads -> .appveyor.yml'
4444

4545
clone_depth: 1
4646
clone_folder: C:\Projects\php-zephir-parser
4747

4848
platform:
49-
- x86
50-
- x64
49+
- x86
50+
- x64
5151

5252
branches:
53-
only:
54-
- master
55-
- development
53+
only:
54+
- master
55+
- development
5656

5757
install:
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
58+
- git submodule update --init
59+
- ps: Import-Module .\.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
6868

6969
build_script:
70-
- ps: InitializeBuildVars
71-
- '"%VSCOMNTOOLS%\VsDevCmd" %PLATFORM%'
72-
- '"%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat" %ARCH%'
73-
- phpsdk_setvars
74-
- cmd /c build-win32-php7.bat
75-
- phpize
76-
- cmd: 'configure --with-prefix=%PHP_PATH% --with-php-build=%DEVPACK_PATH% --disable-all --enable-zephir_parser=shared'
77-
- cmd: nmake 2> compile-errors.log 1> compile.log
78-
- ps: InitializeReleaseVars
79-
- ps: EnableExtension
70+
- ps: InitializeBuildVars
71+
- '"%VSCOMNTOOLS%\VsDevCmd" %PLATFORM%'
72+
- '"%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat" %ARCH%'
73+
- phpsdk_setvars
74+
- cmd /c build-win32-php7.bat
75+
- phpize
76+
- cmd: 'configure --with-prefix=%PHP_PATH% --with-php-build=%DEVPACK_PATH% --disable-all --enable-zephir_parser=shared'
77+
- cmd: nmake 2> compile-errors.log 1> compile.log
78+
- ps: InitializeReleaseVars
79+
- ps: EnableExtension
8080

8181
after_build:
82-
- ps: InstallBuildDependencies
83-
- ps: PrepareReleasePackage
82+
- ps: InstallBuildDependencies
83+
- ps: PrepareReleasePackage
8484

8585
artifacts:
86-
- path: '.\$(RELEASE_ZIPBALL).zip'
87-
type: zip
88-
name: ZephirParser
86+
- path: '.\$(RELEASE_ZIPBALL).zip'
87+
type: zip
88+
name: ZephirParser
8989

9090
on_failure:
91-
- ps: PrintBuildArtifacts
92-
- ps: PrintVars
93-
- ps: PrintDirectoriesContent
94-
- ps: PrintPhpInfo
95-
96-
notifications:
97-
- provider: Email
98-
to:
99-
100-
subject: "Build Zephir Parser [{{status}}]"
101-
on_build_status_changed: true
91+
- ps: PrintBuildArtifacts
92+
- ps: PrintVars
93+
- ps: PrintDirectoriesContent
94+
- ps: PrintPhpInfo

tests/ci/AppVeyor.psm1 renamed to .ci/AppVeyor.psm1

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# This file is part of the Zephir Parser.
2+
#
3+
# (c) Zephir Team <[email protected]>
4+
#
5+
# For the full copyright and license information, please view the LICENSE
6+
# file that was distributed with this source code.
7+
18
Function EnsureRequiredDirectoriesPresent {
29
If (-not (Test-Path 'C:\Downloads')) {
310
New-Item -ItemType Directory -Force -Path 'C:\Downloads' | Out-Null
@@ -13,7 +20,7 @@ Function Ensure7ZipIsInstalled {
1320
$7zipInstallationDirectory = "${Env:ProgramFiles}\7-Zip"
1421

1522
If (-not (Test-Path "$7zipInstallationDirectory")) {
16-
throw "The 7-zip file archiver is needed to use this module"
23+
Throw "The 7-zip file archiver is needed to use this module"
1724
}
1825

1926
$Env:Path += ";$7zipInstallationDirectory"
@@ -25,7 +32,7 @@ Function EnsureChocolateyIsInstalled {
2532
$ChocolateyInstallationDirectory = "${Env:ProgramData}\chocolatey\bin"
2633

2734
If (-not (Test-Path "$ChocolateyInstallationDirectory")) {
28-
throw "The choco is needed to use this module"
35+
Throw "The choco is needed to use this module"
2936
}
3037

3138
$Env:Path += ";$ChocolateyInstallationDirectory"
@@ -37,7 +44,7 @@ Function EnsurePandocIsInstalled {
3744
$PandocInstallationDirectory = "${Env:ProgramData}\chocolatey\bin"
3845

3946
If (-not (Test-Path "$PandocInstallationDirectory")) {
40-
throw "The pandoc is needed to use this module"
47+
Throw "The pandoc is needed to use this module"
4148
}
4249

4350
$Env:Path += ";$PandocInstallationDirectory"
@@ -124,20 +131,20 @@ Function InitializeBuildVars {
124131
switch ($Env:VC_VERSION) {
125132
'14' {
126133
If (-not (Test-Path $Env:VS120COMNTOOLS)) {
127-
throw 'The VS120COMNTOOLS environment variable is not set. Check your MS VS installation'
134+
Throw 'The VS120COMNTOOLS environment variable is not set. Check your MS VS installation'
128135
}
129136
$Env:VSCOMNTOOLS = $Env:VS120COMNTOOLS
130137
break
131138
}
132139
'15' {
133140
If (-not (Test-Path $Env:VS140COMNTOOLS)) {
134-
throw 'The VS140COMNTOOLS environment variable is not set. Check your MS VS installation'
141+
Throw 'The VS140COMNTOOLS environment variable is not set. Check your MS VS installation'
135142
}
136143
$Env:VSCOMNTOOLS = $Env:VS140COMNTOOLS
137144
break
138145
}
139146
default {
140-
throw 'This script is designed to run with MS VS 14/15. Check your MS VS installation'
147+
Throw 'This script is designed to run with MS VS 14/15. Check your MS VS installation'
141148
break
142149
}
143150
}
@@ -205,7 +212,7 @@ Function PrepareReleasePackage {
205212
$7zipExitCode = $LASTEXITCODE
206213
If ($7zipExitCode -ne 0) {
207214
Set-Location "${CurrentPath}"
208-
throw "An error occurred while creating release zippbal to [${Env:RELEASE_ZIPBALL}.zip]. 7Zip Exit Code was [${7zipExitCode}]"
215+
Throw "An error occurred while creating release zippbal to [${Env:RELEASE_ZIPBALL}.zip]. 7Zip Exit Code was [${7zipExitCode}]"
209216
}
210217

211218
Move-Item "${Env:RELEASE_ZIPBALL}.zip" -Destination "${Env:APPVEYOR_BUILD_FOLDER}"
@@ -234,13 +241,19 @@ Function SetupPhpVersionString {
234241
$DestinationPath = "${Env:Temp}\php-sha1sum.txt"
235242

236243
If (-not [System.IO.File]::Exists($DestinationPath)) {
237-
Write-Host "Downloading PHP SHA Sums: $RemoteUrl..."
244+
Write-Host "Downloading PHP SHA Sums: ${RemoteUrl}..."
238245
DownloadFile $RemoteUrl $DestinationPath
239246
}
240247

241-
$versions = Get-Content $DestinationPath | Where-Object { $_ -match "php-($Env:PHP_MINOR\.\d+)-src" } | ForEach-Object { $matches[1] }
248+
$VersionString = Get-Content $DestinationPath | Where-Object {
249+
$_ -match "php-($Env:PHP_MINOR\.\d+)-src"
250+
} | ForEach-Object { $matches[1] }
251+
252+
If ($VersionString -NotMatch '\d+\.\d+\.\d+') {
253+
Throw "Unable to obtain PHP version string using pattern 'php-($Env:PHP_MINOR\.\d+)-src'"
254+
}
242255

243-
$Env:PHP_VERSION = $versions.Split(' ')[-1]
256+
$Env:PHP_VERSION = $VersionString.Split(' ')[-1]
244257
}
245258

246259
Function TuneUpPhp {
@@ -250,7 +263,7 @@ Function TuneUpPhp {
250263
Write-Host "Tune up PHP: $IniFile" -foregroundcolor Cyan
251264

252265
If (-not [System.IO.File]::Exists($IniFile)) {
253-
throw "Unable to locate $IniFile file"
266+
Throw "Unable to locate $IniFile file"
254267
}
255268

256269
Write-Output "" | Out-File -Encoding "ASCII" -Append $IniFile
@@ -272,11 +285,11 @@ Function EnableExtension {
272285
$PhpExe = "${Env:PHP_PATH}\php.exe"
273286

274287
If (-not [System.IO.File]::Exists($IniFile)) {
275-
throw "Unable to locate ${IniFile}"
288+
Throw "Unable to locate ${IniFile}"
276289
}
277290

278291
If (-not (Test-Path "${ExtPath}")) {
279-
throw "Unable to locate extension path: ${ExtPath}"
292+
Throw "Unable to locate extension path: ${ExtPath}"
280293
}
281294

282295
Write-Output "[${Env:EXTENSION_NAME}]" | Out-File -Encoding "ASCII" -Append $IniFile
@@ -288,7 +301,7 @@ Function EnableExtension {
288301
$PhpExitCode = $LASTEXITCODE
289302
If ($PhpExitCode -ne 0) {
290303
PrintPhpInfo
291-
throw "An error occurred while enabling [${Env:EXTENSION_NAME}] in [$IniFile]. PHP Exit Code was [$PhpExitCode]."
304+
Throw "An error occurred while enabling [${Env:EXTENSION_NAME}] in [$IniFile]. PHP Exit Code was [$PhpExitCode]."
292305
}
293306
}
294307
}
@@ -347,7 +360,7 @@ Function Expand-Item7zip {
347360
)
348361

349362
If (-not (Test-Path -Path $Archive -PathType Leaf)) {
350-
throw "Specified archive File is invalid: [$Archive]"
363+
Throw "Specified archive File is invalid: [$Archive]"
351364
}
352365

353366
If (-not (Test-Path -Path $Destination -PathType Container)) {
@@ -358,7 +371,7 @@ Function Expand-Item7zip {
358371

359372
$7zipExitCode = $LASTEXITCODE
360373
If ($7zipExitCode -ne 0) {
361-
throw "An error occurred while unzipping [$Archive] to [$Destination]. 7Zip Exit Code was [$7zipExitCode]"
374+
Throw "An error occurred while unzipping [$Archive] to [$Destination]. 7Zip Exit Code was [$7zipExitCode]"
362375
}
363376
}
364377

@@ -374,7 +387,8 @@ Function DownloadFile {
374387
$RetryCount = 0
375388
$Completed = $false
376389

377-
$WebClient = new-object System.Net.WebClient
390+
$WebClient = New-Object System.Net.WebClient
391+
$WebClient.Headers.Add('User-Agent', 'AppVeyor PowerShell Script')
378392

379393
While (-not $Completed) {
380394
Try {

.ci/after-failure.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This file is part of the Zephir.
4+
#
5+
# (c) Zephir Team <[email protected]>
6+
#
7+
# For the full copyright and license information, please view the LICENSE
8+
# file that was distributed with this source code.
9+
10+
$(phpenv which php) -v
11+
$(phpenv which php) -m
12+
13+
PROJECT_ROOT=$(readlink -enq "$(dirname $0)/../")
14+
cd ${PROJECT_ROOT}
15+
16+
shopt -s nullglob
17+
18+
for i in `find ./tests -name "*.out" 2>/dev/null`; do
19+
echo "-- START ${i}"; cat ${i}; echo "-- END";
20+
done
21+
22+
for i in `find ./tests -name "*.mem" 2>/dev/null`; do
23+
echo "-- START ${i}"; cat ${i}; echo "-- END";
24+
done
25+
26+
if [ -f "./configure.log" ]; then
27+
cat "./configure.log"
28+
fi
29+
30+
ls -al ${PROJECT_ROOT}
31+
32+
export LC_ALL=C
33+
34+
for i in core core.*; do
35+
if [ -f "$i" -a "$(file "$i" | grep -o 'core file')" ]; then
36+
gdb -q $(file "${i}" | grep -oE "'[^ ']+" | sed "s/^'//g") "$i" <<EOF
37+
set pagination 0
38+
backtrace full
39+
info registers
40+
x/16i \$pc
41+
thread apply all backtrace
42+
quit
43+
EOF
44+
fi
45+
done

.ci/build.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This file is part of the Zephir Parser.
4+
#
5+
# (c) Zephir Team <[email protected]>
6+
#
7+
# For the full copyright and license information, please view the LICENSE
8+
# file that was distributed with this source code.
9+
10+
$(phpenv which phpize)
11+
12+
# The ltmain.sh which bundled with PHP it's from libtool 1.5.26.
13+
# However, the version of libtool that claims to no longer remove
14+
# ".gcno" profiler information is libtool 2.2.6. The fix is probably
15+
# in later libtool versions as well.
16+
aclocal && libtoolize --copy --force && autoheader && autoconf
17+
18+
./configure \
19+
--with-php-config=$(phpenv which php-config) \
20+
--enable-zephir_parser \
21+
--enable-coverage \
22+
CCACHE_DISABLE=1
23+
24+
make -j"$(getconf _NPROCESSORS_ONLN)"

0 commit comments

Comments
 (0)