Skip to content

Add storybook

Add storybook #4175

Workflow file for this run

name: CI Build
on:
push:
branches: [main, release/v0.7.x]
paths-ignore:
- "**/*.md"
pull_request:
branches: [main, release/v0.7.x]
paths-ignore:
- "**/*.md"
workflow_dispatch:
env:
# Cache key components for better organization
CACHE_KEY_PREFIX: kagent-v2
BRANCH_CACHE_KEY: ${{ github.head_ref || github.ref_name }}
# Consistent builder configuration
BUILDX_BUILDER_NAME: kagent-builder-v0.23.0
BUILDX_VERSION: v0.23.0
jobs:
setup:
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-key.outputs.key }}
steps:
- name: Generate cache keys
id: cache-key
run: |
# Generate branch-based cache key
BRANCH_KEY="${CACHE_KEY_PREFIX}-${BRANCH_CACHE_KEY}"
echo "key=${BRANCH_KEY}" >> $GITHUB_OUTPUT
echo "::notice title=Cache Key::Branch: ${BRANCH_KEY}"
test-e2e:
needs:
- setup
strategy:
fail-fast: false
matrix:
database: [sqlite, postgres]
env:
VERSION: v0.0.1-test
runs-on: ubuntu-latest
services:
postgres:
image: pgvector/pgvector:pg18-trixie
env:
POSTGRES_DB: kagent
POSTGRES_USER: postgres
POSTGRES_PASSWORD: kagent
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize Environment
uses: ./.github/actions/initialize-environment
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
name: ${{ env.BUILDX_BUILDER_NAME }}
version: ${{ env.BUILDX_VERSION }}
platforms: linux/amd64,linux/arm64
use: "true"
driver-opts: network=host
- name: Set up Helm
uses: azure/setup-helm@v4.2.0
with:
version: v3.18.0
- name: Install Kind
id: kind
uses: helm/kind-action@b72c923563e6e80ea66e8e8c810798cc73e97e5e
with:
install_only: true
- name: Install Kagent
id: install-kagent
env:
OPENAI_API_KEY: fake
BUILDX_BUILDER_NAME: ${{ env.BUILDX_BUILDER_NAME }}
KAGENT_HELM_EXTRA_ARGS: --cleanup-on-fail=false
DOCKER_BUILD_ARGS: >-
--cache-from=type=gha,scope=${{ needs.setup.outputs.cache-key }}-e2e
--cache-from=type=gha,scope=${{ env.CACHE_KEY_PREFIX }}-main-e2e
--cache-to=type=gha,scope=${{ needs.setup.outputs.cache-key }}-e2e,mode=max
--platform=linux/amd64
--push
run: |
make create-kind-cluster
echo "Cache key: ${{ needs.setup.outputs.cache-key }}"
if [ "${{ matrix.database }}" = "postgres" ]; then
HOST_IP=$(docker network inspect kind -f '{{range .IPAM.Config}}{{if .Gateway}}{{.Gateway}}{{"\n"}}{{end}}{{end}}' | grep -E '^[0-9]+\.' | head -1)
export KAGENT_HELM_EXTRA_ARGS="$KAGENT_HELM_EXTRA_ARGS --set database.type=postgres --set database.postgres.url=postgres://postgres:kagent@${HOST_IP}:5432/kagent"
echo "Postgres URL: postgres://postgres:kagent@${HOST_IP}:5432/kagent"
fi
make helm-install
make push-test-agent push-test-skill
kubectl wait --for=condition=Ready agents.kagent.dev -n kagent --all --timeout=60s || kubectl get po -n kagent -o wide ||:
kubectl wait --for=condition=Ready agents.kagent.dev -n kagent --all --timeout=60s
- name: Run e2e tests
if: success()
working-directory: go/core
run: |
# Get the Kind network gateway IP that pods can reach
HOST_IP=$(docker network inspect kind -f '{{range .IPAM.Config}}{{if .Gateway}}{{.Gateway}}{{"\n"}}{{end}}{{end}}' | grep -E '^[0-9]+\.' | head -1)
echo "Detected Kind network gateway: $HOST_IP"
export KAGENT_LOCAL_HOST=$HOST_IP
export KAGENT_URL="http://$(kubectl get svc -n kagent kagent-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip}'):8083"
echo "KAGENT_URL: $KAGENT_URL"
echo "KAGENT_LOCAL_HOST: $KAGENT_LOCAL_HOST"
# no need to run e2e tests with race, as this will just apply to the test code.
# all objects created in e2e tests have a generated name, so they can run in parallel safely.
go test -v github.com/kagent-dev/kagent/go/core/test/e2e -failfast -shuffle=on
- name: fail print info
if: failure()
run: |
echo "::error::Failed to run e2e tests"
echo "::error::Kubectl get pods -n kagent"
kubectl describe pods -n kagent
echo "::error::Kubectl get events -n kagent"
kubectl get events -n kagent
echo "::error::Kubectl get agents -n kagent"
echo "::error::Kubectl logs -n kagent deployment/kagent-controller"
kubectl logs -n kagent deployment/kagent-controller
go-unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.25"
cache: true
cache-dependency-path: go/*/go.sum
- name: Run Go unit tests
working-directory: go
run: |
go test -race -skip 'TestE2E.*' -v ./api/... ./adk/... ./core/...
helm-unit-tests:
env:
VERSION: v0.0.1-test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4.2.0
with:
version: v3.18.0
# Install unittest plugin
- name: Install unittest plugin
run: |
helm plugin install https://github.com/helm-unittest/helm-unittest
- name: Chart init
run: |
make helm-version
- name: Run helm unit tests
run: |
helm unittest helm/kagent
ui-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: "npm"
cache-dependency-path: ui/package-lock.json
- name: Install dependencies
working-directory: ./ui
env:
CYPRESS_INSTALL_BINARY: 0 # Skip Cypress binary - not needed for lint/unit tests
run: npm ci
- name: Run lint
working-directory: ./ui
run: npm run lint
- name: Run tests
working-directory: ./ui
run: npm run test
# This job builds the Docker images for the controller, UI, app, and CLI on arm64.
build:
needs: setup
env:
VERSION: v0.0.1-test
strategy:
matrix:
image:
- controller
- ui
- app
- cli
- golang-adk
- skills-init
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5001:5000
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
name: ${{ env.BUILDX_BUILDER_NAME }}
platforms: linux/amd64,linux/arm64
version: ${{ env.BUILDX_VERSION }}
use: "true"
driver-opts: network=host
- name: Run make build
env:
BUILDX_BUILDER_NAME: ${{ env.BUILDX_BUILDER_NAME }}
DOCKER_BUILD_ARGS: >-
--cache-from=type=gha,scope=${{ needs.setup.outputs.cache-key }}-${{ matrix.image }}
--cache-from=type=gha,scope=${{ env.CACHE_KEY_PREFIX }}-main-${{ matrix.image }}
--cache-to=type=gha,scope=${{ needs.setup.outputs.cache-key }}-${{ matrix.image }},mode=max
--platform=linux/amd64,linux/arm64
--push
DOCKER_REPO: "${{ github.repository_owner }}/kagent"
DOCKER_BUILDER: "docker buildx"
run: make build-${{ matrix.image }}
working-directory: ./
go-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25"
cache: true
cache-dependency-path: go/*/go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.8.0
working-directory: go/core
python-test:
env:
OPENAI_API_KEY: fake
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install python
run: uv python install ${{ matrix.python-version }}
- name: Sync dependencies
working-directory: ./python
run: uv sync --all-extras
- name: Generate test certificates
working-directory: ./python
run: make generate-test-certs
- name: Run tests
working-directory: ./python
run: make test
python-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install python
run: uv python install 3.10
- name: Sync dependencies
working-directory: ./python
run: uv sync --all-extras
- name: Run ruff linter
working-directory: ./python
run: uv run ruff check
- name: Run ruff format check
working-directory: ./python
run: |
if ! uv run ruff format --diff .; then
echo "Ruff formatting issues detected. Please run 'uv run ruff format' locally to fix formatting issues."
exit 1
fi
manifests-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25"
cache: true
cache-dependency-path: go/*/go.sum
- name: Generate controller manifests
run: make controller-manifests
- name: Check for uncommitted changes
run: |
if ! git diff --exit-code; then
echo "::error::Controller manifests are out of date!"
echo "::error::Please run 'make controller-manifests' and commit the changes."
echo ""
echo "The following files have differences:"
git diff --name-only
echo ""
echo "Diff details:"
git diff
exit 1
fi
echo "✓ Controller manifests are up to date"