|
7 | 7 |
|
8 | 8 | permissions: |
9 | 9 | contents: write |
| 10 | + pull_requests: write |
10 | 11 |
|
11 | 12 | jobs: |
12 | 13 | create-release: |
|
66 | 67 | - Only used for DevTool developers to verify branch code |
67 | 68 | - May contain unstable or incomplete features' || github.ref }} |
68 | 69 |
|
69 | | - build-and-upload: |
| 70 | + build-and-upload-macos: |
70 | 71 | needs: create-release |
71 | 72 | runs-on: lynx-darwin-14-medium |
72 | 73 | strategy: |
|
75 | 76 |
|
76 | 77 | steps: |
77 | 78 | - uses: actions/checkout@v3 |
| 79 | + with: |
| 80 | + submodules: recursive |
| 81 | + |
| 82 | + - name: ln Python |
| 83 | + run: ln -s `which python3` /usr/local/bin/python |
78 | 84 |
|
79 | 85 | # Node and pnpm setup steps |
80 | 86 | - name: Setup Node.js |
@@ -106,9 +112,6 @@ jobs: |
106 | 112 | - name: Fetch depot_tools |
107 | 113 | run: pnpm run fetch:depot_tools |
108 | 114 |
|
109 | | - - name: ln Python |
110 | | - run: ln -s `which python3` /usr/local/bin/python |
111 | | - |
112 | 115 | - name: Sync devtools-gn |
113 | 116 | run: | |
114 | 117 | export PATH=$(pwd)/packages/devtools-frontend-lynx/buildtools/depot_tools:$PATH |
@@ -196,3 +199,138 @@ jobs: |
196 | 199 | asset_path: ${{ steps.find_dmg.outputs.dmg_path }} |
197 | 200 | asset_name: ${{ steps.find_dmg.outputs.dmg_filename }} |
198 | 201 | asset_content_type: application/x-apple-diskimage |
| 202 | + |
| 203 | + build-and-upload-windows: |
| 204 | + needs: create-release |
| 205 | + runs-on: lynx-windows-2022-large |
| 206 | + |
| 207 | + steps: |
| 208 | + - uses: actions/checkout@v3 |
| 209 | + with: |
| 210 | + submodules: recursive |
| 211 | + |
| 212 | + # Node and pnpm setup steps |
| 213 | + - name: Setup Node.js |
| 214 | + uses: actions/setup-node@v3 |
| 215 | + with: |
| 216 | + node-version: 18.20.2 |
| 217 | + |
| 218 | + - name: Install pnpm |
| 219 | + uses: pnpm/action-setup@v2 |
| 220 | + with: |
| 221 | + version: 7.33.6 |
| 222 | + |
| 223 | + - name: Get pnpm store directory |
| 224 | + shell: pwsh |
| 225 | + run: | |
| 226 | + echo "STORE_PATH=$(pnpm store path --silent)" >> $env:GITHUB_ENV |
| 227 | +
|
| 228 | + - name: Setup pnpm cache |
| 229 | + uses: actions/cache@v3 |
| 230 | + with: |
| 231 | + path: ${{ env.STORE_PATH }} |
| 232 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 233 | + restore-keys: | |
| 234 | + ${{ runner.os }}-pnpm-store- |
| 235 | + |
| 236 | + - name: Install dependencies |
| 237 | + run: pnpm install |
| 238 | + |
| 239 | + - name: Fetch depot_tools |
| 240 | + run: pnpm run fetch:depot_tools |
| 241 | + |
| 242 | + - name: Sync devtools-gn |
| 243 | + shell: pwsh |
| 244 | + run: | |
| 245 | + $env:PATH = "$(Get-Location)\packages\devtools-frontend-lynx\buildtools\depot_tools;$env:PATH" |
| 246 | + pnpm run sync:devtools-gn |
| 247 | +
|
| 248 | + - name: Build devtools-gn |
| 249 | + run: pnpm run build:devtools |
| 250 | + |
| 251 | + - name: Sync devtools-dist |
| 252 | + run: pnpm run sync:devtools-dist |
| 253 | + |
| 254 | + - name: Skip lynx-trace build on Windows |
| 255 | + run: pnpm run build:lynx-trace |
| 256 | + |
| 257 | + - name: Download lynx-trace prebuilt artifact |
| 258 | + uses: robinraju/release-downloader@v1 |
| 259 | + with: |
| 260 | + repository: KananSu/lynx-trace |
| 261 | + latest: true |
| 262 | + fileName: "perfetto-ui-release-*.tar.gz" |
| 263 | + out-file-path: temp-lynx-trace |
| 264 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 265 | + |
| 266 | + - name: Copy lynx-trace to resources |
| 267 | + shell: pwsh |
| 268 | + run: | |
| 269 | + Write-Host "Copying prebuilt lynx-trace artifact..." -ForegroundColor Cyan |
| 270 | + $sourceFile = Get-ChildItem -Path "temp-lynx-trace" -Filter "perfetto-ui-release-*.tar.gz" | Select-Object -First 1 |
| 271 | + $destPath = "packages\lynx-devtool-cli\resources\lynx-trace.tar.gz" |
| 272 | + |
| 273 | + if ($sourceFile) { |
| 274 | + Copy-Item $sourceFile.FullName $destPath -Force |
| 275 | + Write-Host "✓ lynx-trace artifact copied: $($sourceFile.Name) -> lynx-trace.tar.gz" -ForegroundColor Green |
| 276 | + } else { |
| 277 | + Write-Warning "lynx-trace artifact not found, trace feature will be unavailable" |
| 278 | + Get-ChildItem -Path "temp-lynx-trace" -ErrorAction SilentlyContinue |
| 279 | + } |
| 280 | +
|
| 281 | + - name: Build all packages |
| 282 | + run: pnpm run build:all |
| 283 | + |
| 284 | + # Upload frontend (only once) |
| 285 | + - name: Find and Upload Frontend |
| 286 | + shell: pwsh |
| 287 | + run: | |
| 288 | + $archivePath = Get-ChildItem -Path ".\packages\devtools-frontend-lynx\output" -Filter "devtool.frontend.lynx_1.0.*.tar.gz" | Select-Object -First 1 -ExpandProperty FullName |
| 289 | + if (-not $archivePath) { |
| 290 | + Write-Error "Error: Frontend archive not found" |
| 291 | + exit 1 |
| 292 | + } |
| 293 | + Write-Host "Found archive at: $archivePath" |
| 294 | + |
| 295 | + curl.exe ` |
| 296 | + -X POST ` |
| 297 | + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" ` |
| 298 | + -H "Content-Type: application/gzip" ` |
| 299 | + --data-binary "@$archivePath" ` |
| 300 | + "${{ needs.create-release.outputs.upload_url }}?name=devtool.frontend.lynx-${{ needs.create-release.outputs.asset_suffix }}.tar.gz" |
| 301 | +
|
| 302 | + # Build Windows green package (ZIP - no installer) |
| 303 | + - name: Build Windows version |
| 304 | + shell: pwsh |
| 305 | + env: |
| 306 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 307 | + run: | |
| 308 | + Write-Host "Starting Windows build..." -ForegroundColor Cyan |
| 309 | + powershell -ExecutionPolicy Bypass -File scripts\build-win.ps1 |
| 310 | + |
| 311 | + - name: Find Windows ZIP file |
| 312 | + id: find_zip |
| 313 | + shell: pwsh |
| 314 | + run: | |
| 315 | + $zip = Get-ChildItem -Path ".\dist" -Filter "Lynx-DevTool-*-x64.zip" | Select-Object -First 1 |
| 316 | + |
| 317 | + if ($zip) { |
| 318 | + Write-Host "Found ZIP package: $($zip.Name)" -ForegroundColor Green |
| 319 | + Write-Host "Size: $([math]::Round($zip.Length/1MB, 2)) MB" -ForegroundColor Green |
| 320 | + echo "zip_path=$($zip.FullName)" >> $env:GITHUB_OUTPUT |
| 321 | + echo "zip_filename=$($zip.Name)" >> $env:GITHUB_OUTPUT |
| 322 | + } else { |
| 323 | + Write-Error "No ZIP file found in dist directory" |
| 324 | + Get-ChildItem -Path ".\dist" | Format-Table Name |
| 325 | + exit 1 |
| 326 | + } |
| 327 | +
|
| 328 | + - name: Upload Windows ZIP Package |
| 329 | + uses: actions/upload-release-asset@v1 |
| 330 | + env: |
| 331 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 332 | + with: |
| 333 | + upload_url: ${{ needs.create-release.outputs.upload_url }} |
| 334 | + asset_path: ${{ steps.find_zip.outputs.zip_path }} |
| 335 | + asset_name: ${{ steps.find_zip.outputs.zip_filename }} |
| 336 | + asset_content_type: application/zip |
0 commit comments