perf/pipeline-improvements #2
@@ -32,13 +32,17 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Create Python toolcache directory (macOS)
|
||||
if: matrix.platform == 'macos'
|
||||
run: sudo mkdir -p /Users/runner && sudo chown $USER /Users/runner
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Install Python build tools
|
||||
run: pip install --upgrade pip setuptools wheel
|
||||
run: python -m pip install --upgrade pip setuptools wheel
|
||||
|
||||
- name: Build sidecar
|
||||
working-directory: python
|
||||
|
||||
@@ -68,32 +68,33 @@ def create_venv_and_install(cpu_only: bool) -> Path:
|
||||
print(f"[build] Creating venv at {venv_dir}")
|
||||
subprocess.run([sys.executable, "-m", "venv", str(venv_dir)], check=True)
|
||||
|
||||
# Determine pip and python paths inside venv
|
||||
# Determine python path inside venv — use `python -m pip` instead of
|
||||
# calling pip directly to avoid permission errors on Windows
|
||||
if sys.platform == "win32":
|
||||
pip = str(venv_dir / "Scripts" / "pip")
|
||||
python = str(venv_dir / "Scripts" / "python")
|
||||
else:
|
||||
pip = str(venv_dir / "bin" / "pip")
|
||||
python = str(venv_dir / "bin" / "python")
|
||||
|
||||
def pip_install(*args: str) -> None:
|
||||
subprocess.run([python, "-m", "pip", *args], check=True)
|
||||
|
||||
# Upgrade pip
|
||||
subprocess.run([pip, "install", "--upgrade", "pip"], check=True)
|
||||
pip_install("install", "--upgrade", "pip", "setuptools", "wheel")
|
||||
|
||||
# Install torch (CPU-only to avoid bundling ~2GB of CUDA libs)
|
||||
if cpu_only:
|
||||
print("[build] Installing PyTorch (CPU-only)")
|
||||
subprocess.run(
|
||||
[pip, "install", "torch", "torchaudio",
|
||||
"--index-url", "https://download.pytorch.org/whl/cpu"],
|
||||
check=True,
|
||||
pip_install(
|
||||
"install", "torch", "torchaudio",
|
||||
"--index-url", "https://download.pytorch.org/whl/cpu",
|
||||
)
|
||||
else:
|
||||
print("[build] Installing PyTorch (default, may include CUDA)")
|
||||
subprocess.run([pip, "install", "torch", "torchaudio"], check=True)
|
||||
pip_install("install", "torch", "torchaudio")
|
||||
|
||||
# Install project and dev deps (includes pyinstaller)
|
||||
print("[build] Installing project dependencies")
|
||||
subprocess.run([pip, "install", "-e", f"{SCRIPT_DIR}[dev]"], check=True)
|
||||
pip_install("install", "-e", f"{SCRIPT_DIR}[dev]")
|
||||
|
||||
return Path(python)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user