diff --git a/.ci/appveyor.psm1 b/.ci/appveyor.psm1 deleted file mode 100644 index 2d4f816..0000000 --- a/.ci/appveyor.psm1 +++ /dev/null @@ -1,289 +0,0 @@ - -# @author Serghei Iakovlev - -Function InitializeReleaseVars { - If ($Env:PLATFORM -eq 'x86') { - If ($Env:PHP_BUILD_TYPE -Match "nts-Win32") { - $Env:RELEASE_FOLDER = "${Env:APPVEYOR_BUILD_FOLDER}\Release" - } Else { - $Env:RELEASE_FOLDER = "${Env:APPVEYOR_BUILD_FOLDER}\Release_TS" - } - } Else { - If ($Env:PHP_BUILD_TYPE -Match "nts-Win32") { - $Env:RELEASE_FOLDER = "${Env:APPVEYOR_BUILD_FOLDER}\${Env:PLATFORM}\Release" - } Else { - $Env:RELEASE_FOLDER = "${Env:APPVEYOR_BUILD_FOLDER}\${Env:PLATFORM}\Release_TS" - } - } - - $Env:RELEASE_ZIPBALL = "mustache_${Env:PLATFORM}_${Env:VC_VER}_${Env:PHP_VER}_${Env:APPVEYOR_BUILD_VERSION}" -} - -Function InstallPhpDevPack { - Write-Host "Install PHP Dev pack: ${Env:PHP_FULL_VER}" -foregroundcolor Cyan - - $RemoteUrl = "http://windows.php.net/downloads/releases/php-devel-pack-${Env:PHP_FULL_VER}-${Env:PHP_BUILD_TYPE}-${Env:VC_VER}-${Env:PLATFORM}.zip" - $DestinationPath = "C:\Downloads\php-devel-pack-${Env:PHP_FULL_VER}-${Env:PHP_BUILD_TYPE}-${Env:VC_VER}-${Env:PLATFORM}.zip" - $InstallPath = 'C:\Projects\php-devpack' - - If (-not (Test-Path $InstallPath)) { - If (-not [System.IO.File]::Exists($DestinationPath)) { - Write-Host "Downloading PHP Dev pack: ${RemoteUrl} ..." - DownloadFile $RemoteUrl $DestinationPath - } - - $DestinationUnzipPath = "${Env:Temp}\php-${Env:PHP_FULL_VER}-devel-${Env:VC_VER}-${Env:PLATFORM}" - - If (-not (Test-Path "$DestinationUnzipPath")) { - Expand-Item7zip $DestinationPath $Env:Temp - } - - Move-Item -Path $DestinationUnzipPath -Destination $InstallPath - } -} - -Function InstallPhp { - Write-Host "Install PHP: ${Env:PHP_FULL_VER}" -foregroundcolor Cyan - - $RemoteUrl = "http://windows.php.net/downloads/releases/php-${Env:PHP_FULL_VER}-${Env:PHP_BUILD_TYPE}-${Env:VC_VER}-${Env:PLATFORM}.zip" - $DestinationPath = "C:\Downloads\php-${Env:PHP_FULL_VER}-${Env:PHP_BUILD_TYPE}-${Env:VC_VER}-${Env:PLATFORM}.zip" - $InstallPath = 'C:\Projects\php' - - If (-not (Test-Path $InstallPath)) { - If (-not [System.IO.File]::Exists($DestinationPath)) { - Write-Host "Downloading PHP source code: ${RemoteUrl} ..." - DownloadFile $RemoteUrl $DestinationPath - } - - Expand-Item7zip $DestinationPath $InstallPath - } - - If (-not (Test-Path "${InstallPath}\php.ini")) { - Copy-Item "${InstallPath}\php.ini-development" "${InstallPath}\php.ini" - } -} - -Function InstallSdk { - Write-Host "Install PHP SDK binary tools: ${Env:PHP_SDK_BINARY_TOOLS_VER}" -foregroundcolor Cyan - - $RemoteUrl = "https://github.com/Microsoft/php-sdk-binary-tools/archive/php-sdk-${Env:PHP_SDK_BINARY_TOOLS_VER}.zip" - $DestinationPath = "C:\Downloads\php-sdk-${Env:PHP_SDK_BINARY_TOOLS_VER}.zip" - $InstallPath = 'C:\Projects\php-sdk' - - If (-not (Test-Path $InstallPath)) { - If (-not [System.IO.File]::Exists($DestinationPath)) { - Write-Host "Downloading PHP SDK binary tools: ${RemoteUrl} ..." - DownloadFile $RemoteUrl $DestinationPath - } - - $DestinationUnzipPath = "${Env:Temp}\php-sdk-binary-tools-php-sdk-${Env:PHP_SDK_BINARY_TOOLS_VER}" - - If (-not (Test-Path "$DestinationUnzipPath")) { - Expand-Item7zip $DestinationPath $Env:Temp - } - - Move-Item -Path $DestinationUnzipPath -Destination $InstallPath - } -} - -Function Ensure7ZipIsInstalled { - If (-not (Get-Command "7z" -ErrorAction SilentlyContinue)) { - $7zipInstallationDirectory = "${Env:ProgramFiles}\7-Zip" - - If (-not (Test-Path "$7zipInstallationDirectory")) { - Throw "The 7-zip file archiver is needed to use this module" - } - - $Env:Path += ";$7zipInstallationDirectory" - } -} - -Function EnsureRequiredDirectoriesPresent { - If (-not (Test-Path 'C:\Downloads')) { - New-Item -ItemType Directory -Force -Path 'C:\Downloads' | Out-Null - } - - If (-not (Test-Path 'C:\Projects')) { - New-Item -ItemType Directory -Force -Path 'C:\Projects' | Out-Null - } -} - -Function InitializeBuildVars { - switch ($Env:VC_VER) { - 'vc14' { - If (-not (Test-Path $Env:VS120COMNTOOLS)) { - Throw'The VS120COMNTOOLS environment variable is not set. Check your VS installation' - } - - $Env:VSCOMNTOOLS = $Env:VS120COMNTOOLS -replace '\\$', '' - Break - } - 'vc15' { - If (-not (Test-Path $Env:VS140COMNTOOLS)) { - Throw'The VS140COMNTOOLS environment variable is not set. Check your VS installation' - } - - $Env:VSCOMNTOOLS = $Env:VS140COMNTOOLS -replace '\\$', '' - Break - } - default { - Throw 'This script is designed to run with VS 14/15. Check your VS installation' - } - } - - If ($Env:PLATFORM -eq 'x64') { - $Env:ARCH = 'x86_amd64' - } Else { - $Env:ARCH = 'x86' - } -} - -Function AppendSessionPath { - [string[]] $PathsCollection = @( - "C:\Projects\php-sdk\bin", - "C:\Projects\php\bin", - "C:\Projects\php", - "C:\Projects\php-devpack", - "C:\Projects\output\bin", - "C:\Projects\output\lib", - "C:\Projects\output" - ) - - $CurrentPath = (Get-Item -Path ".\" -Verbose).FullName - - ForEach ($PathItem In $PathsCollection) { - Set-Location Env: - $AllPaths = (Get-ChildItem Path).value.split(";") | Sort-Object -Unique - - $AddToPath = $true - - ForEach ($AddedPath In $AllPaths) { - If (-not "${AddedPath}") { - Continue - } - - $AddedPath = $AddedPath -replace '\\$', '' - - If ($PathItem -eq $AddedPath) { - $AddToPath = $false - } - } - - If ($AddToPath) { - $Env:Path += ";${PathItem}" - } - } - - Set-Location "${CurrentPath}" -} - -Function SetupPhpVersionString { - $RemoteUrl = 'http://windows.php.net/downloads/releases/sha256sum.txt' - $DestinationPath = "${Env:Temp}\php-sha256sum.txt" - - If (-not [System.IO.File]::Exists($DestinationPath)) { - Write-Host "Downloading PHP SHA Sums: ${RemoteUrl} ..." - DownloadFile $RemoteUrl $DestinationPath - } - - $VersionString = Get-Content $DestinationPath | Where-Object { - $_ -match "php-($Env:PHP_VER\.\d+)-src" - } | ForEach-Object { $matches[1] } - - If ($VersionString -NotMatch '\d+\.\d+\.\d+') { - Throw "Unable to obtain PHP version string using pattern 'php-($Env:PHP_MINOR\.\d+)-src'" - } - - $Env:PHP_FULL_VER = $VersionString -} - -Function Expand-Item7zip { - Param( - [Parameter(Mandatory=$true)][System.String] $Archive, - [Parameter(Mandatory=$true)][System.String] $Destination - ) - - If (-not (Test-Path -Path $Archive -PathType Leaf)) { - Throw "Specified archive File is invalid: [$Archive]" - } - - If (-not (Test-Path -Path $Destination -PathType Container)) { - New-Item $Destination -ItemType Directory | Out-Null - } - - $Result = (& 7z x "$Archive" "-o$Destination" -aoa -bd -y -r) - - $7zipExitCode = $LASTEXITCODE - If ($7zipExitCode -ne 0) { - Throw "An error occurred while unzipping [$Archive] to [$Destination]. 7Zip Exit Code was [$7zipExitCode]" - } -} - -Function PrintLogs { - If (Test-Path -Path "${Env:APPVEYOR_BUILD_FOLDER}\compile-errors.log") { - Get-Content -Path "${Env:APPVEYOR_BUILD_FOLDER}\compile-errors.log" - } - - If (Test-Path -Path "${Env:APPVEYOR_BUILD_FOLDER}\compile.log") { - Get-Content -Path "${Env:APPVEYOR_BUILD_FOLDER}\compile.log" - } - - If (Test-Path -Path "${Env:APPVEYOR_BUILD_FOLDER}\configure.js") { - Get-Content -Path "${Env:APPVEYOR_BUILD_FOLDER}\configure.js" - } -} - -Function PrepareReleasePackage { - $CurrentPath = (Get-Item -Path ".\" -Verbose).FullName - $PackagePath = "${Env:APPVEYOR_BUILD_FOLDER}\package" - - If (-not (Test-Path $PackagePath)) { - New-Item -ItemType Directory -Force -Path $PackagePath | Out-Null - } - - Copy-Item -Path (Join-Path -Path $Env:APPVEYOR_BUILD_FOLDER -ChildPath '\*') -Filter '*.md' -Destination "${PackagePath}" -Force - Copy-Item "${Env:RELEASE_FOLDER}\php_mustache.dll" "${PackagePath}" - - Set-Location "${PackagePath}" - $Result = (& 7z a "${Env:RELEASE_ZIPBALL}.zip" *.*) - - $7zipExitCode = $LASTEXITCODE - If ($7zipExitCode -ne 0) { - Set-Location "${CurrentPath}" - Throw "An error occurred while creating release zippbal to [${Env:RELEASE_ZIPBALL}.zip]. 7Zip Exit Code was [${7zipExitCode}]" - } - - Move-Item "${Env:RELEASE_ZIPBALL}.zip" -Destination "${Env:APPVEYOR_BUILD_FOLDER}" - - Set-Location "${CurrentPath}" -} - -Function DownloadFile { - param( - [Parameter(Mandatory=$true)][System.String] $RemoteUrl, - [Parameter(Mandatory=$true)][System.String] $DestinationPath - ) - - $RetryMax = 5 - $RetryCount = 0 - $Completed = $false - - $WebClient = New-Object System.Net.WebClient - $WebClient.Headers.Add('User-Agent', 'AppVeyor PowerShell Script') - - While (-not $Completed) { - Try { - $WebClient.DownloadFile($RemoteUrl, $DestinationPath) - $Completed = $true - } Catch { - If ($RetryCount -ge $RetryMax) { - $ErrorMessage = $_.Exception.Message - Write-Host "Error downloadingig ${RemoteUrl}: $ErrorMessage" - $Completed = $true - } Else { - $RetryCount++ - } - } - } -} - diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index c83ee0e..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,167 +0,0 @@ -version: '{branch}.{build}' - -branches: - only: - - master - - appveyor - - w32 - - windows - - ci - -platform: - - x86 - - x64 - -cache: - - 'C:\Downloads -> appveyor.yml' - -environment: - PHP_SDK_BINARY_TOOLS_VER: 2.1.9 - NO_INTERACTION: 1 - REPORT_EXIT_STATUS: 1 - TEST_PHP_EXECUTABLE: C:\projects\php\php.exe - LIBMUSTACHE_VERSION: v0.5.0 - - matrix: -# note: json-c is currently failing to compile on < vc15 -# - PHP_VER: 7.0 -# VC_VER: vc14 -# PHP_BUILD_TYPE: Win32 -# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 -# - PHP_VER: 7.0 -# VC_VER: vc14 -# PHP_BUILD_TYPE: nts-Win32 -# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 -# - PHP_VER: 7.1 -# VC_VER: vc14 -# PHP_BUILD_TYPE: Win32 -# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 -# - PHP_VER: 7.1 -# VC_VER: vc14 -# PHP_BUILD_TYPE: nts-Win32 -# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 - - PHP_VER: 7.2 - VC_VER: vc15 - PHP_BUILD_TYPE: Win32 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - - PHP_VER: 7.2 - VC_VER: vc15 - PHP_BUILD_TYPE: nts-Win32 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - - PHP_VER: 7.3 - VC_VER: vc15 - PHP_BUILD_TYPE: Win32 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - - PHP_VER: 7.3 - VC_VER: vc15 - PHP_BUILD_TYPE: nts-Win32 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - -install: -- cmd: cinst wget -- ps: Import-Module .\.ci\appveyor.psm1 -- ps: InitializeBuildVars -- '"%VSCOMNTOOLS%\VsDevCmd" %PLATFORM%' -- '"%VSCOMNTOOLS%\..\..\VC\vcvarsall.bat" %ARCH%' -# json-c -- cmd: >- - cd C:\projects - - git clone -b windows https://github.com/jbboehr/json-c.git - - cd json-c - - mkdir build - - cd build - - cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\projects\output -DCMAKE_BUILD_TYPE=Release .. - - nmake - - nmake install -# libyaml -- cmd: >- - cd C:\projects - - git clone https://github.com/yaml/libyaml - - cd libyaml - - mkdir build - - cd build - - cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\projects\output -DCMAKE_BUILD_TYPE=Release .. - - nmake - - copy /Y *.lib \projects\output\lib\ - - copy /Y ..\include\yaml.h \projects\output\include\ -# getopt.h -- cmd: >- - cd C:\projects - - git clone https://github.com/jbboehr/Getopt-for-Visual-Studio.git - - copy /Y Getopt-for-Visual-Studio\getopt.h output\include\ -# dirent.h -- cmd: >- - cd C:\projects - - git clone https://github.com/jbboehr/dirent.git - - copy /Y dirent\include\dirent.h output\include -# libmustache -- cmd: >- - cd C:\projects\ - - git clone -b %LIBMUSTACHE_VERSION% https://github.com/jbboehr/libmustache.git - - cd C:\projects\libmustache - - git submodule update --init - - mkdir build - - cd build - - SET LIBYAML_PATH=\projects\output - - SET LIBJSON_PATH=\projects\output - - cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\projects\output -DCMAKE_BUILD_TYPE=Release .. - - nmake - - nmake install -- ps: SetupPhpVersionString -- ps: AppendSessionPath -- ps: EnsureRequiredDirectoriesPresent -- ps: Ensure7ZipIsInstalled -- ps: InstallSdk -- ps: InstallPhp -- ps: InstallPhpDevPack - -build_script: -- cmd: cd %APPVEYOR_BUILD_FOLDER% -- phpsdk_setvars -- phpize -- ps: InitializeReleaseVars -- cmd: configure.bat --disable-all --enable-mustache --with-libmustache=C:\projects\output --with-prefix=C:\projects\php -- cmd: nmake 2> compile-errors.log 1> compile.log - -test_script: -- cmd: nmake test - -after_build: -- ps: PrepareReleasePackage - -on_failure : -- ps: PrintLogs - -artifacts: - - path: '.\$(RELEASE_ZIPBALL).zip' - name: master - type: zip