From ee58ca7d1418ee575e001740f67b5ad6e03ae392 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Thu, 14 Dec 2023 16:42:46 +0000 Subject: [PATCH] Added workflow for adding binaries to release --- .github/workflows/{build.yml => tests.yml} | 2 +- .../workflows/windows-release-binaries.yml | 102 ++++++++++++++++++ 2 files changed, 103 insertions(+), 1 deletion(-) rename .github/workflows/{build.yml => tests.yml} (99%) create mode 100644 .github/workflows/windows-release-binaries.yml diff --git a/.github/workflows/build.yml b/.github/workflows/tests.yml similarity index 99% rename from .github/workflows/build.yml rename to .github/workflows/tests.yml index 55ddd47bf..59abc0c06 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Build +name: Running Tests on: push: diff --git a/.github/workflows/windows-release-binaries.yml b/.github/workflows/windows-release-binaries.yml new file mode 100644 index 000000000..9339d7a77 --- /dev/null +++ b/.github/workflows/windows-release-binaries.yml @@ -0,0 +1,102 @@ +name: Building Windows Release Binaries + +on: + push: + tags: + - '*' + +jobs: + windows: + runs-on: windows-latest + name: "Windows: Build and test" + defaults: + run: + shell: cmd + strategy: + fail-fast: false + matrix: + php: ["8.0", "8.1", "8.2", "8.3"] + arch: [x64] + ts: [nts, ts] + experimental: [false] + steps: + - name: Checkout Xdebug + uses: actions/checkout@v4 + - name: Extract Xdebug Version + shell: powershell + run: | + chcp 65001 + $r = Select-String -Path php_xdebug.h -Pattern 'XDEBUG_VERSION\s+"(.*)"' + $s = $r.Matches[0].Groups[1] + echo "$s" + $xdebug_version = 'XDEBUG_VERSION=' + $s + echo $xdebug_version >> $env:GITHUB_ENV + - name: Setup PHP + id: setup-php + uses: php/setup-php-sdk@v0.8 + with: + version: ${{matrix.php}} + arch: ${{matrix.arch}} + ts: ${{matrix.ts}} + deps: zlib + - name: Enable Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{matrix.arch}} + toolset: ${{steps.setup-php.outputs.toolset}} + - name: Generate Build Files + run: phpize + - name: Configure Build + run: configure --with-xdebug --with-xdebug-compression --enable-debug-pack --with-prefix=${{steps.setup-php.outputs.prefix}} + - name: Build + run: nmake + - name: Define Xdebug 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' } + $xdebug_dll_opt = 'TEST_PHP_ARGS=-n -d zend_extension=' + $dir + '\php_xdebug.dll' + echo $xdebug_dll_opt >> $env:GITHUB_ENV + + $artifact_name = 'php_xdebug-${{env.XDEBUG_VERSION}}-${{matrix.php}}' + + if ('8.0' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } + if ('8.1' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } + if ('8.2' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } + if ('8.3' -eq '${{matrix.php}}') { $artifact_name = $artifact_name + '-vs16' } + + if ('nts' -eq '${{matrix.ts}}') { $artifact_name = $artifact_name + '-nts' } + if ('x64' -eq '${{matrix.arch}}') { $artifact_name = $artifact_name + '-x86_64' } + + $xdebug_artifact_name = "ARTIFACT_NAME=" + $artifact_name + echo $xdebug_artifact_name >> $env:GITHUB_ENV + + $from = $dir + '\php_xdebug.dll' + $to = $dir + '\' + $artifact_name + ".dll" + Copy-Item $from -Destination $to + $xdebug_artifact = "ARTIFACT=" + $to + echo $xdebug_artifact >> $env:GITHUB_ENV + + - name: Define Other Environment + shell: powershell + run: | + chcp 65001 + echo "REPORT_EXIT_STATUS=1" >> $env:GITHUB_ENV + echo "TEST_PHP_EXECUTABLE=${{steps.setup-php.outputs.prefix}}\php.exe" >> $env:GITHUB_ENV + echo "TEMP=$((Get-Item -LiteralPath $Env:TEMP).FullName)" >> $env:GITHUB_ENV + echo "TMP=$((Get-Item -LiteralPath $Env:TMP).FullName)" >> $env:GITHUB_ENV + echo "XDEBUG_MODE=" >> $env:GITHUB_ENV + - name: Publish Binaries to Release + uses: svenstaro/upload-release-action@v2 + with: + asset_name: ${{env.ARTIFACT_NAME}} + file: ${{env.ARTIFACT}} + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{env.ARTIFACT_NAME}} + path: ${{env.ARTIFACT}}