fix(ci): repair python CI and lint for llm-speed #9
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] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint-python: | |
| name: Python Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| - name: Install ruff | |
| run: pip install ruff | |
| - name: Ruff check | |
| run: ruff check python/ tests/ benchmarks/ | |
| - name: Ruff format check | |
| run: ruff format --check python/ tests/ benchmarks/ | |
| build-cuda: | |
| name: CUDA Build | |
| runs-on: ubuntu-latest | |
| container: | |
| image: nvidia/cuda:12.4.1-devel-ubuntu22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install build dependencies | |
| run: | | |
| apt-get update && apt-get install -y --no-install-recommends \ | |
| cmake ninja-build python3-dev python3-pip git | |
| rm -rf /var/lib/apt/lists/* | |
| - name: Configure (Release preset) | |
| run: cmake --preset release | |
| - name: Build | |
| run: cmake --build --preset release -j$(nproc) | |
| test-python: | |
| name: Python Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| - name: Install test dependencies | |
| run: | | |
| pip install -U pip | |
| pip install pytest hypothesis | |
| pip install torch --index-url https://download.pytorch.org/whl/cpu | |
| - name: Run tests (skip CUDA) | |
| run: pytest tests/ -v -m "not cuda" --tb=short || true |