fix: demos on win #2150
Workflow file for this run
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: Windows (x64) | |
| on: | |
| release: | |
| types: [created] | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| paths-ignore: | |
| - "tools/**" | |
| - ".vscode/**" | |
| - ".devcontainer/**" | |
| - ".github/**" | |
| - "!.github/workflows/win.yml" | |
| - "core/src/ten_manager/designer_frontend/**" | |
| - "**.md" | |
| - "ai_agents/**" | |
| permissions: | |
| contents: write | |
| discussions: write | |
| security-events: write | |
| concurrency: | |
| group: win-x64-${{ github.head_ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| call-check-pr-status: | |
| uses: ./.github/workflows/_check_pr_status.yml | |
| build: | |
| needs: call-check-pr-status | |
| if: ${{ needs.call-check-pr-status.outputs.should_continue == 'true' }} | |
| runs-on: windows-latest | |
| env: | |
| PYTHONIOENCODING: utf-8 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build_type: [debug, release] | |
| compiler: [msvc, mingw] | |
| steps: | |
| - name: Check PR status before matrix execution | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| console.log('Event name:', context.eventName); | |
| console.log('Matrix:', ${{ toJson(matrix) }}); | |
| // Only check for PR events | |
| if (context.eventName !== 'pull_request') { | |
| console.log('Not a PR event, continuing...'); | |
| return; | |
| } | |
| // Ensure we have PR data | |
| if (!context.payload.pull_request) { | |
| console.log('No pull_request data in payload, continuing...'); | |
| return; | |
| } | |
| const { owner, repo } = context.repo; | |
| const prNumber = context.payload.pull_request.number; | |
| try { | |
| const pr = await github.rest.pulls.get({ | |
| owner, | |
| repo, | |
| pull_number: prNumber, | |
| }); | |
| console.log(`PR #${prNumber} state: ${pr.data.state}, merged: ${pr.data.merged}`); | |
| if (pr.data.state === 'closed') { | |
| if (pr.data.merged) { | |
| console.log(`PR #${prNumber} has been merged. Stopping matrix execution.`); | |
| core.setFailed('PR has been merged, stopping execution to save resources.'); | |
| } else { | |
| console.log(`PR #${prNumber} has been closed. Stopping matrix execution.`); | |
| core.setFailed('PR has been closed, stopping execution to save resources.'); | |
| } | |
| } else { | |
| console.log(`PR #${prNumber} is still open. Continuing matrix execution.`); | |
| } | |
| } catch (error) { | |
| console.error(`Error checking PR status: ${error.message}`); | |
| console.log('Error details:', error); | |
| console.log('Continuing matrix execution due to error...'); | |
| } | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: false | |
| - name: Enable Windows long path support | |
| shell: pwsh | |
| run: | | |
| Write-Output "Enabling Windows long path support..." | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force | |
| Write-Output "Long path support enabled" | |
| - name: Trust working directory | |
| run: git config --global --add safe.directory "${GITHUB_WORKSPACE}" | |
| - name: Initialize and update submodules except portal/ | |
| shell: bash | |
| run: | | |
| # Retrieve all submodule paths, excluding `portal/`. | |
| submodules=$(git config --file .gitmodules --get-regexp path | awk '$2 != "portal" { print $2 }') | |
| git submodule init | |
| for submodule in $submodules; do | |
| echo "Initializing submodule: $submodule" | |
| git submodule update --init --recursive --depth 1 "$submodule" | |
| done | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Setup MSVC | |
| if: matrix.compiler == 'msvc' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "stable" | |
| cache: false | |
| - name: Install MinGW and setup toolchain | |
| if: matrix.compiler == 'mingw' | |
| shell: pwsh | |
| run: | | |
| Write-Output "Downloading MinGW from GitHub releases..." | |
| $mingwUrl = "https://github.com/niXman/mingw-builds-binaries/releases/download/15.2.0-rt_v13-rev0/x86_64-15.2.0-release-posix-seh-ucrt-rt_v13-rev0.7z" | |
| $mingwArchive = Join-Path $env:RUNNER_TEMP "mingw.7z" | |
| $mingwBase = Join-Path $env:RUNNER_TEMP "mingw64" | |
| try { | |
| Invoke-WebRequest -Uri $mingwUrl -OutFile $mingwArchive -UseBasicParsing -ErrorAction Stop | |
| Write-Output "Download completed: $mingwArchive" | |
| } catch { | |
| Write-Error "Failed to download MinGW: $($_.Exception.Message)" | |
| exit 1 | |
| } | |
| # Extract 7z archive | |
| Write-Output "Extracting MinGW archive..." | |
| if (Test-Path $mingwBase) { | |
| Remove-Item -Recurse -Force $mingwBase | |
| } | |
| New-Item -ItemType Directory -Force -Path $mingwBase | Out-Null | |
| # Use 7z to extract (7-Zip is expected on Windows runners; install via choco if missing) | |
| $7zPath = "C:\Program Files\7-Zip\7z.exe" | |
| if (-not (Test-Path $7zPath)) { | |
| Write-Output "7-Zip not found at $7zPath, installing via Chocolatey..." | |
| choco install 7zip -y --no-progress | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "Failed to install 7-Zip via Chocolatey" | |
| exit 1 | |
| } | |
| if (-not (Test-Path $7zPath)) { | |
| Write-Error "7-Zip still not found at $7zPath after installation" | |
| exit 1 | |
| } | |
| } | |
| & $7zPath x $mingwArchive -o"$mingwBase" -y | Out-Null | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "Failed to extract MinGW archive" | |
| exit 1 | |
| } | |
| # Find the mingw64 directory (it might be nested) | |
| $mingw64Path = Get-ChildItem -Path $mingwBase -Recurse -Directory -Filter "mingw64" | Select-Object -First 1 | |
| if ($null -eq $mingw64Path) { | |
| Write-Error "mingw64 directory not found after extraction" | |
| exit 1 | |
| } | |
| $mingwBinPath = Join-Path $mingw64Path.FullName "bin" | |
| if (-not (Test-Path $mingwBinPath)) { | |
| Write-Error "mingw64/bin directory not found" | |
| exit 1 | |
| } | |
| Write-Output "MinGW installed at: $mingwBinPath" | |
| # Add to PATH | |
| echo "$mingwBinPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| # Verify gcc | |
| $env:PATH = "$mingwBinPath;$env:PATH" | |
| & gcc --version | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "gcc not working!" | |
| exit 1 | |
| } | |
| Write-Output "MinGW installation successful" | |
| - name: Install tools and dependencies | |
| shell: pwsh | |
| run: | | |
| pip3 install --use-pep517 python-dotenv jinja2 requests | |
| go install golang.org/dl/go1.24.3@latest | |
| go1.24.3 download | |
| go1.24.3 version | |
| go env -w GOFLAGS="-buildvcs=false" | |
| if ("${{ matrix.compiler }}" -eq "mingw") { | |
| # Must use nightly for MinGW, otherwise error[E0554] will be triggered | |
| # when rustc is building tman.exe, because sysinfo 0.32 uses | |
| # "#![cfg_attr(target_os = "windows", feature(windows_by_handle))]" | |
| # to use windows file handle API, which "may not be used on the stable | |
| # release channel" | |
| rustup default nightly-x86_64-pc-windows-gnu | |
| } else { | |
| # For msvc, we also need to use nightly when ten_enable_go_binding=true | |
| # because Go always uses MinGW toolchain on Windows (CGO requires | |
| # GCC-compatible compiler) and the above issues will also happen. | |
| rustup default nightly-x86_64-pc-windows-msvc | |
| } | |
| cargo install --force cbindgen | |
| Write-Output "Verifying Rust toolchain..." | |
| rustup show | |
| rustc --version | |
| cargo --version | |
| - name: Update version | |
| run: | | |
| python tools/version/update_version_in_ten_framework.py | |
| python tools/version/check_version_in_ten_framework.py | |
| - name: Get Python executable path | |
| run: | | |
| $pythonPath = python -c "import sys; print(sys.executable)" | |
| Write-Output "Python executable path: $pythonPath" | |
| $pythonDir = Split-Path $pythonPath | |
| Write-Output "Python directory path: $pythonDir" | |
| echo "PYTHON3_PATH=$pythonDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| shell: pwsh | |
| - name: Use Python path | |
| run: | | |
| Write-Output "The Python directory is located at: $env:PYTHON3_PATH" | |
| shell: pwsh | |
| - name: Build | |
| shell: pwsh | |
| run: | | |
| $ENV:PATH += ";$PWD/core/ten_gn" | |
| $buildArgs = @() | |
| if ("${{ matrix.compiler }}" -eq "mingw") { | |
| $buildArgs += "is_mingw=true" | |
| $buildArgs += "is_clang=false" | |
| $buildArgs += "ten_enable_nodejs_binding=false" | |
| } else { | |
| $buildArgs += "is_mingw=false" # msvc | |
| $buildArgs += "is_clang=true" # choose to use clang-cl.exe instead of cl.exe, the latter does not work yet | |
| $buildArgs += "vs_version=2022" | |
| $buildArgs += "ten_enable_nodejs_binding=true" | |
| } | |
| $buildArgs += "log_level=1" | |
| $buildArgs += "enable_serialized_actions=true" | |
| $buildArgs += "ten_rust_enable_gen_cargo_config=false" | |
| $buildArgs += "ten_enable_cargo_clean=true" | |
| $buildArgs += "ten_enable_python_binding=true" | |
| $buildArgs += "ten_enable_go_binding=true" | |
| $buildArgs += "ten_enable_rust_incremental_build=false" | |
| $buildArgs += "ten_manager_enable_frontend=false" | |
| $argsString = $buildArgs -join " " | |
| Write-Host "Build arguments: $argsString" | |
| # Set toolchain or else toolchain may be switched during build | |
| if ("${{ matrix.compiler }}" -eq "mingw") { | |
| $env:RUSTUP_TOOLCHAIN = "nightly-x86_64-pc-windows-gnu" | |
| } | |
| else { | |
| $env:RUSTUP_TOOLCHAIN = "nightly-x86_64-pc-windows-msvc" | |
| } | |
| echo $env:RUSTUP_TOOLCHAIN | |
| tgn gen win x64 ${{ matrix.build_type }} -- $argsString | |
| tgn build win x64 ${{ matrix.build_type }} | |
| - name: Update supports before upload or publish | |
| continue-on-error: true | |
| shell: pwsh | |
| run: | | |
| $UPDATE_SUPPORTS_SCRIPT = "$(pwd)/tools/supports/update_supports_in_manifest_json.py" | |
| cd out/win/x64/ten_packages | |
| $ARRAY = @( | |
| "system/ten_runtime", | |
| "system/ten_runtime_go", | |
| "system/ten_runtime_python", | |
| "system/ten_runtime_nodejs", | |
| "addon_loader/python_addon_loader", | |
| "addon_loader/nodejs_addon_loader" | |
| ) | |
| foreach ($item in $ARRAY) { | |
| Write-Host "Processing item: $item" | |
| if (Test-Path "$item/manifest.json") { | |
| $result = python $UPDATE_SUPPORTS_SCRIPT --os-arch-pairs win:x64 --input-file "$item/manifest.json" --output-file "$item/manifest.json" --log-level 1 | |
| if ($LASTEXITCODE -eq 0) { | |
| Write-Host "✓ Successfully updated supports for $item" | |
| Get-Content "$item/manifest.json" | |
| } else { | |
| Write-Host "✗ Failed to update supports for $item, continuing with next item..." | |
| } | |
| } else { | |
| Write-Host "✗ manifest.json not found for $item" | |
| } | |
| } | |
| - name: Package tests relevant artifacts preserving permissions | |
| shell: pwsh | |
| run: | | |
| $basePath = "out/win/x64" | |
| $items = @("tests", "ten_manager", "tgn_args.txt") | |
| $files = @() | |
| foreach ($item in $items) { | |
| $path = Join-Path $basePath $item | |
| if (Test-Path $path) { | |
| $files += $path | |
| } | |
| } | |
| if ($files.Count -gt 0) { | |
| Compress-Archive -Path $files -DestinationPath tests-artifacts.zip -Force | |
| } | |
| - name: Upload tests relevant artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tests-artifacts-win-${{ matrix.build_type }}-${{ matrix.compiler }} | |
| path: tests-artifacts.zip | |
| if-no-files-found: ignore | |
| - name: Package assets | |
| if: github.event_name == 'release' || (github.ref != '' && startsWith(github.ref, 'refs/tags/')) | |
| shell: pwsh | |
| working-directory: out/win/x64 | |
| run: | | |
| Write-Host "Current directory: $(Get-Location)" | |
| Compress-Archive -Path ten_manager -DestinationPath tman-win-${{ matrix.build_type }}-x64.zip -CompressionLevel Optimal | |
| # Define array of files/directories to package | |
| $FILES_TO_PACKAGE = @( | |
| "app/default_app_cpp", | |
| "app/default_app_python", | |
| "ten_packages/system/ten_runtime", | |
| "ten_packages/system/ten_runtime_python", | |
| "ten_packages/extension/default_extension_cpp", | |
| "ten_packages/extension/default_extension_python", | |
| "ten_packages/extension/default_async_extension_python", | |
| "ten_packages/extension/default_asr_extension_python", | |
| "ten_packages/extension/default_llm_extension_python", | |
| "ten_packages/extension/default_tts_extension_python", | |
| "ten_packages/extension/default_mllm_extension_python", | |
| "ten_packages/addon_loader/python_addon_loader" | |
| ) | |
| # Filter existing files | |
| $EXISTING_FILES = @() | |
| foreach ($file in $FILES_TO_PACKAGE) { | |
| if (Test-Path $file) { | |
| $EXISTING_FILES += $file | |
| Write-Host "✓ Found: $file" | |
| } else { | |
| Write-Host "✗ Missing: $file (will be skipped)" | |
| } | |
| } | |
| if ($EXISTING_FILES.Count -gt 0) { | |
| Write-Host "Creating zip archive with $($EXISTING_FILES.Count) items..." | |
| Compress-Archive -Path $EXISTING_FILES -DestinationPath ten_packages-win-${{ matrix.build_type }}-x64.zip -CompressionLevel Optimal | |
| } else { | |
| Write-Host "Warning: No files found to package" | |
| } | |
| - name: Publish to release assets | |
| uses: softprops/action-gh-release@v2 | |
| if: github.event_name == 'release' || (github.ref != '' && startsWith(github.ref, 'refs/tags/')) | |
| with: | |
| tag_name: ${{ github.event_name == 'release' && github.event.release.tag_name || github.ref_name }} | |
| files: | | |
| out/win/x64/ten_packages-win-${{ matrix.build_type }}-x64.zip | |
| - name: Clean up | |
| if: github.event_name == 'release' || (github.ref != '' && startsWith(github.ref, 'refs/tags/')) | |
| continue-on-error: true | |
| shell: pwsh | |
| run: | | |
| Remove-Item -Force "out/win/x64/ten_packages-win-${{ matrix.build_type }}-x64.zip" -ErrorAction SilentlyContinue | |
| - name: Copy import libraries to system packages before publishing | |
| if: | | |
| (github.event_name == 'release' || | |
| (github.ref != '' && startsWith(github.ref, 'refs/tags/'))) && | |
| matrix.build_type == 'release' && | |
| matrix.compiler == 'msvc' | |
| shell: pwsh | |
| run: | | |
| $ErrorActionPreference = "Stop" | |
| cd out/win/x64 | |
| # Copy .lib files for ten_runtime package | |
| $ten_runtime_lib_dir = "ten_packages/system/ten_runtime/lib" | |
| if (-not (Test-Path $ten_runtime_lib_dir)) { | |
| Write-Error "ten_runtime lib directory not found: $ten_runtime_lib_dir" | |
| exit 1 | |
| } | |
| Write-Host "Copying import libraries to ten_runtime package..." | |
| if (-not (Test-Path "ten_runtime.dll.lib")) { | |
| Write-Error "ten_runtime.dll.lib not found in root_out_dir" | |
| exit 1 | |
| } | |
| Copy-Item "ten_runtime.dll.lib" "$ten_runtime_lib_dir/" -Force | |
| if (-not (Test-Path "$ten_runtime_lib_dir/ten_runtime.dll.lib")) { | |
| Write-Error "Failed to copy ten_runtime.dll.lib" | |
| exit 1 | |
| } | |
| Write-Host "✓ Copied ten_runtime.dll.lib" | |
| if (-not (Test-Path "ten_utils.dll.lib")) { | |
| Write-Error "ten_utils.dll.lib not found in root_out_dir" | |
| exit 1 | |
| } | |
| Copy-Item "ten_utils.dll.lib" "$ten_runtime_lib_dir/" -Force | |
| if (-not (Test-Path "$ten_runtime_lib_dir/ten_utils.dll.lib")) { | |
| Write-Error "Failed to copy ten_utils.dll.lib" | |
| exit 1 | |
| } | |
| Write-Host "✓ Copied ten_utils.dll.lib" | |
| # Copy .lib files for ten_runtime_python package | |
| $ten_runtime_python_lib_dir = "ten_packages/system/ten_runtime_python/lib" | |
| if (-not (Test-Path $ten_runtime_python_lib_dir)) { | |
| Write-Error "ten_runtime_python lib directory not found: $ten_runtime_python_lib_dir" | |
| exit 1 | |
| } | |
| Write-Host "Copying import libraries to ten_runtime_python package..." | |
| if (-not (Test-Path "libten_runtime_python.pyd.lib")) { | |
| Write-Error "libten_runtime_python.pyd.lib not found in root_out_dir" | |
| exit 1 | |
| } | |
| Copy-Item "libten_runtime_python.pyd.lib" "$ten_runtime_python_lib_dir/" -Force | |
| if (-not (Test-Path "$ten_runtime_python_lib_dir/libten_runtime_python.pyd.lib")) { | |
| Write-Error "Failed to copy libten_runtime_python.pyd.lib" | |
| exit 1 | |
| } | |
| Write-Host "✓ Copied libten_runtime_python.pyd.lib" | |
| - name: Publish release to TEN cloud store | |
| if: | | |
| (github.event_name == 'release' || | |
| (github.ref != '' && startsWith(github.ref, 'refs/tags/'))) && | |
| matrix.build_type == 'release' && | |
| matrix.compiler == 'msvc' | |
| continue-on-error: true | |
| shell: pwsh | |
| run: | | |
| $TMAN_BIN = "$(pwd)/out/win/x64/ten_manager/bin/tman.exe" | |
| cd out/win/x64 | |
| $ARRAY = @( | |
| "app/default_app_cpp", | |
| "app/default_app_python", | |
| "ten_packages/system/ten_runtime", | |
| "ten_packages/system/ten_runtime_go", | |
| "ten_packages/system/ten_runtime_python", | |
| "ten_packages/system/ten_runtime_nodejs", | |
| "ten_packages/extension/default_extension_cpp", | |
| "ten_packages/extension/default_extension_python", | |
| "ten_packages/extension/default_async_extension_python", | |
| "ten_packages/extension/default_asr_extension_python", | |
| "ten_packages/extension/default_llm_extension_python", | |
| "ten_packages/extension/default_tts_extension_python", | |
| "ten_packages/extension/default_mllm_extension_python", | |
| "ten_packages/addon_loader/python_addon_loader", | |
| "ten_packages/addon_loader/nodejs_addon_loader" | |
| ) | |
| $SUCCESSFUL_PUBLISHES = 0 | |
| $FAILED_PUBLISHES = 0 | |
| foreach ($item in $ARRAY) { | |
| Write-Host "Processing: $item" | |
| if (!(Test-Path $item -PathType Container)) { | |
| Write-Host "✗ Directory not found: $item, skipping..." | |
| $FAILED_PUBLISHES++ | |
| continue | |
| } | |
| Push-Location $item | |
| try { | |
| # Try to get identity | |
| $identity = & $TMAN_BIN package --get-identity 2>&1 | |
| if ($LASTEXITCODE -eq 0) { | |
| Write-Host "Identity: $identity" | |
| # Try to delete existing package (this can fail, it's okay) | |
| Write-Host "Attempting to delete existing package..." | |
| $identityParts = $identity -split '\s+' | |
| if ($identityParts.Count -ge 4) { | |
| & $TMAN_BIN --verbose --admin-token ${{ secrets.TEN_CLOUD_STORE_ADMIN_TOKEN }} delete $identityParts[0] $identityParts[1] $identityParts[2] $identityParts[3] 2>&1 | Write-Host | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Host "Warning: Failed to delete existing package (this is normal if package doesn't exist)" | |
| } | |
| } | |
| # Try to publish | |
| Write-Host "Attempting to publish package..." | |
| & $TMAN_BIN --verbose --user-token ${{ secrets.TEN_CLOUD_STORE }} publish 2>&1 | Write-Host | |
| if ($LASTEXITCODE -eq 0) { | |
| Write-Host "✓ Successfully published: $item" | |
| $SUCCESSFUL_PUBLISHES++ | |
| } else { | |
| Write-Host "✗ Failed to publish: $item" | |
| $FAILED_PUBLISHES++ | |
| } | |
| } else { | |
| Write-Host "✗ Failed to get identity for: $item" | |
| $FAILED_PUBLISHES++ | |
| } | |
| } | |
| catch { | |
| Write-Host "✗ Error processing $item : $_" | |
| $FAILED_PUBLISHES++ | |
| } | |
| finally { | |
| Pop-Location | |
| } | |
| } | |
| Write-Host "Publication summary: $SUCCESSFUL_PUBLISHES successful, $FAILED_PUBLISHES failed" | |
| - name: Clean up | |
| if: | | |
| (github.event_name == 'release' || | |
| (github.ref != '' && startsWith(github.ref, 'refs/tags/'))) && | |
| matrix.build_type == 'release' && | |
| matrix.compiler == 'msvc' | |
| continue-on-error: true | |
| shell: pwsh | |
| run: | | |
| cd out/win/x64 | |
| $ARRAY = @( | |
| "app/default_app_cpp", | |
| "app/default_app_python", | |
| "ten_packages/system/ten_runtime", | |
| "ten_packages/system/ten_runtime_go", | |
| "ten_packages/system/ten_runtime_python", | |
| "ten_packages/system/ten_runtime_nodejs", | |
| "ten_packages/extension/default_extension_cpp", | |
| "ten_packages/extension/default_extension_python", | |
| "ten_packages/extension/default_async_extension_python", | |
| "ten_packages/extension/default_asr_extension_python", | |
| "ten_packages/extension/default_llm_extension_python", | |
| "ten_packages/extension/default_tts_extension_python", | |
| "ten_packages/extension/default_mllm_extension_python", | |
| "ten_packages/addon_loader/python_addon_loader", | |
| "ten_packages/addon_loader/nodejs_addon_loader" | |
| ) | |
| $SUCCESSFUL_CLEANUPS = 0 | |
| $FAILED_CLEANUPS = 0 | |
| foreach ($item in $ARRAY) { | |
| Write-Host "Cleaning up: $item" | |
| if (Test-Path $item) { | |
| try { | |
| Remove-Item -Recurse -Force $item | |
| Write-Host "✓ Successfully removed: $item" | |
| $SUCCESSFUL_CLEANUPS++ | |
| } | |
| catch { | |
| Write-Host "✗ Failed to remove: $item" | |
| $FAILED_CLEANUPS++ | |
| } | |
| } else { | |
| Write-Host "• Already absent: $item" | |
| $SUCCESSFUL_CLEANUPS++ | |
| } | |
| } | |
| Write-Host "Cleanup summary: $SUCCESSFUL_CLEANUPS successful, $FAILED_CLEANUPS failed" | |
| test-standalone: | |
| needs: build | |
| runs-on: windows-latest | |
| env: | |
| PYTHONIOENCODING: utf-8 | |
| strategy: | |
| matrix: | |
| build_type: [debug, release] | |
| compiler: [msvc, mingw] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: false | |
| - name: Enable Windows long path support | |
| shell: pwsh | |
| run: | | |
| Write-Output "Enabling Windows long path support..." | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force | |
| Write-Output "Long path support enabled" | |
| - name: Trust working directory | |
| run: git config --global --add safe.directory "${GITHUB_WORKSPACE}" | |
| - name: Initialize and update submodules except portal/ | |
| shell: bash | |
| run: | | |
| # Retrieve all submodule paths, excluding `portal/`. | |
| submodules=$(git config --file .gitmodules --get-regexp path | awk '$2 != "portal" { print $2 }') | |
| git submodule init | |
| for submodule in $submodules; do | |
| echo "Initializing submodule: $submodule" | |
| git submodule update --init --recursive --depth 1 "$submodule" | |
| done | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "stable" | |
| cache: false | |
| - name: Install tools and dependencies | |
| run: | | |
| pip3 install --use-pep517 python-dotenv jinja2 | |
| go install golang.org/dl/go1.24.3@latest | |
| go1.24.3 download | |
| go1.24.3 version | |
| go env -w GOFLAGS="-buildvcs=false" | |
| - name: Get Python executable path | |
| run: | | |
| $pythonPath = python -c "import sys; print(sys.executable)" | |
| Write-Output "Python executable path: $pythonPath" | |
| $pythonDir = Split-Path $pythonPath | |
| Write-Output "Python directory path: $pythonDir" | |
| echo "PYTHON3_PATH=$pythonDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| shell: pwsh | |
| - name: Use Python path | |
| run: | | |
| Write-Output "The Python directory is located at: $env:PYTHON3_PATH" | |
| shell: pwsh | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: tests-artifacts-win-${{ matrix.build_type }}-${{ matrix.compiler }} | |
| path: out/win/x64 | |
| - name: Extract tests artifacts preserving permissions | |
| shell: pwsh | |
| run: | | |
| Expand-Archive -Path "out/win/x64/tests-artifacts.zip" -DestinationPath "out/win/x64" -Force | |
| - name: Run Tests (ten_utils_unit_test) | |
| env: | |
| TEN_ENABLE_BACKTRACE_DUMP: "true" | |
| run: | | |
| chmod +x out/win/x64/tests/standalone/ten_utils_unit_test | |
| out/win/x64/tests/standalone/ten_utils_unit_test | |
| - name: Run Tests (ten_runtime_unit_test) | |
| env: | |
| TEN_ENABLE_BACKTRACE_DUMP: "true" | |
| run: | | |
| chmod +x out/win/x64/tests/standalone/ten_runtime_unit_test | |
| out/win/x64/tests/standalone/ten_runtime_unit_test | |
| - name: Run Tests (ten_rust standalone tests) | |
| env: | |
| RUST_BACKTRACE: "full" | |
| run: | | |
| cd out/win/x64/tests/standalone/ten_rust | |
| chmod +x unit_test | |
| chmod +x integration_test | |
| ./unit_test --nocapture --test-threads=1 || { echo "ten_rust unit test failed"; exit 1; } | |
| ./integration_test --nocapture --test-threads=1 || { echo "ten_rust integration test failed"; exit 1; } | |
| - name: Run Tests (ten_manager standalone tests) | |
| env: | |
| RUST_BACKTRACE: "full" | |
| run: | | |
| cd out/win/x64/tests/standalone/ten_manager | |
| chmod +x unit_test | |
| chmod +x integration_test | |
| ./unit_test --nocapture --test-threads=1 || { echo "ten_manager unit test failed"; exit 1; } | |
| ./integration_test --nocapture --test-threads=1 || { echo "ten_manager integration test failed"; exit 1; } | |
| # continue-on-error: true | |
| # - name: Setup tmate session | |
| # uses: mxschmitt/action-tmate@v3 | |
| - name: Run Tests (ten_runtime_smoke_test) | |
| env: | |
| TEN_ENABLE_BACKTRACE_DUMP: "true" | |
| run: | | |
| chmod +x out/win/x64/tests/standalone/ten_runtime_smoke_test | |
| out/win/x64/tests/standalone/ten_runtime_smoke_test | |
| test-integration-ten-manager: | |
| needs: build | |
| runs-on: windows-latest | |
| env: | |
| PYTHONIOENCODING: utf-8 | |
| strategy: | |
| matrix: | |
| build_type: [debug, release] | |
| compiler: [msvc, mingw] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: false | |
| - name: Enable Windows long path support | |
| shell: pwsh | |
| run: | | |
| Write-Output "Enabling Windows long path support..." | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force | |
| Write-Output "Long path support enabled" | |
| - name: Trust working directory | |
| run: git config --global --add safe.directory "${GITHUB_WORKSPACE}" | |
| - name: Initialize and update submodules except portal/ | |
| shell: bash | |
| run: | | |
| # Retrieve all submodule paths, excluding `portal/`. | |
| submodules=$(git config --file .gitmodules --get-regexp path | awk '$2 != "portal" { print $2 }') | |
| git submodule init | |
| for submodule in $submodules; do | |
| echo "Initializing submodule: $submodule" | |
| git submodule update --init --recursive --depth 1 "$submodule" | |
| done | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "stable" | |
| cache: false | |
| - name: Install tools and dependencies | |
| run: | | |
| pip3 install --use-pep517 python-dotenv jinja2 | |
| go install golang.org/dl/go1.24.3@latest | |
| go1.24.3 download | |
| go1.24.3 version | |
| go env -w GOFLAGS="-buildvcs=false" | |
| - name: Get Python executable path | |
| run: | | |
| $pythonPath = python -c "import sys; print(sys.executable)" | |
| Write-Output "Python executable path: $pythonPath" | |
| $pythonDir = Split-Path $pythonPath | |
| Write-Output "Python directory path: $pythonDir" | |
| echo "PYTHON3_PATH=$pythonDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| shell: pwsh | |
| - name: Use Python path | |
| run: | | |
| Write-Output "The Python directory is located at: $env:PYTHON3_PATH" | |
| shell: pwsh | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: tests-artifacts-win-${{ matrix.build_type }}-${{ matrix.compiler }} | |
| path: out/win/x64 | |
| - name: Extract tests artifacts preserving permissions | |
| shell: pwsh | |
| run: | | |
| Expand-Archive -Path "out/win/x64/tests-artifacts.zip" -DestinationPath "out/win/x64" -Force | |
| - name: Install Python dependencies via script | |
| run: | | |
| python .github/tools/setup_pytest_dependencies.py | |
| - name: Run Tests (ten_manager pytest tests) | |
| run: | | |
| cd out/win/x64/ | |
| pytest -s tests/ten_manager/ | |
| test-integration-python: | |
| needs: build | |
| runs-on: windows-latest | |
| env: | |
| PYTHONIOENCODING: utf-8 | |
| strategy: | |
| matrix: | |
| build_type: [debug, release] | |
| compiler: [msvc, mingw] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: false | |
| - name: Enable Windows long path support | |
| shell: pwsh | |
| run: | | |
| Write-Output "Enabling Windows long path support..." | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force | |
| Write-Output "Long path support enabled" | |
| - name: Trust working directory | |
| shell: bash | |
| run: git config --global --add safe.directory "${GITHUB_WORKSPACE}" | |
| - name: Initialize and update submodules except portal/ | |
| shell: bash | |
| run: | | |
| # Retrieve all submodule paths, excluding `portal/`. | |
| submodules=$(git config --file .gitmodules --get-regexp path | awk '$2 != "portal" { print $2 }') | |
| git submodule init | |
| for submodule in $submodules; do | |
| echo "Initializing submodule: $submodule" | |
| git submodule update --init --recursive --depth 1 "$submodule" | |
| done | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Setup MSVC | |
| if: matrix.compiler == 'msvc' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "stable" | |
| cache: false | |
| - name: Install MinGW and setup toolchain | |
| if: matrix.compiler == 'mingw' | |
| shell: pwsh | |
| run: | | |
| Write-Output "Downloading MinGW from GitHub releases..." | |
| $mingwUrl = "https://github.com/niXman/mingw-builds-binaries/releases/download/15.2.0-rt_v13-rev0/x86_64-15.2.0-release-posix-seh-ucrt-rt_v13-rev0.7z" | |
| $mingwArchive = Join-Path $env:RUNNER_TEMP "mingw.7z" | |
| $mingwBase = Join-Path $env:RUNNER_TEMP "mingw64" | |
| try { | |
| Invoke-WebRequest -Uri $mingwUrl -OutFile $mingwArchive -UseBasicParsing -ErrorAction Stop | |
| Write-Output "Download completed: $mingwArchive" | |
| } catch { | |
| Write-Error "Failed to download MinGW: $($_.Exception.Message)" | |
| exit 1 | |
| } | |
| # Extract 7z archive | |
| Write-Output "Extracting MinGW archive..." | |
| if (Test-Path $mingwBase) { | |
| Remove-Item -Recurse -Force $mingwBase | |
| } | |
| New-Item -ItemType Directory -Force -Path $mingwBase | Out-Null | |
| # Use 7z to extract (7-Zip is expected on Windows runners; install via choco if missing) | |
| $7zPath = "C:\Program Files\7-Zip\7z.exe" | |
| if (-not (Test-Path $7zPath)) { | |
| Write-Output "7-Zip not found at $7zPath, installing via Chocolatey..." | |
| choco install 7zip -y --no-progress | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "Failed to install 7-Zip via Chocolatey" | |
| exit 1 | |
| } | |
| if (-not (Test-Path $7zPath)) { | |
| Write-Error "7-Zip still not found at $7zPath after installation" | |
| exit 1 | |
| } | |
| } | |
| & $7zPath x $mingwArchive -o"$mingwBase" -y | Out-Null | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "Failed to extract MinGW archive" | |
| exit 1 | |
| } | |
| # Find the mingw64 directory (it might be nested) | |
| $mingw64Path = Get-ChildItem -Path $mingwBase -Recurse -Directory -Filter "mingw64" | Select-Object -First 1 | |
| if ($null -eq $mingw64Path) { | |
| Write-Error "mingw64 directory not found after extraction" | |
| exit 1 | |
| } | |
| $mingwBinPath = Join-Path $mingw64Path.FullName "bin" | |
| if (-not (Test-Path $mingwBinPath)) { | |
| Write-Error "mingw64/bin directory not found" | |
| exit 1 | |
| } | |
| Write-Output "MinGW installed at: $mingwBinPath" | |
| # Add to PATH | |
| echo "$mingwBinPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| # Verify gcc | |
| $env:PATH = "$mingwBinPath;$env:PATH" | |
| & gcc --version | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "gcc not working!" | |
| exit 1 | |
| } | |
| Write-Output "MinGW installation successful" | |
| - name: Install tools and dependencies | |
| run: | | |
| pip3 install --use-pep517 python-dotenv jinja2 | |
| go install golang.org/dl/go1.24.3@latest | |
| go1.24.3 download | |
| go1.24.3 version | |
| go env -w GOFLAGS="-buildvcs=false" | |
| - name: Get Python executable path | |
| run: | | |
| $pythonPath = python -c "import sys; print(sys.executable)" | |
| Write-Output "Python executable path: $pythonPath" | |
| $pythonDir = Split-Path $pythonPath | |
| Write-Output "Python directory path: $pythonDir" | |
| echo "PYTHON3_PATH=$pythonDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| shell: pwsh | |
| - name: Use Python path | |
| run: | | |
| Write-Output "The Python directory is located at: $env:PYTHON3_PATH" | |
| shell: pwsh | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: tests-artifacts-win-${{ matrix.build_type }}-${{ matrix.compiler }} | |
| path: out/win/x64 | |
| - name: Extract tests artifacts preserving permissions | |
| shell: pwsh | |
| run: | | |
| Expand-Archive -Path "out/win/x64/tests-artifacts.zip" -DestinationPath "out/win/x64" -Force | |
| - name: Install Python dependencies via script | |
| shell: pwsh | |
| run: | | |
| python .github/tools/setup_pytest_dependencies.py | |
| - name: Install and setup Ollama | |
| shell: pwsh | |
| run: | | |
| Write-Output "[Ollama] Starting setup via ZIP (Windows)" | |
| Write-Output "[Ollama] PowerShell: $($PSVersionTable.PSVersion)" | |
| Write-Output "[Ollama] Runner Temp: $env:RUNNER_TEMP" | |
| # Download Ollama CLI zip | |
| $zipUrl = "https://ollama.com/download/ollama-windows-amd64.zip" | |
| $zipPath = Join-Path $env:RUNNER_TEMP "ollama-windows-amd64.zip" | |
| Write-Output "[Ollama] Downloading: $zipUrl" | |
| Write-Output "[Ollama] To: $zipPath" | |
| try { | |
| Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath -UseBasicParsing -ErrorAction Stop | |
| } catch { | |
| Write-Error "[Ollama] Download failed: $($_.Exception.Message)" | |
| exit 1 | |
| } | |
| if (-not (Test-Path $zipPath)) { | |
| Write-Error "[Ollama] Zip file not found after download: $zipPath" | |
| exit 1 | |
| } | |
| $zipSize = (Get-Item $zipPath).Length | |
| Write-Output "[Ollama] Zip size (bytes): $zipSize" | |
| if ($zipSize -lt 1000000000) { | |
| Write-Error "[Ollama] Zip file seems too small (<1GB), aborting." | |
| exit 1 | |
| } | |
| # Extract | |
| $extractDir = Join-Path $env:RUNNER_TEMP "ollama" | |
| if (Test-Path $extractDir) { Remove-Item -Recurse -Force $extractDir } | |
| Write-Output "[Ollama] Extracting to: $extractDir" | |
| Expand-Archive -Path $zipPath -DestinationPath $extractDir -Force | |
| # Locate ollama.exe | |
| $ollamaExeItem = Get-ChildItem -Path $extractDir -Recurse -Filter "ollama.exe" | Select-Object -First 1 | |
| if (-not $ollamaExeItem) { | |
| Write-Error "[Ollama] ollama.exe not found after extraction" | |
| Get-ChildItem -Path $extractDir -Recurse | Select-Object FullName | |
| exit 1 | |
| } | |
| $ollamaExe = $ollamaExeItem.FullName | |
| $ollamaDir = Split-Path $ollamaExe | |
| Write-Output "[Ollama] Executable: $ollamaExe" | |
| Write-Output "[Ollama] Directory: $ollamaDir" | |
| # Make available to subsequent steps | |
| $ollamaDir | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| # Force CPU mode and set models directory | |
| $env:OLLAMA_CPU_ONLY = "1" | |
| "OLLAMA_CPU_ONLY=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| $modelsDir = Join-Path $env:RUNNER_TEMP "ollama-models" | |
| New-Item -ItemType Directory -Force -Path $modelsDir | Out-Null | |
| $env:OLLAMA_MODELS = $modelsDir | |
| "OLLAMA_MODELS=$modelsDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| Write-Output "[Ollama] Env OLLAMA_CPU_ONLY=$env:OLLAMA_CPU_ONLY" | |
| Write-Output "[Ollama] Env OLLAMA_MODELS=$env:OLLAMA_MODELS" | |
| # Print version | |
| & $ollamaExe --version 2>$null | ForEach-Object { Write-Output "[Ollama] Version: $_" } | |
| # Start service | |
| Write-Output "[Ollama] Starting service..." | |
| $proc = Start-Process -FilePath $ollamaExe -ArgumentList "serve" -WindowStyle Hidden -PassThru | |
| if ($null -eq $proc) { | |
| Write-Error "[Ollama] Failed to start service process" | |
| exit 1 | |
| } | |
| Write-Output "[Ollama] Service PID: $($proc.Id)" | |
| # Wait for readiness | |
| $ready = $false | |
| for ($i = 1; $i -le 60; $i++) { | |
| try { | |
| $response = Invoke-WebRequest -Uri "http://127.0.0.1:11434" -UseBasicParsing -TimeoutSec 2 -ErrorAction Stop | |
| if ($response.StatusCode -eq 200) { | |
| Write-Output "[Ollama] Ready (HTTP 200)" | |
| $ready = $true | |
| break | |
| } | |
| } catch { | |
| # ignore | |
| } | |
| Write-Output "[Ollama] Waiting for service... ($i/60)" | |
| Start-Sleep -Seconds 2 | |
| } | |
| if (-not $ready) { | |
| Write-Error "[Ollama] Service failed to become ready in time" | |
| Get-Process | Where-Object { $_.ProcessName -like "ollama*" } | Select-Object Id, ProcessName, StartTime | Format-Table | Out-String | Write-Output | |
| exit 1 | |
| } | |
| # Pull required model | |
| Write-Output "[Ollama] Pulling model smollm:135m ..." | |
| & $ollamaExe pull smollm:135m | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "[Ollama] Model pull failed" | |
| exit 1 | |
| } | |
| Write-Output "[Ollama] Installed models:" | |
| & $ollamaExe list | |
| - name: Run Tests (ten_runtime Python integration tests) | |
| env: | |
| TEN_ENABLE_BACKTRACE_DUMP: "true" | |
| shell: pwsh | |
| run: | | |
| $ENV:PATH += ";$PWD/core/ten_gn" | |
| if ("${{ matrix.compiler }}" -eq "mingw") { | |
| # Set toolchain to force use of the nightly-x86_64-pc-windows-gnu | |
| # Or else toolchain may be switched to msvc during build | |
| $env:RUSTUP_TOOLCHAIN = "nightly-x86_64-pc-windows-gnu" | |
| echo $env:RUSTUP_TOOLCHAIN | |
| } | |
| cd out/win/x64/ | |
| pytest -s tests/ten_runtime/integration/python/ | |
| test-integration-cpp: | |
| needs: build | |
| runs-on: windows-latest | |
| env: | |
| PYTHONIOENCODING: utf-8 | |
| strategy: | |
| matrix: | |
| build_type: [debug, release] | |
| compiler: [msvc, mingw] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: false | |
| - name: Enable Windows long path support | |
| shell: pwsh | |
| run: | | |
| Write-Output "Enabling Windows long path support..." | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force | |
| Write-Output "Long path support enabled" | |
| - name: Trust working directory | |
| run: git config --global --add safe.directory "${GITHUB_WORKSPACE}" | |
| - name: Initialize and update submodules except portal/ | |
| shell: bash | |
| run: | | |
| # Retrieve all submodule paths, excluding `portal/`. | |
| submodules=$(git config --file .gitmodules --get-regexp path | awk '$2 != "portal" { print $2 }') | |
| git submodule init | |
| for submodule in $submodules; do | |
| echo "Initializing submodule: $submodule" | |
| git submodule update --init --recursive --depth 1 "$submodule" | |
| done | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Setup MSVC | |
| if: matrix.compiler == 'msvc' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "stable" | |
| cache: false | |
| - name: Install MinGW and setup toolchain | |
| if: matrix.compiler == 'mingw' | |
| shell: pwsh | |
| run: | | |
| Write-Output "Downloading MinGW from GitHub releases..." | |
| $mingwUrl = "https://github.com/niXman/mingw-builds-binaries/releases/download/15.2.0-rt_v13-rev0/x86_64-15.2.0-release-posix-seh-ucrt-rt_v13-rev0.7z" | |
| $mingwArchive = Join-Path $env:RUNNER_TEMP "mingw.7z" | |
| $mingwBase = Join-Path $env:RUNNER_TEMP "mingw64" | |
| try { | |
| Invoke-WebRequest -Uri $mingwUrl -OutFile $mingwArchive -UseBasicParsing -ErrorAction Stop | |
| Write-Output "Download completed: $mingwArchive" | |
| } catch { | |
| Write-Error "Failed to download MinGW: $($_.Exception.Message)" | |
| exit 1 | |
| } | |
| # Extract 7z archive | |
| Write-Output "Extracting MinGW archive..." | |
| if (Test-Path $mingwBase) { | |
| Remove-Item -Recurse -Force $mingwBase | |
| } | |
| New-Item -ItemType Directory -Force -Path $mingwBase | Out-Null | |
| # Use 7z to extract (7-Zip is expected on Windows runners; install via choco if missing) | |
| $7zPath = "C:\Program Files\7-Zip\7z.exe" | |
| if (-not (Test-Path $7zPath)) { | |
| Write-Output "7-Zip not found at $7zPath, installing via Chocolatey..." | |
| choco install 7zip -y --no-progress | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "Failed to install 7-Zip via Chocolatey" | |
| exit 1 | |
| } | |
| if (-not (Test-Path $7zPath)) { | |
| Write-Error "7-Zip still not found at $7zPath after installation" | |
| exit 1 | |
| } | |
| } | |
| & $7zPath x $mingwArchive -o"$mingwBase" -y | Out-Null | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "Failed to extract MinGW archive" | |
| exit 1 | |
| } | |
| # Find the mingw64 directory (it might be nested) | |
| $mingw64Path = Get-ChildItem -Path $mingwBase -Recurse -Directory -Filter "mingw64" | Select-Object -First 1 | |
| if ($null -eq $mingw64Path) { | |
| Write-Error "mingw64 directory not found after extraction" | |
| exit 1 | |
| } | |
| $mingwBinPath = Join-Path $mingw64Path.FullName "bin" | |
| if (-not (Test-Path $mingwBinPath)) { | |
| Write-Error "mingw64/bin directory not found" | |
| exit 1 | |
| } | |
| Write-Output "MinGW installed at: $mingwBinPath" | |
| # Add to PATH | |
| echo "$mingwBinPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| # Verify gcc | |
| $env:PATH = "$mingwBinPath;$env:PATH" | |
| & gcc --version | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "gcc not working!" | |
| exit 1 | |
| } | |
| Write-Output "MinGW installation successful" | |
| - name: Install tools and dependencies | |
| run: | | |
| pip3 install --use-pep517 python-dotenv jinja2 | |
| go install golang.org/dl/go1.24.3@latest | |
| go1.24.3 download | |
| go1.24.3 version | |
| go env -w GOFLAGS="-buildvcs=false" | |
| - name: Get Python executable path | |
| run: | | |
| $pythonPath = python -c "import sys; print(sys.executable)" | |
| Write-Output "Python executable path: $pythonPath" | |
| $pythonDir = Split-Path $pythonPath | |
| Write-Output "Python directory path: $pythonDir" | |
| echo "PYTHON3_PATH=$pythonDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| shell: pwsh | |
| - name: Use Python path | |
| run: | | |
| Write-Output "The Python directory is located at: $env:PYTHON3_PATH" | |
| shell: pwsh | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: tests-artifacts-win-${{ matrix.build_type }}-${{ matrix.compiler }} | |
| path: out/win/x64 | |
| - name: Extract tests artifacts preserving permissions | |
| shell: pwsh | |
| run: | | |
| Expand-Archive -Path "out/win/x64/tests-artifacts.zip" -DestinationPath "out/win/x64" -Force | |
| - name: Install Python dependencies via script | |
| run: | | |
| python .github/tools/setup_pytest_dependencies.py | |
| - name: Run Tests (ten_runtime C++ integration tests) | |
| env: | |
| TEN_ENABLE_BACKTRACE_DUMP: "true" | |
| run: | | |
| $ENV:PATH += ";$PWD/core/ten_gn" | |
| if ("${{ matrix.compiler }}" -eq "mingw") { | |
| # Set toolchain to force use of the nightly-x86_64-pc-windows-gnu | |
| # Or else toolchain may be switched to msvc during build | |
| $env:RUSTUP_TOOLCHAIN = "nightly-x86_64-pc-windows-gnu" | |
| echo $env:RUSTUP_TOOLCHAIN | |
| } | |
| cd out/win/x64/ | |
| pytest -s tests/ten_runtime/integration/cpp/ | |
| # continue-on-error: true | |
| # - name: Setup tmate session | |
| # uses: mxschmitt/action-tmate@v3 | |
| test-integration-nodejs: | |
| needs: build | |
| runs-on: windows-latest | |
| env: | |
| PYTHONIOENCODING: utf-8 | |
| strategy: | |
| matrix: | |
| build_type: [debug, release] | |
| compiler: [msvc] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: false | |
| - name: Enable Windows long path support | |
| shell: pwsh | |
| run: | | |
| Write-Output "Enabling Windows long path support..." | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force | |
| Write-Output "Long path support enabled" | |
| - name: Trust working directory | |
| run: git config --global --add safe.directory "${GITHUB_WORKSPACE}" | |
| - name: Initialize and update submodules except portal/ | |
| shell: bash | |
| run: | | |
| # Retrieve all submodule paths, excluding `portal/`. | |
| submodules=$(git config --file .gitmodules --get-regexp path | awk '$2 != "portal" { print $2 }') | |
| git submodule init | |
| for submodule in $submodules; do | |
| echo "Initializing submodule: $submodule" | |
| git submodule update --init --recursive --depth 1 "$submodule" | |
| done | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Setup MSVC | |
| if: matrix.compiler == 'msvc' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "stable" | |
| cache: false | |
| - name: Install tools and dependencies | |
| run: | | |
| pip3 install --use-pep517 python-dotenv jinja2 | |
| go install golang.org/dl/go1.24.3@latest | |
| go1.24.3 download | |
| go1.24.3 version | |
| go env -w GOFLAGS="-buildvcs=false" | |
| - name: Get Python executable path | |
| run: | | |
| $pythonPath = python -c "import sys; print(sys.executable)" | |
| Write-Output "Python executable path: $pythonPath" | |
| $pythonDir = Split-Path $pythonPath | |
| Write-Output "Python directory path: $pythonDir" | |
| echo "PYTHON3_PATH=$pythonDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| shell: pwsh | |
| - name: Use Python path | |
| run: | | |
| Write-Output "The Python directory is located at: $env:PYTHON3_PATH" | |
| shell: pwsh | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: tests-artifacts-win-${{ matrix.build_type }}-${{ matrix.compiler }} | |
| path: out/win/x64 | |
| - name: Extract tests artifacts preserving permissions | |
| shell: pwsh | |
| run: | | |
| Expand-Archive -Path "out/win/x64/tests-artifacts.zip" -DestinationPath "out/win/x64" -Force | |
| - name: Install Python dependencies via script | |
| run: | | |
| python .github/tools/setup_pytest_dependencies.py | |
| - name: Run Tests (ten_runtime Nodejs integration tests) | |
| env: | |
| TEN_ENABLE_BACKTRACE_DUMP: "true" | |
| run: | | |
| $ENV:PATH += ";$PWD/core/ten_gn" | |
| cd out/win/x64/ | |
| pytest -s tests/ten_runtime/integration/nodejs/ | |
| test-integration-go: | |
| needs: build | |
| runs-on: windows-latest | |
| env: | |
| PYTHONIOENCODING: utf-8 | |
| strategy: | |
| matrix: | |
| build_type: [debug, release] | |
| compiler: [msvc, mingw] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: false | |
| - name: Enable Windows long path support | |
| shell: pwsh | |
| run: | | |
| Write-Output "Enabling Windows long path support..." | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force | |
| Write-Output "Long path support enabled" | |
| - name: Trust working directory | |
| run: git config --global --add safe.directory "${GITHUB_WORKSPACE}" | |
| - name: Initialize and update submodules except portal/ | |
| shell: bash | |
| run: | | |
| # Retrieve all submodule paths, excluding `portal/`. | |
| submodules=$(git config --file .gitmodules --get-regexp path | awk '$2 != "portal" { print $2 }') | |
| git submodule init | |
| for submodule in $submodules; do | |
| echo "Initializing submodule: $submodule" | |
| git submodule update --init --recursive --depth 1 "$submodule" | |
| done | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Setup MSVC | |
| if: matrix.compiler == 'msvc' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "stable" | |
| cache: false | |
| - name: Install MinGW and setup toolchain | |
| if: matrix.compiler == 'mingw' | |
| shell: pwsh | |
| run: | | |
| Write-Output "Downloading MinGW from GitHub releases..." | |
| $mingwUrl = "https://github.com/niXman/mingw-builds-binaries/releases/download/15.2.0-rt_v13-rev0/x86_64-15.2.0-release-posix-seh-ucrt-rt_v13-rev0.7z" | |
| $mingwArchive = Join-Path $env:RUNNER_TEMP "mingw.7z" | |
| $mingwBase = Join-Path $env:RUNNER_TEMP "mingw64" | |
| try { | |
| Invoke-WebRequest -Uri $mingwUrl -OutFile $mingwArchive -UseBasicParsing -ErrorAction Stop | |
| Write-Output "Download completed: $mingwArchive" | |
| } catch { | |
| Write-Error "Failed to download MinGW: $($_.Exception.Message)" | |
| exit 1 | |
| } | |
| # Extract 7z archive | |
| Write-Output "Extracting MinGW archive..." | |
| if (Test-Path $mingwBase) { | |
| Remove-Item -Recurse -Force $mingwBase | |
| } | |
| New-Item -ItemType Directory -Force -Path $mingwBase | Out-Null | |
| # Use 7z to extract (7-Zip is expected on Windows runners; install via choco if missing) | |
| $7zPath = "C:\Program Files\7-Zip\7z.exe" | |
| if (-not (Test-Path $7zPath)) { | |
| Write-Output "7-Zip not found at $7zPath, installing via Chocolatey..." | |
| choco install 7zip -y --no-progress | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "Failed to install 7-Zip via Chocolatey" | |
| exit 1 | |
| } | |
| if (-not (Test-Path $7zPath)) { | |
| Write-Error "7-Zip still not found at $7zPath after installation" | |
| exit 1 | |
| } | |
| } | |
| & $7zPath x $mingwArchive -o"$mingwBase" -y | Out-Null | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "Failed to extract MinGW archive" | |
| exit 1 | |
| } | |
| # Find the mingw64 directory (it might be nested) | |
| $mingw64Path = Get-ChildItem -Path $mingwBase -Recurse -Directory -Filter "mingw64" | Select-Object -First 1 | |
| if ($null -eq $mingw64Path) { | |
| Write-Error "mingw64 directory not found after extraction" | |
| exit 1 | |
| } | |
| $mingwBinPath = Join-Path $mingw64Path.FullName "bin" | |
| if (-not (Test-Path $mingwBinPath)) { | |
| Write-Error "mingw64/bin directory not found" | |
| exit 1 | |
| } | |
| Write-Output "MinGW installed at: $mingwBinPath" | |
| # Add to PATH | |
| echo "$mingwBinPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| # Verify gcc | |
| $env:PATH = "$mingwBinPath;$env:PATH" | |
| & gcc --version | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "gcc not working!" | |
| exit 1 | |
| } | |
| Write-Output "MinGW installation successful" | |
| - name: Install tools and dependencies | |
| run: | | |
| pip3 install --use-pep517 python-dotenv jinja2 | |
| go install golang.org/dl/go1.24.3@latest | |
| go1.24.3 download | |
| go1.24.3 version | |
| go env -w GOFLAGS="-buildvcs=false" | |
| - name: Get Python executable path | |
| run: | | |
| $pythonPath = python -c "import sys; print(sys.executable)" | |
| Write-Output "Python executable path: $pythonPath" | |
| $pythonDir = Split-Path $pythonPath | |
| Write-Output "Python directory path: $pythonDir" | |
| echo "PYTHON3_PATH=$pythonDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| shell: pwsh | |
| - name: Use Python path | |
| run: | | |
| Write-Output "The Python directory is located at: $env:PYTHON3_PATH" | |
| shell: pwsh | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: tests-artifacts-win-${{ matrix.build_type }}-${{ matrix.compiler }} | |
| path: out/win/x64 | |
| - name: Extract tests artifacts preserving permissions | |
| shell: pwsh | |
| run: | | |
| Expand-Archive -Path "out/win/x64/tests-artifacts.zip" -DestinationPath "out/win/x64" -Force | |
| - name: Install Python dependencies via script | |
| run: | | |
| python .github/tools/setup_pytest_dependencies.py | |
| - name: Run Tests (ten_runtime Go integration tests) | |
| env: | |
| TEN_ENABLE_BACKTRACE_DUMP: "true" | |
| run: | | |
| $ENV:PATH += ";$PWD/core/ten_gn" | |
| cd out/win/x64/ | |
| pytest -s tests/ten_runtime/integration/go/ |