diff --git a/.github/workflows/cluster-build.yml b/.github/workflows/cluster-build.yml deleted file mode 100644 index 4b84cf20..00000000 --- a/.github/workflows/cluster-build.yml +++ /dev/null @@ -1,105 +0,0 @@ -name: Build FarmVibes.AI cluster -run-name: Cluster build and helloworld test -on: - push: - branches: - - dev - - main - pull_request: - branches: - - dev - - main - workflow_dispatch: -env: - FARMVIBES_AI_SKIP_DOCKER_FREE_SPACE_CHECK: yes -jobs: - build: - name: Build and test - runs-on: ubuntu-latest - steps: - - name: Free space before cleanup - shell: bash - run: | - echo "Memory and swap:" - free -h - echo - echo "Available storage:" - df -h - echo - - name: Remove unused software - shell: bash - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -fr /usr/local/lib/android - sudo rm -fr /opt/ghc - - name: Free space after cleanup - shell: bash - run: | - echo "Memory and swap:" - free -h - echo - echo "Available storage:" - df -h - echo - - - name: Update pip version - shell: bash - run: pip install --upgrade pip - - - name: Checkout - uses: actions/checkout@v3 - - - name: Install Python requirements - shell: bash - run: pip install --user ./src/vibe_core - - - name: Actually build cluster - shell: bash - run: farmvibes-ai local setup - - - name: Cluster status - shell: bash - run: | - echo "Deployments:" - kubectl get deployments - kubectl describe deployments - echo "Pods:" - kubectl get pods - echo "Events:" - kubectl get events - - - name: Free space after cluster creation - shell: bash - run: | - echo "Memory and swap:" - free -h - echo - echo "Available storage:" - df -h - echo - - - name: Run Hello World workflow - shell: bash - run: python -m vibe_core.farmvibes_ai_hello_world 300 - - - name: Install tool to view helloworld output - shell: bash - run: yes | sudo apt install caca-utils || echo - - - name: Show helloworld output - shell: bash - run: find ~/.cache/farmvibes-ai/data -type f -name '*.tif' -exec img2txt {} \; 2> /dev/null - - - name: Restart cluster - shell: bash - run: farmvibes-ai local restart - - - name: Wait a bit before submitting a new run (as documented) - shell: bash - run: sleep 90 - - - name: Run Hello World workflow again - shell: bash - run: | - rm -fr ~/.cache/farmvibes-ai/data/{assets,stac} - python -m vibe_core.farmvibes_ai_hello_world 300 diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index 0698d743..8fac7957 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -126,4 +126,72 @@ jobs: ruff check --select D,D401 --ignore D105 --force-exclude --exclude src/vibe_core/vibe_core/farmvibes_ai_hello_world.py --config "lint.pydocstyle.convention = 'google'" src/vibe_core/vibe_core/*.py - name: "Check docstrings for vibe_core/data" run: | - ruff check --select D,D401 --ignore D105 --config "lint.pydocstyle.convention = 'google'" src/vibe_core/vibe_core/data/*.py \ No newline at end of file + ruff check --select D,D401 --ignore D105 --config "lint.pydocstyle.convention = 'google'" src/vibe_core/vibe_core/data/*.py + local-integration-tests: + runs-on: ubuntu-latest + steps: + - name: Free space before cleanup + shell: bash + run: | + echo "Memory and swap:" + free -h + echo + echo "Available storage:" + df -h + echo + - name: Remove unused software + shell: bash + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -fr /usr/local/lib/android + sudo rm -fr /opt/ghc + - name: Free space after cleanup + shell: bash + run: | + echo "Memory and swap:" + free -h + echo + echo "Available storage:" + df -h + echo + - uses: actions/checkout@v4 + with: + lfs: true + - name: Set up Python 3.11 + uses: actions/setup-python@v3 + with: + python-version: '3.11' + - name: Install packages + run: | + pip install ./src/vibe_core + pip install ./src/vibe_common + pip install ./src/vibe_agent + pip install ./src/vibe_server + pip install ./src/vibe_lib + pip install ./src/vibe_dev + - name: Actually build cluster + run: farmvibes-ai local setup --auto-confirm + - name: Cluster status before building local images + run: | + bash ./scripts/local-k8s-diagnostics.sh + - name: Build images + run: | + WAIT_AT_THE_END=1 make local + - name: Cluster status after building local images + run: | + bash ./scripts/local-k8s-diagnostics.sh + - name: Free space after cluster creation + run: | + echo "Memory and swap:" + free -h + echo + echo "Available storage:" + df -h + echo + - name: Run integration tests + run: | + pytest ./src/tests_local_cluster/ -v --junitxml=junit/test-results.xml + - name: Cluster status after running tests + if: always() + run: | + bash ./scripts/local-k8s-diagnostics.sh \ No newline at end of file diff --git a/scripts/local-k8s-diagnostics.sh b/scripts/local-k8s-diagnostics.sh new file mode 100644 index 00000000..aca46057 --- /dev/null +++ b/scripts/local-k8s-diagnostics.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +PATH=$PATH:~/.config/farmvibes-ai + +echo "kubectl location:" +which kubectl + +echo "Cluster pods:" +kubectl get pods +kubectl get pods -o yaml + +echo "Docker images:" +docker images + +echo "REST API description:" +kubectl describe deployment terravibes-rest-api + +echo "Orchestrator description:" +kubectl describe deployment terravibes-orchestrator + +echo "Worker description:" +kubectl describe deployment terravibes-worker + +echo "Cache description:" +kubectl describe deployment terravibes-cache + +echo "REST API logs:" +kubectl logs -l app=terravibes-rest-api --all-containers=true --tail=-1 + +echo "Orchestrator logs:" +kubectl logs -l app=terravibes-orchestrator --all-containers=true --tail=-1 + +echo "Worker logs:" +kubectl logs -l app=terravibes-worker --max-log-requests=8 --all-containers=true --tail=-1 + +echo "Cache logs:" +kubectl logs -l app=terravibes-cache --all-containers=true --tail=-1 + +echo "Data Ops logs:" +kubectl logs -l app=terravibes-data-ops --all-containers=true --tail=-1 + +echo "Kubernetes logs:" +docker ps | egrep 'k3d-farmvibes-ai-.*-0' | awk '{ print $1 }' | xargs docker logs