@@ -418,6 +418,13 @@ jobs:
418418 windows :
419419 name : ${{ matrix.coin }} package (Windows x86_64)
420420 runs-on : ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted","Windows","X64","c2pool-build"]') || 'windows-2022' }}
421+ defaults :
422+ run :
423+ # VM217 Windows PowerShell runs at ExecutionPolicy=Restricted and has no
424+ # Git-bash on the runner-service PATH (shell:bash -> "bash: command not
425+ # found"). Use the ExecutionPolicy-Bypass PowerShell shell proven green
426+ # by build.yml's Windows lane (probe 28679257030). cmd steps override.
427+ shell : powershell -ExecutionPolicy Bypass -Command ". '{0}'"
421428 strategy :
422429 fail-fast : false
423430 matrix :
@@ -427,40 +434,55 @@ jobs:
427434
428435 - name : Resolve version
429436 id : ver
430- shell : bash
431437 run : |
432- if [ -n "${{ github.event.inputs.version }}" ]; then
433- echo "version=${{ github.event.inputs.version }}" >> "$ GITHUB_OUTPUT"
434- elif [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
435- echo "version=${ GITHUB_REF_NAME#v}" >> "$ GITHUB_OUTPUT"
436- else
437- echo "version=0.0.0-${GITHUB_SHA:0:8}" >> "$ GITHUB_OUTPUT"
438- fi
438+ if ( "${{ github.event.inputs.version }}") {
439+ "version=${{ github.event.inputs.version }}" | Out-File -FilePath $env: GITHUB_OUTPUT -Append
440+ } elseif ( "${env: GITHUB_REF}" -like " refs/tags/v*") {
441+ "version=$("${env: GITHUB_REF_NAME}".TrimStart('v'))" | Out-File -FilePath $env: GITHUB_OUTPUT -Append
442+ } else {
443+ "version=0.0.0-$("${env:GITHUB_SHA}".Substring(0,8))" | Out-File -FilePath $env: GITHUB_OUTPUT -Append
444+ }
439445
440446 - name : Check source presence
441447 id : presence
442- shell : bash
443448 run : |
444- if [ -f "src/c2pool/main_${{ matrix.coin }}.cpp" ] && [ -d "src/impl/${{ matrix.coin }}" ]; then
445- echo "exists=1" >> "$ GITHUB_OUTPUT"
446- else
447- echo "exists=0" >> "$ GITHUB_OUTPUT"
448- echo "::warning::c2pool-${{ matrix.coin }} source not on this ref — no ${{ matrix.coin }} Windows package will be produced."
449- fi
449+ if ((Test-Path "src/c2pool/main_${{ matrix.coin }}.cpp") -and (Test-Path "src/impl/${{ matrix.coin }}")) {
450+ "exists=1" | Out-File -FilePath $env: GITHUB_OUTPUT -Append
451+ } else {
452+ "exists=0" | Out-File -FilePath $env: GITHUB_OUTPUT -Append
453+ Write-Host "::warning::c2pool-${{ matrix.coin }} source not on this ref — no ${{ matrix.coin }} Windows package will be produced."
454+ }
450455
451456 - uses : actions/setup-python@v6
452- if : steps.presence.outputs.exists == '1'
457+ if : steps.presence.outputs.exists == '1' && runner.environment == 'github-hosted'
453458 with : { python-version: '3.12' }
454459
455460 - name : Install Conan 2
456461 if : steps.presence.outputs.exists == '1'
457- shell : bash
458462 run : |
459- if [ "${{ runner.environment }}" = "github-hosted" ]; then
460- pip install "conan>=2.0,<3.0"
461- else
462- conan --version # pre-provisioned at /usr/local/bin on self-hosted
463- fi
463+ # VM217 exposes neither conan nor a bare python on the runner-service
464+ # PATH (setup-python is gated off self-hosted); resolve an interpreter
465+ # via the Windows py launcher (py -> python3 -> python), pip-install
466+ # conan, and export its Scripts dir(s) through GITHUB_PATH. On the
467+ # github-hosted fork fallback py/python resolve normally.
468+ $py = $null
469+ foreach ($cand in @('py','python3','python')) {
470+ if (Get-Command $cand -ErrorAction SilentlyContinue) { $py = $cand; break }
471+ }
472+ if (-not $py) {
473+ Write-Host "No Python interpreter on PATH. Diagnostics:"
474+ & where.exe python 2>&1; & where.exe py 2>&1; & where.exe python3 2>&1
475+ Write-Host "PATH=$env:PATH"
476+ throw "VM217 has no Python interpreter on the runner-service PATH"
477+ }
478+ Write-Host "Using interpreter: $py"
479+ & $py -m pip install "conan>=2.0,<3.0"
480+ $scripts = & $py -c "import sysconfig; print(sysconfig.get_path('scripts'))"
481+ $userScripts = & $py -c "import sysconfig; print(sysconfig.get_path('scripts','nt_user'))"
482+ $env:PATH = "$scripts;$userScripts;$env:PATH"
483+ Add-Content -Path $env:GITHUB_PATH -Value $scripts
484+ Add-Content -Path $env:GITHUB_PATH -Value $userScripts
485+ conan --version
464486
465487 - name : Detect Conan profile
466488 if : steps.presence.outputs.exists == '1'
0 commit comments