-
Notifications
You must be signed in to change notification settings - Fork 0
Add Windows CI/CD workflow for PHP extension builds #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| name: Windows Build | ||
|
|
||
| on: | ||
| push: | ||
| branches: ['**'] | ||
| paths: | ||
| - 'ext/**' | ||
| - '.github/workflows/windows-build.yml' | ||
| pull_request: | ||
| branches: ['**'] | ||
| paths: | ||
| - 'ext/**' | ||
| - '.github/workflows/windows-build.yml' | ||
|
|
||
| jobs: | ||
| build-windows: | ||
| name: Windows - PHP ${{ matrix.php }} ${{ matrix.ts }} ${{ matrix.arch }} | ||
| runs-on: windows-${{ matrix.os }} | ||
| defaults: | ||
| run: | ||
| shell: cmd | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] | ||
| arch: [x64] | ||
| ts: [nts, ts] | ||
| os: ['2022'] | ||
| include: | ||
| # PHP 7.4 requires VC15 (v141 toolset, MSVC 14.1x). | ||
| # PHP 8.0-8.3 use VS16, PHP 8.4 uses VS17. | ||
| # windows-2022 runners have vs16/vs17 but NOT vc15, | ||
| # so we install the v141 component for PHP 7.4. | ||
| - php: '7.4' | ||
| vs: vs16 | ||
| - php: '8.0' | ||
| vs: vs16 | ||
| - php: '8.1' | ||
| vs: vs16 | ||
| - php: '8.2' | ||
| vs: vs16 | ||
| - php: '8.3' | ||
| vs: vs16 | ||
| - php: '8.4' | ||
| vs: vs17 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install VC15 (v141) toolset for PHP 7.4 | ||
| if: matrix.php == '7.4' | ||
| shell: pwsh | ||
| run: | | ||
| Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" | ||
| $installPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" | ||
| $component = "Microsoft.VisualStudio.Component.VC.v141.x86.x64" | ||
| $args = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$installPath`"", | ||
| '--add', $component, '--quiet', '--norestart', '--nocache') | ||
| $process = Start-Process -FilePath cmd.exe -ArgumentList $args -Wait -PassThru -WindowStyle Hidden | ||
| if ($process.ExitCode -ne 0) { | ||
| Write-Warning "vs_installer exited with code $($process.ExitCode)" | ||
| } | ||
|
|
||
| - name: Setup PHP SDK | ||
| id: setup | ||
| uses: php/setup-php-sdk@v0.12 | ||
| with: | ||
| version: ${{ matrix.php }} | ||
| arch: ${{ matrix.arch }} | ||
| ts: ${{ matrix.ts }} | ||
|
|
||
| - name: Enable MSVC Developer Command Prompt | ||
| uses: ilammy/msvc-dev-cmd@v1 | ||
| with: | ||
| arch: ${{ matrix.arch }} | ||
| toolset: ${{ steps.setup.outputs.toolset }} | ||
|
|
||
| - name: phpize | ||
| working-directory: ext\mariadb_profiler | ||
| run: phpize | ||
|
|
||
| - name: configure | ||
| working-directory: ext\mariadb_profiler | ||
| run: configure --enable-mariadb_profiler --with-prefix=%INSTALL_DIR% | ||
|
|
||
| - name: nmake | ||
| working-directory: ext\mariadb_profiler | ||
| run: nmake | ||
|
|
||
| - name: Verify DLL exists | ||
| shell: pwsh | ||
| run: | | ||
| $dll = Get-ChildItem -Path ext\mariadb_profiler -Recurse -Filter "php_mariadb_profiler.dll" | | ||
| Select-Object -First 1 | ||
| if (-not $dll) { | ||
| Write-Error "php_mariadb_profiler.dll not found" | ||
| exit 1 | ||
| } | ||
| Write-Host "Built DLL: $($dll.FullName)" | ||
| Write-Host "Size: $([math]::Round($dll.Length / 1KB, 1)) KB" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: 39ff/php-ext-mariadb-salvage
Length of output: 2860
🌐 Web query:
php/setup-php-sdk action outputs environment variables INSTALL_DIR💡 Result:
php/setup-php-sdkdoes not export an environment variable namedINSTALL_DIR.What it does provide:
toolset,prefix,vs. [1]prefixoutput, which is set to"$pwd\\php-bin"(thephp-bindirectory under the current working directory / workspace). [2]So to get an
INSTALL_DIRenv var, define it yourself from the output:Sources: [php/setup-php-sdk action.yml outputs] [1], [run.ps1 sets
prefix=$pwd\php-bin] [2].[1] (raw.githubusercontent.com)
[2] (raw.githubusercontent.com)
Citations:
%INSTALL_DIR%は定義されていません。ビルドが失敗します。configureコマンドで--with-prefix=%INSTALL_DIR%を使用していますが、この環境変数はワークフロー内で定義されていません。php/setup-php-sdk@v0.12アクションはINSTALL_DIRをエクスポートせず、環境変数は空文字列に展開されてビルド設定が不正になります。アクションの
prefix出力からINSTALL_DIRを設定する必要があります:修正例
🤖 Prompt for AI Agents