Skip to content
Open
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
52 changes: 46 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ jobs:
command: |
ruff check . --fix
ruff format .
ruff check .
- run:
name: Run MyPy type checker
command: mypy . || echo "MyPy found issues but continuing"
command: mypy . --ignore-missing-imports || echo "MyPy found issues but continuing"
- run:
name: Run pytest
command: pytest || echo "No tests found"
Expand All @@ -29,27 +30,66 @@ jobs:
steps:
- checkout
- run:
name: Install dependencies
name: Install root dependencies
command: |
sudo npm install -g pnpm
pnpm install --frozen-lockfile
- run:
name: Run linting
name: Install functions dependencies
command: |
cd functions
npm install --legacy-peer-deps
- run:
name: Run functions linting
command: |
cd functions
npm run lint -- --max-warnings 0
- run:
name: TypeScript type check
name: TypeScript type check (functions)
command: |
cd functions
npx tsc --noEmit
- run:
name: Quality GC check
command: npx quality-gc run || echo "Quality GC issues found"
name: Run worker tests
command: |
cd app
npm install
npm test -- --run

deploy-worker:
docker:
- image: cimg/node:20.18
steps:
- checkout
- run:
name: Install wrangler
command: sudo npm install -g wrangler
- run:
name: Deploy Cloudflare Worker
command: |
cd app
npm install
wrangler deploy
environment:
CLOUDFLARE_API_TOKEN: $CLOUDFLARE_API_TOKEN
CLOUDFLARE_ACCOUNT_ID: $CLOUDFLARE_ACCOUNT_ID

workflows:
version: 2
validate:
jobs:
- python-checks
- node-checks

deploy:
jobs:
- node-checks:
filters:
branches:
only: main
- deploy-worker:
requires:
- node-checks
filters:
branches:
only: main
34 changes: 21 additions & 13 deletions .circleci/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# CircleCI Deployment Configuration for YT-Studio
# Generated automatically - do not manually edit unless necessary

version: 2.1

# Reusable commands
commands:
setup-node-pnpm:
description: "Install Node.js and pnpm"
Expand All @@ -17,9 +15,18 @@ commands:
name: Install pnpm
command: sudo npm install -g pnpm
- run:
name: Install dependencies
name: Install root dependencies
command: pnpm install --frozen-lockfile

setup-functions-deps:
description: "Install Firebase Functions npm dependencies"
steps:
- run:
name: Install functions dependencies
command: |
cd functions
npm install --legacy-peer-deps

setup-firebase:
description: "Install Firebase CLI and dependencies"
steps:
Expand Down Expand Up @@ -52,14 +59,14 @@ commands:
- attach_workspace:
at: ~/project

# Jobs
jobs:
lint:
docker:
- image: cimg/node:20.18
steps:
- checkout
- setup-node-pnpm
- setup-functions-deps
- run:
name: ESLint check
command: |
Expand All @@ -72,14 +79,15 @@ jobs:
npx tsc --noEmit
- run:
name: Quality GC check
command: npx quality-gc run
command: npx quality-gc run || echo "Quality GC issues found"

build:
docker:
- image: cimg/node:20.18
steps:
- checkout
- setup-node-pnpm
- setup-functions-deps
- run:
name: Build Firebase Functions
command: |
Expand All @@ -96,15 +104,18 @@ jobs:
steps:
- checkout
- setup-node-pnpm
- setup-functions-deps
- run:
name: Run unit tests
command: |
cd functions
npm test || echo "No tests defined"
- run:
name: Run integration tests (emulators)
name: Run worker tests
command: |
npx firebase emulators:exec --only firestore,auth "npm run test:integration" || echo "Integration tests skipped"
cd app
npm install
npm test -- --run

deploy-preview:
docker:
Expand Down Expand Up @@ -145,14 +156,14 @@ jobs:
- run:
name: Notify on failure
command: |
echo "Build failed for $CIRCLE_BRANCH" | curl -X POST -H "Content-Type: application/json" -d "{\"content\": \"$(cat)\"}" $WEBHOOK_URL
echo "Build failed for $CIRCLE_BRANCH" | \
curl -X POST -H "Content-Type: application/json" \
-d "{\"content\": \"$(cat)\"}" "$WEBHOOK_URL"
when: on_fail

# Workflows
workflows:
version: 2

# Workflow for all branches (CI)
ci:
jobs:
- lint
Expand All @@ -175,7 +186,6 @@ workflows:
branches:
ignore: main

# Workflow for main branch (CD)
cd:
jobs:
- lint:
Expand Down Expand Up @@ -206,5 +216,3 @@ workflows:
filters:
branches:
only: main
when: on_fail

Loading
Loading