docs: update README with RTD badge, function reference link, and v2.0… #20
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: CI | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Fast test (lite install) | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| python-version: ['3.10', '3.11'] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-${{ matrix.python-version }}- | |
| - name: Upgrade pip and build tools | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| - name: Install (lite) dependencies (editable) | |
| run: | | |
| python -m pip install -U pip | |
| python -m pip install -e '.[lite]' | |
| - name: Import smoke test | |
| run: | | |
| python - <<'PY' | |
| import sys | |
| sys.path.insert(0, '${{ github.workspace }}') | |
| import easyQuake | |
| print('easyQuake imported, version=', getattr(easyQuake, '__version__', 'unknown')) | |
| PY | |
| - name: Run pytest | |
| run: | | |
| python -m pip install pytest | |
| pytest -q | |
| ml-check: | |
| name: ML smoke-check (manual) | |
| runs-on: ${{ matrix.os }} | |
| if: github.event_name == 'workflow_dispatch' | |
| timeout-minutes: 120 | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| python-version: ['3.10', '3.11'] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-${{ matrix.python-version }}- | |
| - name: Upgrade pip and install ML extras + cpu wheels (editable) | |
| run: | | |
| python -m pip install -U pip setuptools wheel | |
| python -m pip install -e '.[ml]' | |
| # Install CPU-only PyTorch wheels (official cpu index). This avoids GPU/CUDA issues on runners. | |
| python -m pip install --index-url https://download.pytorch.org/whl/cpu torch==2.1.0+cpu torchvision torchaudio || true | |
| # Install TensorFlow (CPU wheel). If wheel is unavailable for the exact Python minor, step may fail. | |
| python -m pip install tensorflow==2.12.0 || true | |
| - name: ML import smoke test (CPU-only) | |
| env: | |
| # Force CPU usage to avoid CUDA driver/kernel incompatibilities on hosted runners | |
| CUDA_VISIBLE_DEVICES: '' | |
| TF_CPP_MIN_LOG_LEVEL: '2' | |
| run: | | |
| python - <<'PY' | |
| import sys, traceback | |
| sys.path.insert(0, '${{ github.workspace }}') | |
| ok = True | |
| try: | |
| import easyQuake | |
| print('easyQuake', getattr(easyQuake, '__version__', 'unknown')) | |
| except Exception: | |
| traceback.print_exc() | |
| ok = False | |
| try: | |
| import tensorflow as tf | |
| print('tensorflow', tf.__version__) | |
| # small TF smoke op | |
| a = tf.constant([1.0, 2.0]) | |
| s = tf.reduce_sum(a).numpy() | |
| print('tf sum:', s) | |
| except Exception as e: | |
| print('WARNING: TensorFlow import or smoke test failed:', str(e)) | |
| print('This is expected in CPU-only environments; package supports GPU fallback.') | |
| try: | |
| import torch | |
| print('torch', getattr(torch, '__version__', 'unknown')) | |
| t = torch.tensor([1.0,2.0]) | |
| s = t.sum().item() | |
| print('torch sum:', s) | |
| except Exception as e: | |
| print('WARNING: PyTorch import or smoke test failed:', str(e)) | |
| print('This is expected in CPU-only environments; package supports GPU fallback.') | |
| if not ok: | |
| raise SystemExit('easyQuake import failed') | |
| PY |