perf: optimize indices #7666
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "main" | |
tags: | |
- "v*" | |
merge_group: | |
pull_request: | |
branches: | |
- "*" | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8.15.5 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
cache-dependency-path: "pnpm-lock.yaml" | |
- name: install dependencies | |
run: | | |
pnpm i | |
- name: Load default env | |
run: | | |
cp .env.dev.example .env | |
- name: lint web | |
run: pnpm run lint | |
test-docker-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build and run both images from compose | |
run: | | |
docker compose -f docker-compose.build.yml up -d | |
sleep 5 # Wait for PostgreSQL to accept connections | |
- name: Check server health | |
run: | | |
timeout 10 bash -c 'until curl -f http://localhost:3000/api/public/health; do sleep 2; done' | |
- name: Check worker health | |
run: | | |
timeout 10 bash -c 'until curl -f http://localhost:3030/api/health; do sleep 2; done' | |
- name: Ensure no unhealthy status | |
run: | | |
if docker-compose ps | grep "(unhealthy)"; then | |
echo "One or more services are unhealthy" | |
exit 1 | |
else | |
echo "All services are healthy" | |
fi | |
tests-web: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] | |
postgres-version: [12, 15] | |
steps: | |
- name: Set Swap Space | |
uses: pierotofy/set-swap-space@master | |
with: | |
swap-size-gb: 10 | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8.15.5 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
cache-dependency-path: "pnpm-lock.yaml" | |
- name: install dependencies | |
run: | | |
pnpm install | |
- name: Load default env | |
run: | | |
cp .env.dev.example .env | |
cp .env.dev.example web/.env | |
- name: Run + migrate | |
run: | | |
docker compose -f docker-compose.dev.yml up -d | |
sleep 5 # Wait for PostgreSQL to accept connections | |
docker compose ps | |
env: | |
POSTGRES_VERSION: ${{ matrix.postgres-version }} | |
- name: Seed DB | |
run: | | |
pnpm run db:migrate | |
pnpm run db:seed | |
- name: Build | |
run: pnpm run build | |
- name: Start Langfuse | |
run: (pnpm run start&) | |
- name: run tests | |
run: pnpm --filter=web run test | |
tests-worker: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] | |
postgres-version: [12, 15] | |
steps: | |
- name: Set Swap Space | |
uses: pierotofy/set-swap-space@master | |
with: | |
swap-size-gb: 10 | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8.15.5 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
cache-dependency-path: "pnpm-lock.yaml" | |
- name: install dependencies | |
run: | | |
pnpm install | |
- name: Load default env | |
run: | | |
cp .env.dev.example .env | |
cp .env.dev.example web/.env | |
- name: Run + migrate | |
run: | | |
docker compose -f docker-compose.dev.yml up -d | |
sleep 5 # Wait for PostgreSQL to accept connections | |
docker compose ps | |
- name: Seed DB | |
run: | | |
pnpm run db:migrate | |
pnpm run db:seed | |
- name: Build | |
run: pnpm --filter=worker... run build | |
- name: run tests | |
run: pnpm --filter=worker run test | |
e2e-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8.15.5 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
cache-dependency-path: "pnpm-lock.yaml" | |
- name: install dependencies | |
run: | | |
pnpm install | |
- name: Load default env | |
run: | | |
cp .env.dev.example .env | |
cp .env.dev.example web/.env | |
- name: Run + migrate | |
run: | | |
docker compose -f docker-compose.dev.yml up -d | |
docker compose ps | |
sleep 5 # Wait for PostgreSQL to accept connections | |
- name: Seed DB | |
run: | | |
pnpm run db:migrate | |
pnpm run db:seed | |
- name: Build | |
run: pnpm run build | |
- name: Install playwright | |
run: pnpm --filter=web exec playwright install --with-deps | |
- name: Run e2e tests | |
run: pnpm --filter=web run test:e2e | |
all-ci-passed: | |
# This allows us to have a branch protection rule for tests and deploys with matrix | |
runs-on: ubuntu-latest | |
needs: [lint, tests-web, tests-worker, e2e-tests, test-docker-build] | |
if: always() | |
steps: | |
- name: Successful deploy | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
working-directory: . | |
- name: Failing deploy | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 | |
working-directory: . | |
push-docker-image: | |
needs: all-ci-passed | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) | |
environment: "protected branches" | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8.15.5 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache-dependency-path: "pnpm-lock.yaml" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Log in to the GitHub Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta-web | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
ghcr.io/langfuse/langfuse # GitHub | |
langfuse/langfuse # Docker Hub | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=sha | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Build and push Docker image (web) | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./web/Dockerfile | |
push: true | |
tags: ${{ steps.meta-web.outputs.tags }} | |
labels: ${{ steps.meta-web.outputs.labels }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta-worker | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
ghcr.io/langfuse/langfuse-worker # GitHub | |
langfuse/langfuse-worker # Docker Hub | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=sha | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Build and push Docker image (worker) | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./worker/Dockerfile | |
push: true | |
tags: ${{ steps.meta-worker.outputs.tags }} | |
labels: ${{ steps.meta-worker.outputs.labels }} |