Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

Run tests in GH Actions (#87)

Marc Klingen538dccc8a79f
diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
index 345faeb887..a5c16100dd 100644
--- a/.github/workflows/pipeline.yml
+++ b/.github/workflows/pipeline.yml
@@ -10,35 +10,66 @@ on:
- "main"
jobs:
- ci:
+ lint:
runs-on: ubuntu-latest
- env:
- DATABASE_URL: postgres://postgres:postgres@localhost:5432/langfuse
- NEXTAUTH_SECRET: "secret"
- NEXTAUTH_URL: "http://localhost:3000/api"
-
steps:
- uses: actions/checkout@v3
-
- uses: actions/setup-node@v3
with:
node-version: 18
-
- # - name: Start containers
- # run: docker-compose -f "docker-compose.dev.yml" up -d --build
-
- name: install dependencies
run: |
npm install
-
+ - name: Load default env
+ run: |
+ cp .env.dev.example .env
- name: lint
run: npm run lint
- # - name: test
- # run: npm run test
+ tests:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/setup-node@v3
+ with:
+ node-version: 18
+ cache: "npm"
+ - name: install dependencies
+ run: |
+ npm install
+
+ - name: Load default env
+ run: |
+ cp .env.dev.example .env
+
+ - name: Run, migrate, seed DB
+ run: |
+ docker-compose -f docker-compose.dev.yml up -d
+ npx --yes prisma migrate reset --force --skip-generate
+
+ - name: run langfuse (without building)
+ run: |
+ (npm run dev&)
+
+ - name: run tests
+ run: |
+ npm run test
+
+ 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]
+ if: always()
+ steps:
+ - name: Successful deploy
+ if: ${{ !(contains(needs.*.result, 'failure')) }}
+ run: exit 0
+ - name: Failing deploy
+ if: ${{ contains(needs.*.result, 'failure') }}
+ run: exit 1
cd:
- needs: ci
+ needs: all-ci-passed
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
env:
diff --git a/docker-compose.build.yml b/docker-compose.build.yml
new file mode 100644
index 0000000000..66f2597094
--- /dev/null
+++ b/docker-compose.build.yml
@@ -0,0 +1,36 @@
+version: "3.5"
+
+services:
+ langfuse-server:
+ build:
+ dockerfile: Dockerfile
+ args:
+ - DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres
+ - NEXTAUTH_SECRET=mysecret
+ - NEXTAUTH_URL=http:localhost:3000
+ depends_on:
+ - db
+ ports:
+ - "3000:3000"
+ environment:
+ - NODE_ENV=production
+ - DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres
+ - DIRECT_URL=postgresql://postgres:postgres@db:5432/postgres
+ - NEXTAUTH_SECRET=mysecret
+ - NEXTAUTH_URL=http:localhost:3000
+
+ db:
+ image: postgres
+ restart: always
+ environment:
+ - POSTGRES_USER=postgres
+ - POSTGRES_PASSWORD=postgres
+ - POSTGRES_DB=postgres
+ ports:
+ - 5432:5432
+ volumes:
+ - database_data:/var/lib/postgresql/data
+
+volumes:
+ database_data:
+ driver: local