Fix CI lint errors and test failures #539
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] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-${{ matrix.python-version }}- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run linting | |
| if: matrix.python-version == '3.12' | |
| run: | | |
| ruff check . | |
| ruff format --check . | |
| - name: Run type checking | |
| if: matrix.python-version == '3.12' | |
| run: | | |
| mypy headroom --ignore-missing-imports | |
| - name: Run tests | |
| run: | | |
| pytest -v --tb=short | |
| - name: Run tests with coverage | |
| if: matrix.python-version == '3.11' | |
| run: | | |
| pytest --cov=headroom --cov-report=xml --cov-report=term-missing | |
| - name: Upload coverage to Codecov | |
| if: matrix.python-version == '3.11' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.xml | |
| fail_ci_if_error: false | |
| test-extras: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install with relevance extras | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev,relevance]" | |
| - name: Run relevance tests | |
| run: | | |
| pytest tests/test_relevance.py -v | |
| test-agno: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install with agno extras | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev,agno]" | |
| - name: Run agno tests | |
| run: | | |
| pytest tests/test_integrations/agno/ -v | |
| docker-native-e2e: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Build local Headroom image | |
| run: | | |
| docker build -t headroom-native-e2e:latest . | |
| - name: Run Docker-native installer e2e | |
| env: | |
| HEADROOM_DOCKER_IMAGE: headroom-native-e2e:latest | |
| run: | | |
| bash e2e/docker-native-install.sh | |
| - name: Run Docker-native compose smoke test | |
| env: | |
| HEADROOM_IMAGE: headroom-native-e2e:latest | |
| HEADROOM_HOST_HOME: ${{ github.workspace }} | |
| HEADROOM_WORKSPACE: ${{ github.workspace }} | |
| run: | | |
| mkdir -p .headroom .claude .codex .gemini | |
| trap 'docker compose -f docker/docker-compose.native.yml down -v' EXIT | |
| docker compose -f docker/docker-compose.native.yml up -d proxy | |
| for attempt in $(seq 1 30); do | |
| if curl --fail --silent http://127.0.0.1:8787/readyz >/dev/null; then | |
| break | |
| fi | |
| if [ "$attempt" -eq 30 ]; then | |
| docker compose -f docker/docker-compose.native.yml logs proxy | |
| exit 1 | |
| fi | |
| sleep 1 | |
| done | |
| - name: Run Docker-native wrap e2e | |
| run: | | |
| docker build -f e2e/wrap/Dockerfile -t headroom-wrap-e2e . | |
| docker run --rm headroom-wrap-e2e | |
| windows-native-wrapper: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install test dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest | |
| - name: Run native installer wrapper tests | |
| run: | | |
| pytest tests/test_install/test_native_installers.py -q | |
| macos-native-wrapper: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install bash and test dependencies | |
| run: | | |
| brew install bash | |
| python -m pip install --upgrade pip | |
| pip install pytest | |
| - name: Run native installer wrapper tests | |
| run: | | |
| export PATH="$(brew --prefix bash)/bin:$PATH" | |
| pytest tests/test_install/test_native_installers.py -q | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip build twine | |
| - name: Build package | |
| run: | | |
| python -m build | |
| - name: Check package | |
| run: | | |
| twine check dist/* | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ |