mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-09 15:17:59 -05:00
## Changes 🏗️ We want to make running the AutoGPT Front-end as easy as possible. For that, you should be able to run it with the least amount of commands. We recently added generated queries and types on the Front-end from the Back-end OpenAPI schema, to make development easier and catch bugs earlier. However, with the current setup, developers are forced to run `pnpm generate:api-all` with the Back-end running, which is annoying. After this PR, the Front-end can be rerun with just `pnpm i & pnpm dev`. ## Checklist 📋 ### For code changes - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Run the Front-end with just `pnpm dev` and it works --------- Co-authored-by: Abhimanyu Yadav <122007096+Abhi1992002@users.noreply.github.com>
154 lines
3.6 KiB
YAML
154 lines
3.6 KiB
YAML
name: AutoGPT Platform - Frontend CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master, dev]
|
|
paths:
|
|
- ".github/workflows/platform-frontend-ci.yml"
|
|
- "autogpt_platform/frontend/**"
|
|
pull_request:
|
|
paths:
|
|
- ".github/workflows/platform-frontend-ci.yml"
|
|
- "autogpt_platform/frontend/**"
|
|
merge_group:
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
working-directory: autogpt_platform/frontend
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "21"
|
|
|
|
- name: Enable corepack
|
|
run: corepack enable
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Run lint
|
|
run: pnpm lint
|
|
|
|
type-check:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "21"
|
|
|
|
- name: Enable corepack
|
|
run: corepack enable
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Run tsc check
|
|
run: pnpm type-check
|
|
|
|
chromatic:
|
|
runs-on: ubuntu-latest
|
|
# Only run on dev branch pushes or PRs targeting dev
|
|
if: github.ref == 'refs/heads/dev' || github.base_ref == 'dev'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "21"
|
|
|
|
- name: Enable corepack
|
|
run: corepack enable
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Run Chromatic
|
|
uses: chromaui/action@latest
|
|
with:
|
|
projectToken: chpt_9e7c1a76478c9c8
|
|
onlyChanged: true
|
|
workingDir: autogpt_platform/frontend
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
browser: [chromium, webkit]
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "21"
|
|
|
|
- name: Enable corepack
|
|
run: corepack enable
|
|
|
|
- name: Free Disk Space (Ubuntu)
|
|
uses: jlumbroso/free-disk-space@main
|
|
with:
|
|
large-packages: false # slow
|
|
docker-images: false # limited benefit
|
|
|
|
- name: Copy default supabase .env
|
|
run: |
|
|
cp ../.env.example ../.env
|
|
|
|
- name: Copy backend .env
|
|
run: |
|
|
cp ../backend/.env.example ../backend/.env
|
|
|
|
- name: Run docker compose
|
|
run: |
|
|
docker compose -f ../docker-compose.yml up -d
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Setup .env
|
|
run: cp .env.example .env
|
|
|
|
- name: Build frontend
|
|
run: pnpm build --turbo
|
|
# uses Turbopack, much faster and safe enough for a test pipeline
|
|
|
|
- name: Install Browser '${{ matrix.browser }}'
|
|
run: pnpm playwright install --with-deps ${{ matrix.browser }}
|
|
|
|
- name: Run Playwright tests
|
|
run: pnpm test:no-build --project=${{ matrix.browser }}
|
|
|
|
- name: Print Final Docker Compose logs
|
|
if: always()
|
|
run: docker compose -f ../docker-compose.yml logs
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: ${{ !cancelled() }}
|
|
with:
|
|
name: playwright-report-${{ matrix.browser }}
|
|
path: playwright-report/
|
|
retention-days: 30
|