Skip to content

production-ready SDK with corrected API and examples #6

production-ready SDK with corrected API and examples

production-ready SDK with corrected API and examples #6

Workflow file for this run

# .github/workflows/ci.yml
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint
- name: Run type checking
run: npm run type-check
- name: Run unit tests
run: npm run test:unit
- name: Run build
run: npm run build
- name: Check build outputs
run: |
ls -la dist/
test -f dist/index.js
test -f dist/index.mjs
test -f dist/index.d.ts
- name: Test import (CommonJS)
run: node -e "const OstrichDB = require('./dist/index.js'); console.log('CommonJS import successful');"
- name: Test import (ESM)
run: node -e "import('./dist/index.mjs').then(() => console.log('ESM import successful'));"
integration-tests:
runs-on: ubuntu-latest
needs: test
services:
ostrichdb:
image: archetype/ostrichdb:latest
ports:
- 8042:8042
options: >-
--health-cmd "curl -f http://localhost:8042/health || exit 1"
--health-interval 30s
--health-timeout 10s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Wait for OstrichDB
run: |
timeout 60s sh -c 'until curl -f http://localhost:8042/health; do sleep 2; done'
- name: Run integration tests
run: npm run test:integration
env:
OSTRICHDB_URL: http://localhost:8042
TEST_JWT_TOKEN: ${{ secrets.TEST_JWT_TOKEN || 'eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAidGVzdF91c2VyXzEyMzQ1IiwgImVtYWlsIjogInRlc3RAZXhhbXBsZS5jb20iLCAiZ2l2ZW5fbmFtZSI6ICJUZXN0IiwgImZhbWlseV9uYW1lIjogIlVzZXIiLCAiaXNzIjogImh0dHBzOi8veW91cmFwcC5raW5kZS5jb20iLCAiYXVkIjogWyJ5b3VyLWFwaSJdLCAiZXhwIjogOTk5OTk5OTk5OSwgImlhdCI6IDE2NDA5MDg4MDB9.fake_signature' }}
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run security audit
run: npm audit --audit-level moderate
- name: Check for vulnerabilities
run: npm audit --audit-level high