| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| lint-and-test: | |
| name: Lint & Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| cache-dependency-path: | | |
| requirements.txt | |
| pyproject.toml | |
| - name: Install system packages | |
| # Required by python-magic (libmagic1) and audio transcription (ffmpeg). | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends libmagic1 ffmpeg | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install \ | |
| "pytest>=8.0,<9" "pytest-asyncio>=0.23,<1" \ | |
| "ruff>=0.6,<1" | |
| - name: Ruff check | |
| run: ruff check docsifer tests | |
| - name: Pytest | |
| env: | |
| DOCSIFER_LOG_JSON: "false" | |
| DOCSIFER_ANALYTICS_ENABLED: "false" | |
| run: pytest tests -q | |
| docker-build: | |
| name: Docker Build (smoke) | |
| runs-on: ubuntu-latest | |
| needs: lint-and-test | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-buildx-action@v3 | |
| - name: Build image (no push) | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: false | |
| load: true | |
| tags: docsifer:ci | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |