name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
permissions:
contents: read
pull-requests: write
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.11", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
version: "latest"
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-extras
- name: Run linting with ruff
run: |
uv run ruff check src/ tests/ --output-format=github
uv run ruff format --check src/ tests/
- name: Run type checking with mypy
run: uv run mypy src/ --strict --show-error-codes
continue-on-error: true # TODO: Fix all type errors and remove this flag (YAY-12)
- name: Run tests with pytest
run: |
uv run pytest \
--cov=src \
--cov-report=xml \
--cov-report=term-missing \
--cov-report=html \
--junit-xml=pytest-report.xml \
-v
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
flags: unittests
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }}
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.os }}-py${{ matrix.python-version }}
path: |
pytest-report.xml
htmlcov/
coverage.xml
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: src/oxide/web/frontend/package-lock.json
- name: Install frontend dependencies
run: |
cd src/oxide/web/frontend
npm ci
- name: Lint frontend
run: |
cd src/oxide/web/frontend
npm run lint
continue-on-error: true # TODO: Fix ESLint errors (React Hook rules, unescaped entities) - YAY-12
- name: Build frontend
run: |
cd src/oxide/web/frontend
npm run build
- name: Upload frontend build artifact
uses: actions/upload-artifact@v4
with:
name: frontend-build-${{ matrix.os }}-py${{ matrix.python-version }}
path: src/oxide/web/frontend/dist/
retention-days: 7
integration-tests:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
enable-cache: true
- name: Set up Python
run: uv python install 3.11
- name: Install dependencies
run: uv sync --all-extras
- name: Start Ollama (for integration tests)
run: |
# Install Ollama if available
if command -v ollama &> /dev/null; then
ollama serve &
sleep 5
fi
continue-on-error: true
- name: Run integration tests
run: |
uv run pytest tests/ -m integration -v
continue-on-error: true # Don't fail if no integration tests exist yet