mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-14 09:38:00 -05:00
- Remove ClamAV from backend CI (saves 3-5 min per run) - ClamAV tests now only run on merge to master via new security-ci workflow - Reduce Python matrix to 3.13 only (matches Docker image) - Add Docker image tar caching to frontend and fullstack CI - Add Playwright browser caching to frontend CI (saves 30-60s) - Reduce service wait timeouts from 60s to 30s Estimated savings: - Backend CI: 50-60% faster - Frontend CI: 30-40% faster - Fullstack CI: 30-40% faster 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
197 lines
6.6 KiB
YAML
197 lines
6.6 KiB
YAML
name: AutoGPT Platform - Frontend CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master, dev]
|
|
paths:
|
|
- ".github/workflows/platform-fullstack-ci.yml"
|
|
- "autogpt_platform/**"
|
|
pull_request:
|
|
paths:
|
|
- ".github/workflows/platform-fullstack-ci.yml"
|
|
- "autogpt_platform/**"
|
|
merge_group:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event_name == 'merge_group' && format('merge-queue-{0}', github.ref) || github.head_ref && format('pr-{0}', github.event.pull_request.number) || github.sha }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
working-directory: autogpt_platform/frontend
|
|
|
|
jobs:
|
|
setup:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
cache-key: ${{ steps.cache-key.outputs.key }}
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22.18.0"
|
|
|
|
- name: Enable corepack
|
|
run: corepack enable
|
|
|
|
- name: Generate cache key
|
|
id: cache-key
|
|
run: echo "key=${{ runner.os }}-pnpm-${{ hashFiles('autogpt_platform/frontend/pnpm-lock.yaml', 'autogpt_platform/frontend/package.json') }}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.pnpm-store
|
|
key: ${{ steps.cache-key.outputs.key }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-${{ hashFiles('autogpt_platform/frontend/pnpm-lock.yaml') }}
|
|
${{ runner.os }}-pnpm-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
types:
|
|
runs-on: ubuntu-latest
|
|
needs: setup
|
|
strategy:
|
|
fail-fast: false
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22.18.0"
|
|
|
|
- name: Enable corepack
|
|
run: corepack enable
|
|
|
|
- name: Copy default supabase .env
|
|
run: |
|
|
cp ../.env.default ../.env
|
|
|
|
- name: Copy backend .env
|
|
run: |
|
|
cp ../backend/.env.default ../backend/.env
|
|
|
|
# Docker image tar caching - loads images from cache in parallel for faster startup
|
|
- name: Set up Docker image cache
|
|
id: docker-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/docker-cache
|
|
key: docker-images-fullstack-${{ runner.os }}-${{ hashFiles('autogpt_platform/docker-compose.yml') }}
|
|
restore-keys: |
|
|
docker-images-fullstack-${{ runner.os }}-
|
|
|
|
- name: Load or pull Docker images
|
|
working-directory: autogpt_platform
|
|
run: |
|
|
mkdir -p ~/docker-cache
|
|
|
|
# Define image list for easy maintenance
|
|
IMAGES=(
|
|
"redis:latest"
|
|
"rabbitmq:management"
|
|
"kong:2.8.1"
|
|
"supabase/gotrue:v2.170.0"
|
|
"supabase/postgres:15.8.1.049"
|
|
)
|
|
|
|
# Check if any cached tar files exist
|
|
if ls ~/docker-cache/*.tar 1> /dev/null 2>&1; then
|
|
echo "Docker cache found, loading images in parallel..."
|
|
for image in "${IMAGES[@]}"; do
|
|
filename=$(echo "$image" | tr ':/' '--')
|
|
if [ -f ~/docker-cache/${filename}.tar ]; then
|
|
echo "Loading $image..."
|
|
docker load -i ~/docker-cache/${filename}.tar || echo "Warning: Failed to load $image from cache" &
|
|
fi
|
|
done
|
|
wait
|
|
echo "All cached images loaded"
|
|
else
|
|
echo "No Docker cache found, pulling images in parallel..."
|
|
for image in "${IMAGES[@]}"; do
|
|
docker pull "$image" &
|
|
done
|
|
wait
|
|
|
|
# Only save cache on main branches (not PRs) to avoid cache pollution
|
|
if [[ "${{ github.ref }}" == "refs/heads/master" ]] || [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
|
|
echo "Saving Docker images to cache in parallel..."
|
|
for image in "${IMAGES[@]}"; do
|
|
filename=$(echo "$image" | tr ':/' '--')
|
|
echo "Saving $image..."
|
|
docker save -o ~/docker-cache/${filename}.tar "$image" || echo "Warning: Failed to save $image" &
|
|
done
|
|
wait
|
|
echo "Docker image cache saved"
|
|
else
|
|
echo "Skipping cache save for PR/feature branch"
|
|
fi
|
|
fi
|
|
|
|
echo "Docker images ready for use"
|
|
|
|
- name: Run docker compose
|
|
run: |
|
|
docker compose -f ../docker-compose.yml --profile local --profile deps_backend up -d
|
|
|
|
- name: Restore dependencies cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.pnpm-store
|
|
key: ${{ needs.setup.outputs.cache-key }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Setup .env
|
|
run: cp .env.default .env
|
|
|
|
- name: Wait for services to be ready
|
|
run: |
|
|
echo "Waiting for rest_server to be ready..."
|
|
timeout 30 sh -c 'until curl -f http://localhost:8006/health 2>/dev/null; do sleep 2; done' || echo "Rest server health check timeout, continuing..."
|
|
echo "Waiting for database to be ready..."
|
|
timeout 30 sh -c 'until docker compose -f ../docker-compose.yml exec -T db pg_isready -U postgres 2>/dev/null; do sleep 2; done' || echo "Database ready check timeout, continuing..."
|
|
|
|
- name: Generate API queries
|
|
run: pnpm generate:api:force
|
|
|
|
- name: Check for API schema changes
|
|
run: |
|
|
if ! git diff --exit-code src/app/api/openapi.json; then
|
|
echo "❌ API schema changes detected in src/app/api/openapi.json"
|
|
echo ""
|
|
echo "The openapi.json file has been modified after running 'pnpm generate:api-all'."
|
|
echo "This usually means changes have been made in the BE endpoints without updating the Frontend."
|
|
echo "The API schema is now out of sync with the Front-end queries."
|
|
echo ""
|
|
echo "To fix this:"
|
|
echo "1. Pull the backend 'docker compose pull && docker compose up -d --build --force-recreate'"
|
|
echo "2. Run 'pnpm generate:api' locally"
|
|
echo "3. Run 'pnpm types' locally"
|
|
echo "4. Fix any TypeScript errors that may have been introduced"
|
|
echo "5. Commit and push your changes"
|
|
echo ""
|
|
exit 1
|
|
else
|
|
echo "✅ No API schema changes detected"
|
|
fi
|
|
|
|
- name: Run Typescript checks
|
|
run: pnpm types
|