fix(lint): change Python job runner from Windows to Linux and update shell to Bash
fix(script): add CmdletBinding attribute to Set-GuestInfoIP function for better process support
This commit is contained in:
+14
-51
@@ -64,17 +64,12 @@ jobs:
|
||||
}
|
||||
|
||||
python:
|
||||
runs-on: windows-build
|
||||
runs-on: linux-build
|
||||
timeout-minutes: 20
|
||||
|
||||
env:
|
||||
PYTHONIOENCODING: utf-8
|
||||
# Job-local, ephemeral venv. MUST NOT be the production venv
|
||||
# (F:\CI\python\venv): an editable install here would repoint the
|
||||
# shared orchestrator package at this run's transient checkout and
|
||||
# break every later smoke/build job with "No module named
|
||||
# ci_orchestrator". github.workspace is discarded after the job.
|
||||
VENV_DIR: ${{ github.workspace }}\.venv-lint
|
||||
VENV_DIR: ${{ github.workspace }}/.venv-lint
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -83,57 +78,25 @@ jobs:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Setup venv + install package
|
||||
shell: powershell
|
||||
shell: bash
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Production venv lives at $env:VENV_DIR (F:\CI\python\venv per AGENTS.md).
|
||||
# The system Python used to bootstrap it is configured once in
|
||||
# runner/config.yaml as CI_PYTHON_LAUNCHER (single source of truth).
|
||||
if (-not $env:CI_PYTHON_LAUNCHER) {
|
||||
throw "CI_PYTHON_LAUNCHER not set. Configure it in runner/config.yaml (runner.envs) and restart act_runner."
|
||||
}
|
||||
if (-not (Test-Path $env:CI_PYTHON_LAUNCHER)) {
|
||||
throw "CI_PYTHON_LAUNCHER points to '$env:CI_PYTHON_LAUNCHER' which does not exist."
|
||||
}
|
||||
|
||||
$venvPy = Join-Path $env:VENV_DIR 'Scripts\python.exe'
|
||||
|
||||
# Always build a fresh, job-local venv. Never reuse or repair a
|
||||
# shared one — lint must be fully isolated from the production
|
||||
# orchestrator venv.
|
||||
if (Test-Path $env:VENV_DIR) {
|
||||
Remove-Item $env:VENV_DIR -Recurse -Force
|
||||
}
|
||||
& $env:CI_PYTHON_LAUNCHER -m venv $env:VENV_DIR
|
||||
if ($LASTEXITCODE -ne 0) { throw "venv creation failed" }
|
||||
|
||||
Write-Host "Using venv python: $venvPy"
|
||||
& $venvPy --version
|
||||
if ($LASTEXITCODE -ne 0) { throw "python --version failed" }
|
||||
|
||||
& $venvPy -m pip install --upgrade pip
|
||||
if ($LASTEXITCODE -ne 0) { throw "pip upgrade failed" }
|
||||
& $venvPy -m pip install -e ".[dev]"
|
||||
if ($LASTEXITCODE -ne 0) { throw "pip install failed" }
|
||||
set -euo pipefail
|
||||
rm -rf "$VENV_DIR"
|
||||
python3 -m venv "$VENV_DIR"
|
||||
"$VENV_DIR/bin/python" -m pip install --upgrade pip
|
||||
"$VENV_DIR/bin/python" -m pip install -e ".[dev]"
|
||||
|
||||
- name: ruff
|
||||
shell: powershell
|
||||
shell: bash
|
||||
run: |
|
||||
$venvPy = Join-Path $env:VENV_DIR 'Scripts\python.exe'
|
||||
& $venvPy -m ruff check src tests/python
|
||||
if ($LASTEXITCODE -ne 0) { throw "ruff failed" }
|
||||
"$VENV_DIR/bin/python" -m ruff check src tests/python
|
||||
|
||||
- name: mypy --strict
|
||||
shell: powershell
|
||||
shell: bash
|
||||
run: |
|
||||
$venvPy = Join-Path $env:VENV_DIR 'Scripts\python.exe'
|
||||
& $venvPy -m mypy --strict src
|
||||
if ($LASTEXITCODE -ne 0) { throw "mypy failed" }
|
||||
"$VENV_DIR/bin/python" -m mypy --strict src
|
||||
|
||||
- name: pytest (coverage >= 90%)
|
||||
shell: powershell
|
||||
shell: bash
|
||||
run: |
|
||||
$venvPy = Join-Path $env:VENV_DIR 'Scripts\python.exe'
|
||||
& $venvPy -m pytest tests/python --cov=ci_orchestrator --cov-fail-under=90
|
||||
if ($LASTEXITCODE -ne 0) { throw "pytest failed" }
|
||||
"$VENV_DIR/bin/python" -m pytest tests/python --cov=ci_orchestrator --cov-fail-under=90
|
||||
|
||||
@@ -146,6 +146,7 @@ if (-not (Test-Path $OutputDir)) {
|
||||
}
|
||||
|
||||
function Set-GuestInfoIP {
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
param([string]$VmxPath, [string]$IP, [string]$Mask, [string]$Gw)
|
||||
$keys = @('guestinfo.ip-assignment', 'guestinfo.netmask', 'guestinfo.gateway')
|
||||
$lines = (Get-Content -LiteralPath $VmxPath -Encoding UTF8) |
|
||||
|
||||
Reference in New Issue
Block a user