-
Notifications
You must be signed in to change notification settings - Fork 0
272 lines (230 loc) · 8.18 KB
/
Copy pathrelease.yml
File metadata and controls
272 lines (230 loc) · 8.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
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 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: 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
# ---------------------------------------------------------------------------
# JetBrains Plugin build
# ---------------------------------------------------------------------------
build-plugin:
name: JetBrains Plugin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Run tests
working-directory: jetbrains-plugin
run: ./gradlew test
- name: Build plugin
working-directory: jetbrains-plugin
run: ./gradlew buildPlugin
- uses: actions/upload-artifact@v4
with:
name: mariadb-profiler-viewer-plugin
path: jetbrains-plugin/build/distributions/*.zip
if-no-files-found: error
# ---------------------------------------------------------------------------
# VSCode Extension build
# ---------------------------------------------------------------------------
build-vscode:
name: VSCode Extension
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: vscode-extension/package-lock.json
- name: Install dependencies
working-directory: vscode-extension
run: npm ci
- name: Type check
working-directory: vscode-extension
run: npx tsc --noEmit
- name: Run tests
working-directory: vscode-extension
run: npx vitest run
- name: Build
working-directory: vscode-extension
run: node esbuild.mjs --production
- name: Package .vsix
working-directory: vscode-extension
run: npx @vscode/vsce package --no-dependencies -o mariadb-profiler-viewer.vsix
- uses: actions/upload-artifact@v4
with:
name: mariadb-profiler-viewer-vsix
path: vscode-extension/*.vsix
if-no-files-found: error
# ---------------------------------------------------------------------------
# Create GitHub Release
# ---------------------------------------------------------------------------
release:
name: Create Release
needs: [build-linux, build-windows, build-plugin, build-vscode]
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" -o -name "*.zip" -o -name "*.vsix" \) -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/*