| name | deepgram-ci-integration |
| description | Configure Deepgram CI/CD integration for automated testing and deployment.
Use when setting up continuous integration pipelines, automated testing,
or deployment workflows for Deepgram integrations.
Trigger with phrases like "deepgram CI", "deepgram CD", "deepgram pipeline",
"deepgram github actions", "deepgram automated testing".
|
| allowed-tools | Read, Write, Edit, Bash(gh:*), Bash(curl:*) |
| version | 1.0.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
Deepgram CI Integration
Overview
Set up continuous integration and deployment pipelines for Deepgram integrations.
Prerequisites
- CI/CD platform access (GitHub Actions, GitLab CI, etc.)
- Deepgram API key for testing
- Secret management configured
- Test fixtures prepared
Instructions
Step 1: Configure Secrets
Store API keys securely in CI/CD environment.
Step 2: Create Test Workflow
Set up automated testing on push/PR.
Step 3: Add Integration Tests
Implement Deepgram-specific integration tests.
Step 4: Configure Deployment
Set up automated deployment pipeline.
Output
- CI workflow configuration
- Automated test suite
- Deployment pipeline
- Secret management
Examples
GitHub Actions Workflow
name: Deepgram CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
env:
NODE_VERSION: '20'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm test
- name: Run integration tests
[, ]
[]
GitLab CI Configuration
stages:
- test
- build
- deploy
variables:
NODE_VERSION: "20"
.node-template:
image: node:${NODE_VERSION}
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
unit-tests:
extends: .node-template
stage: test
script:
- npm ci
- npm test
coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+)/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
integration-tests:
extends: .node-template
stage: test
variables:
DEEPGRAM_API_KEY: ${DEEPGRAM_API_KEY}
script:
- npm ci
- npm
Integration Test Suite
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import { createClient, DeepgramClient } from '@deepgram/sdk';
describe('Deepgram Integration Tests', () => {
let client: DeepgramClient;
beforeAll(() => {
const apiKey = process.env.DEEPGRAM_API_KEY;
if (!apiKey) {
throw new Error('DEEPGRAM_API_KEY not set');
}
client = createClient(apiKey);
});
describe('API Connectivity', () => {
it('should connect to Deepgram API', async () => {
const { result, error } = await client.manage.getProjects();
expect(error).toBeNull();
expect(result).toBeDefined();
});
});
describe('Pre-recorded Transcription', () => {
it('should transcribe audio from URL', async () => {
const { result, error } = client...(
{ : },
{ : , : }
);
(error).();
(result).();
(result..[].[].).();
}, );
(, () => {
{ result, error } = client...(
{ : },
{ : , : }
);
(error).();
(result..[].).();
}, );
});
(, {
(, () => {
{ error } = client...(
{ : },
{ : }
);
(error).();
});
});
});
Smoke Test Script
import { createClient } from '@deepgram/sdk';
async function smokeTest(): Promise<void> {
console.log('Running Deepgram smoke test...');
const apiKey = process.env.DEEPGRAM_API_KEY;
if (!apiKey) {
throw new Error('DEEPGRAM_API_KEY not set');
}
const client = createClient(apiKey);
console.log('Testing API connectivity...');
const { error: connectError } = await client.manage.getProjects();
if (connectError) {
throw new Error(`API connectivity failed: ${connectError.message}`);
}
console.log(' API connectivity OK');
console.log('Testing transcription...');
const { result, error: transcribeError } = await client.listen..(
{ : },
{ : , : }
);
(transcribeError) {
();
}
transcript = result..[].[].;
(!transcript || transcript. < ) {
();
}
.();
.();
}
()
.( process.())
.( {
.(, error.);
process.();
});
Package.json Scripts
{
"scripts": {
"test": "vitest run",
"test:watch": "vitest",
"test:integration": "vitest run --config vitest.integration.config.ts",
"test:deepgram": "vitest run tests/integration/deepgram.test.ts",
"smoke-test": "tsx scripts/smoke-test.ts",
"lint": "eslint src --ext .ts",
"typecheck": "tsc --noEmit",
"build": "tsc",
"deploy:staging": "npm run build && ./scripts/deploy.sh staging",
"deploy:production": "npm run build && ./scripts/deploy.sh production"
}
}
Secret Rotation in CI
name: Rotate Deepgram Keys
on:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch:
jobs:
rotate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Rotate API key
env:
DEEPGRAM_ADMIN_KEY: ${{ secrets.DEEPGRAM_ADMIN_KEY }}
DEEPGRAM_PROJECT_ID: ${{ secrets.DEEPGRAM_PROJECT_ID }}
GH_TOKEN: ${{ secrets.GH_PAT }}
run: |
# Create new key
NEW_KEY=$(curl -s -X POST \
"https://api.deepgram.com/v1/projects/$DEEPGRAM_PROJECT_ID/keys" \
-H "Authorization: Token $DEEPGRAM_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{"comment": "CI Key - rotated", "scopes": ["usage:write"]}' \
| jq -r '.key')
gh secret set DEEPGRAM_API_KEY --body "$NEW_KEY"
echo
Resources
Next Steps
Proceed to deepgram-deploy-integration for deployment configuration.