Files
PozzettiAndrea-ComfyUI-SAM3/.github/workflows/test-install.yml
T

145 lines
4.7 KiB
YAML

name: Test Installation
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test-install:
name: Test on ${{ matrix.os }} - Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.10']
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y build-essential
- name: Install PyTorch (CPU version for testing)
run: |
python -m pip install --upgrade pip
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
- name: Install package dependencies
run: |
# Install core dependencies first
pip install timm ftfy regex iopath huggingface_hub einops opencv-python psutil scikit-image numpy Pillow tqdm typing_extensions
# Install platform-specific dependencies
if [ "${{ matrix.os }}" != "macos-latest" ]; then
# decord doesn't have pre-built wheels for macOS ARM
pip install decord || echo "Warning: decord installation failed (not critical for testing)"
fi
# pycocotools may need compilation on some platforms
pip install pycocotools || echo "Warning: pycocotools installation failed (not critical for testing)"
shell: bash
- name: Install test dependencies
run: |
pip install pytest pytest-cov
- name: Run tests
run: |
pytest tests/ -v --tb=short -m unit
- name: Test install script (skip CUDA compilation)
if: matrix.os != 'windows-latest' # Skip on Windows due to compiler requirements
run: |
python install.py || echo "Install script completed with warnings (expected for CPU-only environment)"
test-cuda-compilation:
name: Test CUDA Extension Compilation (Ubuntu)
runs-on: ubuntu-latest
steps:
- name: Free up disk space
run: |
# Remove unnecessary software to free up ~10GB of disk space
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential nvidia-cuda-toolkit
- name: Check CUDA installation
run: |
nvcc --version || echo "nvcc not found"
which nvcc || echo "nvcc not in PATH"
- name: Install PyTorch with CUDA support
run: |
python -m pip install --upgrade pip
# Install PyTorch with CUDA 12.1 support (no GPU needed for compilation)
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
- name: Verify PyTorch CUDA support
run: |
python -c "import torch; print(f'PyTorch version: {torch.__version__}'); print(f'CUDA available in PyTorch: {torch.version.cuda}')"
- name: Install core dependencies
run: |
pip install timm ftfy regex iopath huggingface_hub einops opencv-python psutil scikit-image numpy Pillow tqdm typing_extensions
pip install decord || echo "Warning: decord failed"
pip install pycocotools || echo "Warning: pycocotools failed"
- name: Compile CUDA extensions
run: |
python install.py --compile-only
- name: Verify compiled extensions exist
run: |
python -c "
try:
import torch_generic_nms
print('✓ torch_generic_nms compiled successfully')
except ImportError as e:
print(f'✗ torch_generic_nms import failed: {e}')
exit(1)
" || echo "torch_generic_nms compilation verification failed (non-critical)"
python -c "
try:
import cc_torch
print('✓ cc_torch compiled successfully')
except ImportError as e:
print(f'✗ cc_torch import failed: {e}')
exit(1)
" || echo "cc_torch compilation verification failed (non-critical)"