PQL: Add TS functions for automations #14
This file contains hidden or 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: Server CI | |
on: | |
pull_request: | |
paths: | |
- "server/**" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Load secrets from 1Password | |
uses: 1password/load-secrets-action@v1 | |
with: | |
export-env: true | |
env: | |
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} | |
PQL_API_KEY: "op://Product ACT/pql-docs-bot/pql-api-key" | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@v1 | |
- name: Install dependencies | |
run: | | |
cd server | |
bun install | |
- name: Run tests | |
run: | | |
cd server | |
bun test | |
docker-integration: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Load secrets from 1Password | |
uses: 1password/load-secrets-action@v1 | |
with: | |
export-env: true | |
env: | |
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} | |
PQL_API_KEY: "op://Product ACT/pql-docs-bot/pql-api-key" | |
- name: Build Docker image | |
run: | | |
cd server | |
docker build -t docs-bot-server:test . | |
- name: Test Docker container | |
run: | | |
cd server | |
docker run -d --name test-server \ | |
-p 4000:4000 \ | |
-e SERVER_PORT=4000 \ | |
-e PQL_API_KEY="${PQL_API_KEY}" \ | |
docs-bot-server:test | |
sleep 10 | |
curl -f http://localhost:4000/ || exit 1 | |
curl -X POST http://localhost:4000/chat/conversations/test/messages \ | |
-H "Content-Type: application/json" \ | |
-d '{"message":"test","history":[]}' \ | |
--max-time 30 || exit 1 | |
docker stop test-server |