Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
# on a transient GitHub API failure (it sets no outputs when it fails).
kilocode_backend: ${{ steps.filter.outputs.kilocode_backend || steps.filter_retry.outputs.kilocode_backend }}
cloud_agent_next: ${{ steps.filter.outputs.cloud_agent_next || steps.filter_retry.outputs.cloud_agent_next }}
ai_gateway: ${{ steps.filter.outputs.ai_gateway || steps.filter_retry.outputs.ai_gateway }}
workspace_matrix: ${{ steps.workspaces.outputs.matrix }}
steps:
- uses: useblacksmith/checkout@41cdeedae8edb2e684ba22896a5fd2a3cb85db6b # v1
Expand Down Expand Up @@ -98,6 +99,14 @@ jobs:
- '.github/workflows/ci.yml'
- 'package.json'
- 'pnpm-lock.yaml'
ai_gateway:
- 'apps/ai-gateway/**'
- 'apps/web/.env'
- 'apps/web/.env.test'
- 'packages/**'
- '.github/workflows/ci.yml'
- 'package.json'
- 'pnpm-lock.yaml'
- name: Detect changes (retry)
id: filter_retry
# Keep the filters byte-identical to the attempt above:
Expand Down Expand Up @@ -132,6 +141,14 @@ jobs:
- '.github/workflows/ci.yml'
- 'package.json'
- 'pnpm-lock.yaml'
ai_gateway:
- 'apps/ai-gateway/**'
- 'apps/web/.env'
- 'apps/web/.env.test'
- 'packages/**'
- '.github/workflows/ci.yml'
- 'package.json'
- 'pnpm-lock.yaml'
- name: Detect changed workspaces with tests
id: workspaces
run: |
Expand Down Expand Up @@ -380,6 +397,52 @@ jobs:
NODE_OPTIONS: '--max-old-space-size=8192'
run: pnpm run build

build-ai-gateway:
needs: [changes, typecheck, lint, format-check, drizzle-check]
if: needs.changes.outputs.ai_gateway == 'true'
runs-on: ${{ vars.RUNNER_DEFAULT_LABEL || 'ubuntu-latest' }}
timeout-minutes: 20
steps:
- uses: useblacksmith/checkout@41cdeedae8edb2e684ba22896a5fd2a3cb85db6b # v1

- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0

- name: Setup Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Cache Next.js build
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ github.workspace }}/apps/ai-gateway/.next/cache
key: ${{ runner.os }}-nextjs-ai-gateway-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-nextjs-ai-gateway-${{ hashFiles('pnpm-lock.yaml') }}-

# The app runs with the web app's environment; see apps/ai-gateway/scripts/dev.sh.
- name: Setup dummy build env
working-directory: apps/ai-gateway
run: |
cp ../web/.env .env
cp ../web/.env.test .env.production.local

- name: Build ai-gateway
env:
NODE_ENV: production
VERCEL_ENV: production
NEXTAUTH_URL: https://ci-build.invalid
POSTGRES_URL: postgres://unused:unused@localhost:5432/unused
UPSTASH_REDIS_REST_URL: https://redis.test.invalid
UPSTASH_REDIS_REST_TOKEN: dummy-test-redis-token
SENTRY_AUTH_TOKEN: ''
run: pnpm --filter ai-gateway run build

cloud-agent-next:
needs: [changes, typecheck, lint, format-check, drizzle-check]
if: needs.changes.outputs.cloud_agent_next == 'true'
Expand Down
2 changes: 1 addition & 1 deletion scripts/changes-filter-retry.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { load } from 'js-yaml';
// evaluate different paths than the first attempt reported.

const actionRef = 'dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d';
const filterNames = ['kilocode_backend', 'cloud_agent_next'];
const filterNames = ['kilocode_backend', 'cloud_agent_next', 'ai_gateway'];
const fallbackOutput = name =>
`\${{ steps.filter.outputs.${name} || steps.filter_retry.outputs.${name} }}`;

Expand Down