Staging #77
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, staging] | |
| pull_request: | |
| branches: [main, staging] | |
| jobs: | |
| enforce-staging: | |
| if: github.event_name == 'pull_request' && github.base_ref == 'main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Ensure PR comes from staging | |
| run: | | |
| if [ "${{ github.head_ref }}" != "staging" ]; then | |
| echo "PRs to main must come from staging" | |
| exit 1 | |
| fi | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install flake8 flake8-pyproject | |
| - name: Run flake8 | |
| run: flake8 | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install system dependencies (musl and UI libs) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl musl-dev musl-tools xvfb libegl1 libgl1 libxkbcommon-x11-0 libdbus-1-3 libnss3 libxcomposite1 libxdamage1 libxrandr2 libxtst6 libxcb-cursor0 | |
| sudo ln -s /lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1 || true | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu --only-binary llama-cpp-python | |
| pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu --no-cache-dir | |
| - name: Run tests | |
| run: xvfb-run -a python -m pytest -v |