-
Notifications
You must be signed in to change notification settings - Fork 0
Add Windows support to mariadb_profiler extension #13
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
4 commits
Select commit
Hold shift + click to select a range
e933dae
Add GitHub Actions release workflow with Windows DLL support
claude e6010a4
Fix ssize_t build error and bump setup-php-sdk to v0.12
claude 198b8ad
Fix profiler_flock bitwise flag handling and Windows path prefix skip…
claude 9f832e4
Set errno on profiler_flock failure paths
claude 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,180 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'Release tag (e.g., v0.1.0)' | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| # --------------------------------------------------------------------------- | ||
| # Linux .so builds | ||
| # --------------------------------------------------------------------------- | ||
| build-linux: | ||
| name: Linux - PHP ${{ matrix.php }} | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php }} | ||
| extensions: mysqlnd | ||
| tools: phpize | ||
| ini-values: error_reporting=E_ALL | ||
|
|
||
| - name: Build extension | ||
| working-directory: ext/mariadb_profiler | ||
| run: | | ||
| phpize | ||
| ./configure --enable-mariadb_profiler | ||
| make -j$(nproc) | ||
|
|
||
| - name: Verify extension is loadable | ||
| working-directory: ext/mariadb_profiler | ||
| run: | | ||
| php -d "extension=$(pwd)/modules/mariadb_profiler.so" -m | grep mariadb_profiler | ||
|
|
||
| - name: Package artifact | ||
| run: | | ||
| mkdir -p dist | ||
| cp ext/mariadb_profiler/modules/mariadb_profiler.so \ | ||
| "dist/mariadb_profiler-php${{ matrix.php }}-linux-x86_64.so" | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: mariadb_profiler-php${{ matrix.php }}-linux-x86_64 | ||
| path: dist/*.so | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Windows .dll builds | ||
| # --------------------------------------------------------------------------- | ||
| 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-8.3 use VS16, PHP 8.4 uses VS17. | ||
| # windows-2022 runners have both toolsets. | ||
| - 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: 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: Package artifact | ||
| shell: pwsh | ||
| run: | | ||
| $ts = "${{ matrix.ts }}" | ||
| $arch = "${{ matrix.arch }}" | ||
| $phpVer = "${{ matrix.php }}" | ||
|
|
||
| # Find the built DLL | ||
| $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 "Found DLL: $($dll.FullName)" | ||
|
|
||
| New-Item -ItemType Directory -Force -Path dist | Out-Null | ||
| $name = "php_mariadb_profiler-php${phpVer}-${ts}-${arch}" | ||
| Copy-Item $dll.FullName "dist\${name}.dll" | ||
| Write-Host "Packaged as: dist\${name}.dll" | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: php_mariadb_profiler-php${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.arch }} | ||
| path: dist\*.dll | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Create GitHub Release | ||
| # --------------------------------------------------------------------------- | ||
| release: | ||
| name: Create Release | ||
| needs: [build-linux, build-windows] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: artifacts | ||
|
|
||
| - name: Collect release assets | ||
| run: | | ||
| mkdir -p release | ||
| find artifacts -type f \( -name "*.so" -o -name "*.dll" \) -exec cp {} release/ \; | ||
| echo "=== Release assets ===" | ||
| ls -lh release/ | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ github.event.inputs.tag }} | ||
| name: ${{ github.event.inputs.tag }} | ||
| draft: false | ||
| prerelease: false | ||
| generate_release_notes: true | ||
| files: release/* | ||
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,11 @@ | ||
| // config.w32 for extension mariadb_profiler | ||
|
|
||
| ARG_ENABLE('mariadb_profiler', 'MariaDB Query Profiler support', 'no'); | ||
|
|
||
| if (PHP_MARIADB_PROFILER != 'no') { | ||
| EXTENSION('mariadb_profiler', | ||
| 'mariadb_profiler.c profiler_mysqlnd_plugin.c profiler_job.c profiler_log.c profiler_tag.c profiler_trace.c', | ||
| PHP_MARIADB_PROFILER_SHARED, | ||
| '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1'); | ||
| ADD_EXTENSION_DEP('mariadb_profiler', 'mysqlnd', true); | ||
| } |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.