Build V8 Windows (Fiber Support) #6
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
| name: Build V8 Windows (Fiber Support) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| build_type: | |
| description: 'Build Configuration' | |
| required: true | |
| default: 'release' | |
| type: choice | |
| options: | |
| - release | |
| - debug | |
| linkage_type: | |
| description: 'Linkage Type' | |
| required: true | |
| default: 'static' | |
| type: choice | |
| options: | |
| - static | |
| - shared | |
| target_arch: | |
| description: 'Target CPU Architecture' | |
| required: true | |
| default: 'x64' | |
| type: choice | |
| options: | |
| - x64 | |
| - x86 | |
| - arm64 | |
| v8_version: | |
| description: 'V8 Version (Tag or Branch)' | |
| required: true | |
| default: 'main' | |
| type: string | |
| jobs: | |
| build-v8: | |
| name: Build V8 (${{ inputs.target_arch }} - ${{ inputs.linkage_type }} - ${{ inputs.build_type }}) | |
| runs-on: windows-latest | |
| timeout-minutes: 360 | |
| env: | |
| DEPOT_TOOLS_WIN_TOOLCHAIN: '0' # Use local Visual Studio | |
| PYTHONIOENCODING: 'utf-8' | |
| steps: | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Depot Tools | |
| shell: powershell | |
| run: | | |
| Invoke-WebRequest -Uri "https://storage.googleapis.com/chrome-infra/depot_tools.zip" -OutFile "depot_tools.zip" | |
| Expand-Archive -Path "depot_tools.zip" -DestinationPath "C:\depot_tools" | |
| "C:\depot_tools" | Out-File -FilePath $env:GITHUB_PATH -Append | |
| - name: Initialize Depot Tools | |
| shell: powershell | |
| run: | | |
| $env:PATH = "C:\depot_tools;" + $env:PATH | |
| gclient --version | |
| - name: Fetch V8 Source | |
| shell: powershell | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| $env:PATH = "C:\depot_tools;" + $env:PATH | |
| fetch v8 | |
| cd v8 | |
| git checkout ${{ inputs.v8_version }} | |
| gclient sync | |
| # --- FIX: WRITE ARGS DIRECTLY TO FILE TO AVOID QUOTING ERRORS --- | |
| - name: Generate Build Config (args.gn) | |
| shell: powershell | |
| working-directory: ${{ github.workspace }}\v8 | |
| run: | | |
| # 1. Create the output directory first | |
| $outDir = "out.gn\build" | |
| New-Item -ItemType Directory -Force -Path $outDir | |
| # 2. Prepare the Argument Content | |
| $content = @() | |
| # Helper variables | |
| $isShared = if ("${{ inputs.linkage_type }}" -eq "shared") { "true" } else { "false" } | |
| $isDebug = if ("${{ inputs.build_type }}" -eq "debug") { "true" } else { "false" } | |
| # Core Settings | |
| $content += "is_component_build = $isShared" | |
| $content += "is_debug = $isDebug" | |
| # PowerShell Syntax: "" inside a string results in a single literal " | |
| $content += "target_cpu = ""${{ inputs.target_arch }}""" | |
| $content += "target_os = ""win""" | |
| # MSVC Settings | |
| $content += "is_clang = false" | |
| $content += "use_custom_libcxx = false" | |
| # Fibjs / Fiber Stability Flags | |
| $content += "v8_enable_turbofan = true" | |
| $content += "cppgc_enable_caged_heap = false" | |
| $content += "v8_enable_pointer_compression = false" | |
| $content += "v8_enable_sandbox = false" | |
| $content += "v8_control_flow_integrity = false" | |
| $content += "v8_use_external_startup_data = false" | |
| $content += "v8_use_libm_trig_functions = false" | |
| $content += "v8_enable_short_builtin_calls = false" | |
| $content += "v8_enable_lazy_source_positions = false" | |
| $content += "v8_enable_allocation_folding = false" | |
| $content += "v8_allocation_site_tracking = false" | |
| $content += "v8_enable_system_instrumentation = false" | |
| $content += "v8_enable_lite_mode = false" | |
| $content += "v8_enable_gdbjit = false" | |
| $content += "v8_enable_webassembly = true" | |
| # Monolith Logic | |
| if ("${{ inputs.linkage_type }}" -eq "static") { | |
| $content += "v8_monolithic = true" | |
| } | |
| # Cleanup / Symbols | |
| $content += "v8_deprecation_warnings = false" | |
| $content += "v8_imminent_deprecation_warnings = false" | |
| $content += "v8_enable_tests = false" | |
| if ($isDebug -eq "true") { | |
| $content += "symbol_level = 2" | |
| } else { | |
| $content += "symbol_level = 0" | |
| } | |
| # 3. Write to file | |
| $content | Out-File -FilePath "$outDir\args.gn" -Encoding ascii | |
| # Print for verification | |
| Write-Host "--- Created args.gn ---" | |
| Get-Content "$outDir\args.gn" | |
| - name: Compile V8 | |
| shell: powershell | |
| working-directory: ${{ github.workspace }}\v8 | |
| run: | | |
| $env:PATH = "C:\depot_tools;" + $env:PATH | |
| # 1. Generate Ninja files (reads from the args.gn we created above) | |
| gn gen out.gn/build | |
| # 2. Build | |
| $target = if ("${{ inputs.linkage_type }}" -eq "static") { "v8_monolith" } else { "v8" } | |
| autoninja -C out.gn/build $target | |
| - name: Collect Artifacts | |
| shell: powershell | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| New-Item -ItemType Directory -Force -Path "artifacts\lib" | |
| New-Item -ItemType Directory -Force -Path "artifacts\include" | |
| New-Item -ItemType Directory -Force -Path "artifacts\bin" | |
| Copy-Item -Path "v8\include\*" -Destination "artifacts\include" -Recurse | |
| $build = "v8\out.gn\build" | |
| Get-ChildItem -Path $build -Filter "*.lib" | Copy-Item -Destination "artifacts\lib" | |
| Get-ChildItem -Path $build -Filter "*.dll" | Copy-Item -Destination "artifacts\bin" | |
| Get-ChildItem -Path $build -Filter "*.pdb" | Copy-Item -Destination "artifacts\bin" | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: v8-win-${{ inputs.target_arch }}-${{ inputs.linkage_type }}-${{ inputs.build_type }} | |
| path: artifacts/ |