diff --git a/.ci/build-win32.bat b/.ci/build-win32.bat deleted file mode 100644 index 34bc2110..00000000 --- a/.ci/build-win32.bat +++ /dev/null @@ -1,19 +0,0 @@ -@ECHO off - -REM This file is part of the Zephir Parser. -REM -REM (c) Zephir Team -REM -REM For the full copyright and license information, please view -REM the LICENSE file that was distributed with this source code. - -REM Rewrite this using PowerShell -CD parser - -cl lemon.c -DEL zephir.c zephir.h parser.c scanner.c -re2c -o scanner.c scanner.re -lemon -s zephir.lemon -ECHO #include ^ > parser.c -TYPE zephir.c >> parser.c -TYPE base.c >> parser.c diff --git a/.ci/lemon-parser.ps1 b/.ci/lemon-parser.ps1 new file mode 100644 index 00000000..567654c7 --- /dev/null +++ b/.ci/lemon-parser.ps1 @@ -0,0 +1,45 @@ +# This file is part of the Zephir Parser. +# +# (c) Zephir Team +# +# For the full copyright and license information, please view +# the LICENSE file that was distributed with this source code. + +Write-Output "-- Compiling Lemon parser..." +$LemonSrc = Join-Path -Path './parser' -ChildPath 'lemon.c' +$LemonBin = Join-Path -Path './parser' -ChildPath 'lemon.exe' + +if ($IsWindows) { + & cl /Fe${LemonExe} ${LemonSrc} +} +else { + $LemonBin = Join-Path -Path './parser' -ChildPath 'lemon' + & gcc ${LemonSrc} -o ${LemonBin} +} +& ${LemonBin} -x + +Write-Output "-- Cleanup initial file state..." + +$AutoFiles = "./parser/zephir.c", + "./parser/zephir.h", + "./parser/parser.c", + "./parser/scanner.c" + +foreach ($GeneratedFile in $AutoFiles) { + if (Test-Path -Path $GeneratedFile) { + Remove-Item $GeneratedFile + } +} + +Write-Output "-- Run re2c..." +& re2c -o (Join-Path -Path './parser' -ChildPath 'scanner.c') (Join-Path -Path './parser' -ChildPath 'scanner.re') + +Write-Output "-- Generating zephir.c file with lemon parser..." +& ${LemonBin} -s (Join-Path -Path './parser' -ChildPath 'zephir.lemon') + +Write-Output "-- Generating parser.c file..." +$ParserC = Join-Path -Path './parser' -ChildPath 'parser.c' +$ZephirC = Join-Path -Path './parser' -ChildPath 'zephir.c' +$BaseC = Join-Path -Path './parser' -ChildPath 'base.c' +Set-Content -Path ${ParserC} -Value '#include ' +Get-Content ${ZephirC}, ${BaseC} | Add-Content ${ParserC} diff --git a/.ci/win-ci-tools.psm1 b/.ci/win-ci-tools.psm1 index 1b4e649f..19869b11 100644 --- a/.ci/win-ci-tools.psm1 +++ b/.ci/win-ci-tools.psm1 @@ -29,26 +29,35 @@ function InitializeReleaseVars { Configures Environment variables for Release build. #> - if ($env:BUILD_TYPE -Match "nts") { - $env:RELEASE_ZIPBALL = "zephir_parser_${env:PHP_ARCH}_vc${env:VC_VERSION}_php${env:PHP_MINOR}_nts" + # Build artifacts should be names like this: + # zephir-parser-php-7.0-nts-win32-vc14-x86.zip + # zephir-parser-php-7.0-ts-win32-vc14-x64.zip - if ($env:PHP_ARCH -eq 'x86') { - $env:RELEASE_FOLDER = "x64\Release" - } else { - $env:RELEASE_FOLDER = "x64\Release" - } - } else { - $env:RELEASE_ZIPBALL = "zephir_parser_${env:PHP_ARCH}_vc${env:VC_VERSION}_php${env:PHP_MINOR}" + $VC_Prefix = "vc" + if (${env:VC_VERSION} -ge 16) { + $VC_Prefix = "vc" + } - if ($env:PHP_ARCH -eq 'x86') { - $env:RELEASE_FOLDER = "x64\Release_TS" - } else { - $env:RELEASE_FOLDER = "x64\Release_TS" - } + # Configure for Windows define `BUILD_DIR` using the next logic: + # + # Release ZTS x86 => Release_TS\php_zephir_parser.dll + # Release NTS x86 => Release\php_zephir_parser.dll + # Release ZTS x64 => x64\Release_TS\php_zephir_parser.dll + # Release NTS x64 => x64\Release\php_zephir_parser.dll + + $env:RELEASE_FOLDER = "Release" + if (${env:BUILD_TYPE} -eq 'ts') { + $env:RELEASE_FOLDER = -join($env:RELEASE_FOLDER, "_TS") + } + + if (${env:PHP_ARCH} -eq 'x64') { + $env:RELEASE_FOLDER = -join("x64\", $env:RELEASE_FOLDER) } $env:RELEASE_DLL_PATH = "${env:GITHUB_WORKSPACE}\${env:RELEASE_FOLDER}\${env:EXTENSION_FILE}" + $env:RELEASE_ZIPBALL = "zephir-parser-php-${env:PHP_MINOR}-${env:BUILD_TYPE}-win32-${VC_Prefix}${env:VC_VERSION}-${env:PHP_ARCH}" + Write-Output "RELEASE_FOLDER=${env:RELEASE_FOLDER}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append Write-Output "RELEASE_ZIPBALL=${env:RELEASE_ZIPBALL}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append Write-Output "RELEASE_DLL_PATH=${env:RELEASE_DLL_PATH}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append } @@ -81,71 +90,6 @@ function InstallPhpSdk { } } -function PrepareReleasePackage { - param ( - [Parameter(Mandatory=$true)] [System.String] $PhpVersion, - [Parameter(Mandatory=$true)] [System.String] $BuildType, - [Parameter(Mandatory=$true)] [System.String] $Platform, - [Parameter(Mandatory=$false)] [System.String] $ZipballName = '', - [Parameter(Mandatory=$false)] [System.String[]] $ReleaseFiles = @(), - [Parameter(Mandatory=$false)] [System.String] $ReleaseFile = 'RELEASE.txt', - [Parameter(Mandatory=$false)] [System.Boolean] $ConverMdToHtml = $false, - [Parameter(Mandatory=$false)] [System.String] $BasePath = '.' - ) - - $BasePath = Resolve-Path $BasePath - $ReleaseDirectory = "${Env:GITHUB_ACTOR}-${Env:GITHUB_ACTION}-${Env:GITHUB_JOB}-${Env:GITHUB_RUN_NUMBER}" - - PrepareReleaseNote ` - -PhpVersion $PhpVersion ` - -BuildType $BuildType ` - -Platform $Platform ` - -ReleaseFile $ReleaseFile ` - -ReleaseDirectory $ReleaseDirectory ` - -BasePath $BasePath - - $ReleaseDestination = "${BasePath}\${ReleaseDirectory}" - - $CurrentPath = Resolve-Path '.' - - if ($ConverMdToHtml) { - InstallReleaseDependencies - FormatReleaseFiles -ReleaseDirectory $ReleaseDirectory - } - - if ($ReleaseFiles.count -gt 0) { - foreach ($File in $ReleaseFiles) { - Copy-Item "${File}" "${ReleaseDestination}" - Write-Debug "Copy ${File} to ${ReleaseDestination}" - } - } - - if (!$ZipballName) { - if (!$Env:RELEASE_ZIPBALL) { - throw "Required parameter `"ZipballName`" is missing" - } else { - $ZipballName = $Env:RELEASE_ZIPBALL; - } - } - - Ensure7ZipIsInstalled - - Set-Location "${ReleaseDestination}" - $Output = (& 7z a "${ZipballName}.zip" *) - $ExitCode = $LASTEXITCODE - - $DirectoryContents = Get-ChildItem -Path "${ReleaseDestination}" - Write-Debug ($DirectoryContents | Out-String) - - if ($ExitCode -ne 0) { - Set-Location "${CurrentPath}" - throw "An error occurred while creating release zippbal: `"${ZipballName}`". ${Output}" - } - - Move-Item "${ZipballName}.zip" -Destination "${BasePath}" - Set-Location "${CurrentPath}" -} - function InstallPhpDevPack { <# .SYNOPSIS @@ -156,13 +100,13 @@ function InstallPhpDevPack { $TS = Get-ThreadSafety - if ($env:VC_VERSION -gt 15) { - $VSPrefix = "VS" - $VSPrefixSmall = "vs" - } else { - $VSPrefix = "VC" - $VSPrefixSmall = "vc" - } + if ($env:VC_VERSION -gt 15) { + $VSPrefix = "VS" + $VSPrefixSmall = "vs" + } else { + $VSPrefix = "VC" + $VSPrefixSmall = "vc" + } $BaseUrl = "http://windows.php.net/downloads/releases" $DevPack = "php-devel-pack-${env:PHP_VERSION}${TS}-Win32-${VSPrefixSmall}${env:VC_VERSION}-${env:PHP_ARCH}.zip" @@ -301,40 +245,173 @@ function Get-ThreadSafety { } function AppendSessionPath { - [string[]] $PathsCollection = @( - "${Env:VSCOMNTOOLS}\..\..\VC", - "C:\Program Files (x86)\Microsoft Visual Studio ${Env:VC_VERSION}.0\VC", - "C:\Program Files (x86)\Microsoft Visual Studio ${Env:VC_VERSION}.0\VC\bin", - "${Env:VSCOMNTOOLS}", - "C:\php" - "C:\php\bin" - "C:\php-sdk\bin", - "C:\php-devpack" - ) - - $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}" + [string[]] $PathsCollection = @( + "${Env:VSCOMNTOOLS}\..\..\VC", + "C:\Program Files (x86)\Microsoft Visual Studio ${Env:VC_VERSION}.0\VC", + "C:\Program Files (x86)\Microsoft Visual Studio ${Env:VC_VERSION}.0\VC\bin", + "${Env:VSCOMNTOOLS}", + "C:\php" + "C:\php\bin" + "C:\php-sdk\bin", + "C:\php-devpack" + ) + + $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 EnableExtension { + <# + .SYNOPSIS + Enables PHP Extension. + #> + + if (-not (Test-Path env:RELEASE_DLL_PATH)) { + InitializeReleaseVars + } + + if (-not (Test-Path "${env:RELEASE_DLL_PATH}")) { + throw "Unable to locate extension path: ${env:RELEASE_DLL_PATH}" + } + + Copy-Item -Path "${env:RELEASE_DLL_PATH}" -Destination "${env:PHPROOT}\ext\" + + Enable-PhpExtension -Extension 'Zephir Parser' -Path "${env:PHPROOT}" +} + +function PrepareReleasePackage { + param ( + [Parameter(Mandatory=$true)] [System.String] $PhpVersion, + [Parameter(Mandatory=$true)] [System.String] $BuildType, + [Parameter(Mandatory=$true)] [System.String] $Platform, + [Parameter(Mandatory=$false)] [System.String] $ZipballName = '', + [Parameter(Mandatory=$false)] [System.String[]] $ReleaseFiles = @(), + [Parameter(Mandatory=$false)] [System.String] $ReleaseFile = 'RELEASE.txt', + [Parameter(Mandatory=$false)] [System.Boolean] $ConvertMd2Html = $false, + [Parameter(Mandatory=$false)] [System.String] $BasePath = '.' + ) + + $BasePath = Resolve-Path $BasePath + $ReleaseDirectory = "${Env:GITHUB_ACTOR}-${Env:RUNNER_OS}-${Env:GITHUB_JOB}-${Env:GITHUB_RUN_NUMBER}" + + Write-Output "ReleaseDirectory: ${ReleaseDirectory}" + + PrepareReleaseNote ` + -PhpVersion $PhpVersion ` + -BuildType $BuildType ` + -Platform $Platform ` + -ReleaseFile $ReleaseFile ` + -ReleaseDirectory $ReleaseDirectory ` + -BasePath $BasePath + + $ReleaseDestination = "${BasePath}\${ReleaseDirectory}" + + $CurrentPath = Resolve-Path '.' + + if ($ConvertMd2Html) { + FormatReleaseFiles -ReleaseDirectory $ReleaseDirectory + } + + if ($ReleaseFiles.count -gt 0) { + foreach ($File in $ReleaseFiles) { + Copy-Item "${File}" "${ReleaseDestination}" + Write-Debug "Copy ${File} to ${ReleaseDestination}" + } + } + + if (!$ZipballName) { + if (!$Env:RELEASE_ZIPBALL) { + throw "Required parameter `"ZipballName`" is missing" + } else { + $ZipballName = $Env:RELEASE_ZIPBALL; + } + } + + Set-Location "${ReleaseDestination}" + $Output = (& 7z a "${ZipballName}.zip" *) + $ExitCode = $LASTEXITCODE + + $DirectoryContents = Get-ChildItem -Path "${ReleaseDestination}" + Write-Debug ($DirectoryContents | Out-String) + + if ($ExitCode -ne 0) { + Set-Location "${CurrentPath}" + throw "An error occurred while creating release zipball: `"${ZipballName}`". ${Output}" + } + + Move-Item "${ZipballName}.zip" -Destination "${BasePath}" + Write-Output "Release file created: ${BasePath}\${ZipballName}.zip" + Set-Location "${CurrentPath}" +} + +function PrepareReleaseNote { + param ( + [Parameter(Mandatory=$true)] [System.String] $PhpVersion, + [Parameter(Mandatory=$true)] [System.String] $BuildType, + [Parameter(Mandatory=$true)] [System.String] $Platform, + [Parameter(Mandatory=$false)] [System.String] $ReleaseFile, + [Parameter(Mandatory=$false)] [System.String] $ReleaseDirectory, + [Parameter(Mandatory=$false)] [System.String] $BasePath + ) + + $Destination = "${BasePath}\${ReleaseDirectory}" + + if (-not (Test-Path $Destination)) { + New-Item -ItemType Directory -Force -Path "${Destination}" | Out-Null + } + + $ReleaseFile = "${Destination}\${ReleaseFile}" + $ReleaseDate = Get-Date -Format o + + $Version = Get-Content (Join-Path -Path ${BasePath} -ChildPath 'VERSION') -First 1 + + Write-Output "Release date: ${ReleaseDate}" | Out-File -Encoding "ASCII" -Append "${ReleaseFile}" + Write-Output "Release version: ${Version}" | Out-File -Encoding "ASCII" -Append "${ReleaseFile}" + Write-Output "Git commit: ${Env:GITHUB_SHA}" | Out-File -Encoding "ASCII" -Append "${ReleaseFile}" + Write-Output "Build type: ${BuildType}" | Out-File -Encoding "ASCII" -Append "${ReleaseFile}" + Write-Output "Platform: ${Platform}" | Out-File -Encoding "ASCII" -Append "${ReleaseFile}" + Write-Output "Target PHP version: ${PhpVersion}" | Out-File -Encoding "ASCII" -Append "${ReleaseFile}" +} + +function FormatReleaseFiles { + param ( + [Parameter(Mandatory=$true)] [System.String] $ReleaseDirectory, + [Parameter(Mandatory=$false)] [System.String] $BasePath = '.' + ) + + $CurrentPath = (Get-Item -Path ".\" -Verbose).FullName + + $BasePath = Resolve-Path $BasePath + Set-Location "${BasePath}" + + Get-ChildItem (Get-Item -Path ".\" -Verbose).FullName *.md | + ForEach-Object{ + $BaseName = $_.BaseName + pandoc -f markdown -t html5 "${BaseName}.md" > "${BasePath}\${ReleaseDirectory}\${BaseName}.html" + } + + Set-Location "${CurrentPath}" } diff --git a/.editorconfig b/.editorconfig index b5023d03..e5cfdb0b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,7 +11,7 @@ indent_size = 4 charset = utf-8 trim_trailing_whitespace = true -[*.{yml,m4,sh,md,php,phpt,xml,json,w32}] +[*.{yml,m4,sh,md,php,phpt,xml,json,w32,ps1,psm1}] indent_style = space [*.{yml,m4,sh}] diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d8dd5876..97a6e8ed 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -30,41 +30,40 @@ jobs: php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] arch: ['x86', 'x64'] build_type: ['ts', 'nts'] - vc_num: [14, 15, 16] - exclude: + include: - php: '7.0' - vc_num: 15 - - php: '7.0' - vc_num: 16 + vc_num: 14 + vc_prefix: 'vc' + os: windows-2016 - php: '7.1' - vc_num: 15 - - php: '7.1' - vc_num: 16 - - - php: '7.2' vc_num: 14 + vc_prefix: 'vc' + os: windows-2016 + - php: '7.2' - vc_num: 16 + vc_num: 15 + vc_prefix: 'vc' + os: windows-2016 - php: '7.3' - vc_num: 14 - - php: '7.3' - vc_num: 16 + vc_num: 15 + vc_prefix: 'vc' + os: windows-2016 - php: '7.4' - vc_num: 14 - - php: '7.4' - vc_num: 16 + vc_num: 15 + vc_prefix: 'vc' + os: windows-2016 - php: '8.0' - vc_num: 14 - - php: '8.0' - vc_num: 15 + vc_num: 16 + vc_prefix: 'vs' + os: windows-2019 - name: "Windows ${{ matrix.arch }} VC${{ matrix.vc_num }} and PHP ${{ matrix.php }}-${{ matrix.build_type }}" - runs-on: windows-2016 + name: "PHP-${{ matrix.php }}-${{ matrix.build_type }}-win32-${{ matrix.vc_prefix }}${{ matrix.vc_num }}-${{ matrix.arch }}" + runs-on: ${{ matrix.os}} steps: - uses: actions/checkout@v2 @@ -82,17 +81,28 @@ jobs: - name: Set Environment Variables run: | Write-Output "PHP_VERSION=$(php -r 'echo phpversion();')" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - Write-Output "PHP_MINOR=${{ matrix.php }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + Write-Output "PHP_MINOR=${{ matrix.php }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append Write-Output "TEST_PHP_EXECUTABLE=${env:PHPROOT}\php.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - Write-Output "BUILD_TYPE=${{ matrix.build_type }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - Write-Output "VC_VERSION=${{ matrix.vc_num }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - Write-Output "PHP_ARCH=${{ matrix.arch }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - Write-Output "BUILD_VERSION=${GITHUB_RUN_NUMBER}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + Write-Output "BUILD_TYPE=${{ matrix.build_type }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + Write-Output "VC_VERSION=${{ matrix.vc_num }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + Write-Output "PHP_ARCH=${{ matrix.arch }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + Write-Output "BUILD_VERSION=${env:GITHUB_RUN_NUMBER}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Setup Common Environmet run: | Import-Module .\.ci\win-ci-tools.psm1 SetupCommonEnvironment + InitializeReleaseVars + + - name: Cache Downloads + uses: actions/cache@v2 + with: + path: C:\Downloads + key: ${{ runner.os }}-zephir_parser-php-${{ matrix.php }}-${{ matrix.build_type }}-win32-${{ matrix.vc_prefix }}${{ matrix.vc_num }}-${{ matrix.arch }} + + - name: Install System Dependencies + run: | + choco install -y --no-progress --cache-location=C:\Downloads\Choco pandoc - name: Install PHP SDK Binary Tools run: | @@ -104,76 +114,100 @@ jobs: Import-Module .\.ci\win-ci-tools.psm1 InstallPhpDevPack - - name: Getting Details About Installed PHP - run: Get-Php "${env:PHPROOT}" - - - name: Install CL + - name: Install MSVC Compiler Tool uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.arch }} - - name: Parse Zephir Parser (Lemon) + - name: Set PHP SDK Environment variables shell: cmd run: | + call C:\tools\php-sdk\phpsdk-${{ matrix.vc_prefix }}${{ matrix.vc_num }}-${{ matrix.arch }}.bat call C:\tools\php-sdk\bin\phpsdk_setvars.bat - CD parser - DEL zephir.c zephir.h parser.c scanner.c - re2c -o scanner.c scanner.re - lemon -s zephir.lemon - ECHO #include ^ > parser.c - TYPE zephir.c >> parser.c - TYPE base.c >> parser.c - - - name: Build Zephir Parser (phpize) + + - name: Parse Zephir Parser (Lemon) shell: cmd run: | - call C:\tools\php-sdk\phpsdk-vc${{ matrix.vc_num }}-${{ matrix.arch }}.bat call C:\tools\php-sdk\bin\phpsdk_setvars.bat + powershell.exe -File .\.ci\lemon-parser.ps1 + + - name: Phpize + shell: cmd + run: | call C:\tools\php-devpack\phpize.bat - - shell: cmd + - name: Configure + shell: cmd run: | - call C:\tools\php-sdk\phpsdk-vc${{ matrix.vc_num }}-${{ matrix.arch }}.bat + call C:\tools\php-sdk\phpsdk-${{ matrix.vc_prefix }}${{ matrix.vc_num }}-${{ matrix.arch }}.bat call C:\tools\php-sdk\bin\phpsdk_setvars.bat - configure --with-prefix=C:\php --with-php-build=C:\php-devpack --disable-all --enable-zephir-parser=static + configure --with-codegen-arch=yes --with-prefix=C:\php --with-php-build=C:\php-devpack --disable-all --enable-zephir-parser=shared - - shell: cmd + - name: Compile + shell: cmd run: | - call C:\tools\php-sdk\phpsdk-vc${{ matrix.vc_num }}-${{ matrix.arch }}.bat + call C:\tools\php-sdk\phpsdk-${{ matrix.vc_prefix }}${{ matrix.vc_num }}-${{ matrix.arch }}.bat call C:\tools\php-sdk\bin\phpsdk_setvars.bat nmake - - run: dir "${env:GITHUB_WORKSPACE}\${env:RELEASE_FOLDER}" - - - name: Check errors - if: always() + - name: Get Zephir Parser extension info run: | - if (Test-Path -Path "${env:GITHUB_WORKSPACE}\compile-errors.log") { - Get-Content -Path "${env:GITHUB_WORKSPACE}\compile-errors.log" - } - if (Test-Path -Path "${env:GITHUB_WORKSPACE}\compile.log") { - Get-Content -Path "${env:GITHUB_WORKSPACE}\compile.log" - } - - - run: | - Import-Module .\.ci\win-ci-tools.psm1 - InitializeReleaseVars - Get-ChildItem ${Env:GITHUB_WORKSPACE} -name -recurse php_zephir_parser.dll + Get-Php "${env:PHPROOT}" + Get-PhpExtension "${env:RELEASE_DLL_PATH}" + & ${env:TEST_PHP_EXECUTABLE} --ini - name: Enable Zephir Parser run: | - Import-Module .\.ci\win-ci-tools.psm1 - InitializeReleaseVars - Copy-Item "${env:RELEASE_DLL_PATH}" "${env:PHPROOT}\ext\${env:EXTENSION_FILE}" - EnablePhpExtension -Extension 'Zephir Parser' -Path "${env:PHPROOT}" + Add-Content -Path "${env:PHPROOT}\php.ini" -Value 'extension=php_zephir_parser.dll' + Copy-Item -Path "${env:RELEASE_DLL_PATH}" -Destination "${env:PHPROOT}\ext\" - - run: | + # Run tests only for x64 PHP builds (Windows currently not support setup php with multi arch) + - name: Run Tests + if: matrix.arch == 'x64' + run: | + & ${env:TEST_PHP_EXECUTABLE} --ri 'Zephir Parser' + & ${env:TEST_PHP_EXECUTABLE} run-tests.php + + - name: Prepare Release Package + run: | Import-Module .\.ci\win-ci-tools.psm1 PrepareReleasePackage ` -PhpVersion $Env:PHP_VERSION ` -BuildType $Env:BUILD_TYPE ` -Platform $Env:PLATFORM ` - -ConverMdToHtml $true ` + -ZipballName $Env:RELEASE_ZIPBALL ` + -ConvertMd2Html $true ` -ReleaseFiles "${Env:RELEASE_DLL_PATH}",` "${Env:GITHUB_WORKSPACE}\LICENSE",` "${Env:GITHUB_WORKSPACE}\CREDITS",` "${Env:GITHUB_WORKSPACE}\VERSION",` "${Env:GITHUB_WORKSPACE}\NO_WARRANTY" + + - name: Upload Zephir Parser + uses: actions/upload-artifact@v2 + with: + name: zephir-parser-php-${{ matrix.php }}-${{ matrix.build_type }}-win32-${{ matrix.vc_prefix }}${{ matrix.vc_num }}-${{ matrix.arch }} + path: | + ${{ github.workspace }}\zephir-parser-*.zip + + - name: Check for Errors + if: always() + run: | + Get-ChildItem (Get-Item -Path ".\" -Verbose).FullName *.log | + ForEach-Object{ + $BaseName = $_.BaseName + Write-Output "-- Log details: ${BaseName}.log --" + Get-Content -Path "${env:GITHUB_WORKSPACE}\${BaseName}.log" + } + + - name: Upload Infor for Debug on Fail + if: failure() + uses: actions/upload-artifact@v2 + with: + retention-days: 2 + name: errors-zephir-parser-php-${{ matrix.php }}-${{ matrix.build_type }}-win32-${{ matrix.vc_prefix }}${{ matrix.vc_num }}-${{ matrix.arch }} + path: | + ${{ github.workspace }}\tests + ${{ github.workspace }}\parser + ${{ github.workspace }}\Release* + ${{ github.workspace }}\**\Release* diff --git a/tests/base/cblocks.phpt b/tests/base/cblocks.phpt index 26dc07b8..158977f4 100644 --- a/tests/base/cblocks.phpt +++ b/tests/base/cblocks.phpt @@ -2,6 +2,7 @@ Tests recognizing wrapping C-code in CBLOCKs --SKIPIF-- + --FILE-- + --FILE-- + --FILE--