Add python-dotenv dependency and update README installation instructions #10
Workflow file for this run
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 ] | |
| tags: | |
| - 'v*' # Trigger on version tags (v1.0.0, v1.2.3, etc.) | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies and package | |
| run: | | |
| cd kernagent | |
| uv sync --all-groups | |
| - name: Run pytest | |
| run: | | |
| cd kernagent | |
| uv run pytest ../tests -v | |
| lint: | |
| name: Code Quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| cd kernagent | |
| uv sync --all-groups | |
| - name: Check Python syntax | |
| run: | | |
| cd kernagent | |
| uv run python -m py_compile *.py */**.py | |
| build: | |
| name: Build & Test Docker Image | |
| runs-on: ubuntu-latest | |
| # Only run on version tags (releases) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest | |
| - name: Build Docker image for testing | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: false | |
| tags: kernagent:test | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| load: true | |
| - name: Save Docker image | |
| run: docker save kernagent:test | gzip > kernagent-image.tar.gz | |
| - name: Upload Docker image artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docker-image | |
| path: kernagent-image.tar.gz | |
| retention-days: 1 | |
| - name: Load Docker image | |
| run: docker load < kernagent-image.tar.gz | |
| - name: Run pytest inside Docker container | |
| run: | | |
| docker run --rm \ | |
| -v $(pwd)/tests:/workspace/tests:ro \ | |
| -v $(pwd)/kernagent:/workspace/project/kernagent:ro \ | |
| --entrypoint bash \ | |
| kernagent:test \ | |
| -c "cd /workspace/project && PYTHONPATH=/workspace/project/kernagent:/workspace/project uv run pytest /workspace/tests -v" | |
| - name: Test CLI help command | |
| run: | | |
| docker run --rm kernagent:test --help | |
| - name: Build and push to GitHub Container Registry | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| provenance: false |