diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 77054ec..0000000 --- a/.appveyor.yml +++ /dev/null @@ -1,159 +0,0 @@ -version: "{branch}.build.{build}" -skip_tags: true - -branches: - only: - - develop - -clone_folder: c:\projects\pcov - -install: - ps: | - if (-not (Test-Path c:\build-cache)) { - mkdir c:\build-cache - } - $bname = 'php-sdk-' + $env:BIN_SDK_VER + '.zip' - if (-not (Test-Path c:\build-cache\$bname)) { - Invoke-WebRequest "https://github.com/OSTC/php-sdk-binary-tools/archive/$bname" -OutFile "c:\build-cache\$bname" - } - $dname0 = 'php-sdk-binary-tools-php-sdk-' + $env:BIN_SDK_VER - $dname1 = 'php-sdk-' + $env:BIN_SDK_VER - if (-not (Test-Path c:\build-cache\$dname1)) { - & 7z x c:\build-cache\$bname -oc:\build-cache - move c:\build-cache\$dname0 c:\build-cache\$dname1 - } - -cache: - c:\build-cache -> .appveyor.yml - -environment: - BIN_SDK_VER: 2.2.0 - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - ARCH: x64 - VC: vc14 - PHP_VER: 7.1.33 - TS: 1 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - ARCH: x86 - VC: vc14 - PHP_VER: 7.1.33 - TS: 0 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - ARCH: x64 - VC: vc15 - PHP_VER: 7.2.34 - TS: 1 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - ARCH: x86 - VC: vc15 - PHP_VER: 7.2.34 - TS: 0 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - ARCH: x64 - VC: vc15 - PHP_VER: 7.3.27 - TS: 1 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - ARCH: x86 - VC: vc15 - PHP_VER: 7.3.27 - TS: 0 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - ARCH: x64 - VC: vc15 - PHP_VER: 7.4.16 - TS: 1 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - ARCH: x86 - VC: vc15 - PHP_VER: 7.4.16 - TS: 0 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - ARCH: x64 - VC: vs16 - PHP_VER: 8.0.3 - TS: 1 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - ARCH: x86 - VC: vs16 - PHP_VER: 8.0.3 - TS: 0 - -build_script: - ps: | - $ts_part = '' - if ('0' -eq $env:TS) { $ts_part = '-nts' } - $bname = 'php-devel-pack-' + $env:PHP_VER + $ts_part + '-Win32-' + $env:VC.toUpper() + '-' + $env:ARCH + '.zip' - if (-not (Test-Path c:\build-cache\$bname)) { - Invoke-WebRequest "http://windows.php.net/downloads/releases/archives/$bname" -OutFile "c:\build-cache\$bname" - if (-not (Test-Path c:\build-cache\$bname)) { - Invoke-WebRequest "http://windows.php.net/downloads/releases/$bname" -OutFile "c:\build-cache\$bname" - } - } - $dname0 = 'php-' + $env:PHP_VER + '-devel-' + $env:VC.toUpper() + '-' + $env:ARCH - $dname1 = 'php-' + $env:PHP_VER + $ts_part + '-devel-' + $env:VC.toUpper() + '-' + $env:ARCH - if (-not (Test-Path c:\build-cache\$dname1)) { - 7z x c:\build-cache\$bname -oc:\build-cache - move c:\build-cache\$dname0 c:\build-cache\$dname1 - } - cd c:\projects\pcov - $env:PATH = 'c:\build-cache\' + $dname1 + ';' + $env:PATH - #echo "@echo off" | Out-File -Encoding "ASCII" task.bat - #echo "" | Out-File -Encoding "ASCII" -Append task.bat - echo "" | Out-File -Encoding "ASCII" task.bat - echo "call phpize 2>&1" | Out-File -Encoding "ASCII" -Append task.bat - if ('1' -eq $env:UTF32) { $utf32_part = '--enable-pcov-utf32' } - $conf_cmd = "call configure --enable-pcov " + $utf32_part + " --enable-debug-pack 2>&1" - echo $conf_cmd | Out-File -Encoding "ASCII" -Append task.bat - echo "nmake /nologo 2>&1" | Out-File -Encoding "ASCII" -Append task.bat - echo "exit %errorlevel%" | Out-File -Encoding "ASCII" -Append task.bat - $here = (Get-Item -Path "." -Verbose).FullName - $runner = 'c:\build-cache\php-sdk-' + $env:BIN_SDK_VER + '\phpsdk' + '-' + $env:VC + '-' + $env:ARCH + '.bat' - $task = $here + '\task.bat' - & $runner -t $task - -after_build: - ps: | - $ts_part = 'ts' - if ('0' -eq $env:TS) { $ts_part = 'nts' } - $zip_bname = 'php_pcov-' + $env:APPVEYOR_REPO_COMMIT.substring(0, 8) + '-' + $env:PHP_VER.substring(0, 3) + '-' + $ts_part + '-' + $env:VC + '-' + $env:ARCH + '.zip' - $dir = 'c:\projects\pcov\'; - if ('x64' -eq $env:ARCH) { $dir = $dir + 'x64\' } - $dir = $dir + 'Release' - if ('1' -eq $env:TS) { $dir = $dir + '_TS' } - & 7z a c:\$zip_bname $dir\php_pcov.dll $dir\php_pcov.pdb c:\projects\pcov\LICENSE - Push-AppveyorArtifact c:\$zip_bname - -test_script: - ps: | - $ts_part = '' - if ('0' -eq $env:TS) { $ts_part = '-nts' } - $bname = 'php-' + $env:PHP_VER + $ts_part + '-Win32-' + $env:VC.toUpper() + '-' + $env:ARCH + '.zip' - if (-not (Test-Path c:\build-cache\$bname)) { - Invoke-WebRequest "http://windows.php.net/downloads/releases/archives/$bname" -OutFile "c:\build-cache\$bname" - if (-not (Test-Path c:\build-cache\$bname)) { - Invoke-WebRequest "http://windows.php.net/downloads/releases/$bname" -OutFile "c:\build-cache\$bname" - } - } - $dname = 'php-' + $env:PHP_VER + $ts_part + '-' + $env:VC.toUpper() + '-' + $env:ARCH - if (-not (Test-Path c:\build-cache\$dname)) { - 7z x c:\build-cache\$bname -oc:\build-cache\$dname - } - cd c:\projects\pcov - echo "" | Out-File -Encoding "ASCII" task.bat - echo "set REPORT_EXIT_STATUS=1" | Out-File -Encoding "ASCII" -Append task.bat - echo "set TEST_PHP_JUNIT=c:\junit.out.xml" | Out-File -Encoding "ASCII" task.bat - if ('1' -eq $env:UTF32) { $utf32_part = '--enable-pcov-utf32' } - $cmd = 'call configure --enable-pcov ' + $utf32_part + ' --with-prefix=c:\build-cache\' + $dname + " 2>&1" - echo $cmd | Out-File -Encoding "ASCII" -Append task.bat - echo 'nmake /nologo test TESTS="-q --show-diff --set-timeout 120" 2>&1' | Out-File -Encoding "ASCII" -Append task.bat - echo "exit %errorlevel%" | Out-File -Encoding "ASCII" -Append task.bat - $here = (Get-Item -Path "." -Verbose).FullName - $runner = 'c:\build-cache\php-sdk-' + $env:BIN_SDK_VER + '\phpsdk' + '-' + $env:VC + '-' + $env:ARCH + '.bat' - $task = $here + '\task.bat' - & $runner -t $task - $wc = New-Object 'System.Net.WebClient' - $wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", "c:\junit.out.xml") - - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..58be998 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,91 @@ +name: Build and Test +on: [push, pull_request] +jobs: + windows: + defaults: + run: + shell: cmd + strategy: + matrix: + version: ['8.0', '8.1', '8.2', '8.3'] + arch: [x64, x86] + ts: [ts, nts] + runs-on: windows-latest + steps: + - name: Checkout pcov + uses: actions/checkout@v4 + - name: Extract Version + shell: powershell + run: | + chcp 65001 + $r = Select-String -Path php_pcov.h -Pattern 'PHP_PCOV_VERSION\s+"(.*)"' + $s = $r.Matches[0].Groups[1] + echo "$s" + $extension_version = 'EXTENSION_VERSION=' + $s + echo $extension_version >> $env:GITHUB_ENV + - name: Setup PHP + id: setup-php + uses: php/setup-php-sdk@v0.8 + with: + version: ${{matrix.version}} + arch: ${{matrix.arch}} + ts: ${{matrix.ts}} + - name: Enable Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{matrix.arch}} + toolset: ${{steps.setup-php.outputs.toolset}} + - name: phpize + run: phpize + - name: configure + run: configure --enable-pcov --with-prefix=${{steps.setup-php.outputs.prefix}} + - name: make + run: nmake + - name: test + run: nmake test TESTS="-g FAIL,SKIP --show-diff tests" + - name: Define Module Env + shell: powershell + run: | + chcp 65001 + + $dir = (Get-Location).Path + '\' + if ('x64' -eq '${{matrix.arch}}') { $dir = $dir + 'x64\' } + $dir = $dir + 'Release' + if ('ts' -eq '${{matrix.ts}}') { $dir = $dir + '_TS' } + + $artifact_name = 'php_pcov-${{env.EXTENSION_VERSION}}-${{matrix.version}}' + + if ('ts' -eq '${{matrix.ts}}') { $artifact_name = $artifact_name + '-ts' } + if ('nts' -eq '${{matrix.ts}}') { $artifact_name = $artifact_name + '-nts' } + + if ('7.2' -eq '${{matrix.version}}') { $artifact_name = $artifact_name + '-vc15' } + if ('7.3' -eq '${{matrix.version}}') { $artifact_name = $artifact_name + '-vc15' } + if ('7.4' -eq '${{matrix.version}}') { $artifact_name = $artifact_name + '-vc15' } + if ('8.0' -eq '${{matrix.version}}') { $artifact_name = $artifact_name + '-vs16' } + if ('8.1' -eq '${{matrix.version}}') { $artifact_name = $artifact_name + '-vs16' } + if ('8.2' -eq '${{matrix.version}}') { $artifact_name = $artifact_name + '-vs16' } + if ('8.3' -eq '${{matrix.version}}') { $artifact_name = $artifact_name + '-vs16' } + + if ('x64' -eq '${{matrix.arch}}') { $artifact_name = $artifact_name + '-x64' } + if ('x86' -eq '${{matrix.arch}}') { $artifact_name = $artifact_name + '-x86' } + + $extension_artifact_name = "ARTIFACT_NAME=" + $artifact_name + echo $extension_artifact_name >> $env:GITHUB_ENV + + $from = $dir + '\php_pcov.dll' + $to = $from + ".zip" + Compress-Archive $from $to + $extension_artifact = "ARTIFACT=" + $from + echo $extension_artifact >> $env:GITHUB_ENV + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{env.ARTIFACT_NAME}} + path: ${{env.ARTIFACT}} + - name: Publish Binaries to Release + if: ${{ startsWith(github.ref, 'refs/tags') }} + uses: svenstaro/upload-release-action@v2 + with: + asset_name: ${{env.ARTIFACT_NAME}}.zip + file: ${{env.ARTIFACT}}.zip