Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI/CD

on:
pull_request:
branches: [dev, master]
push:
branches: [dev, master]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x, 22.x]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Cache node_modules
uses: actions/cache@v4
with:
path: |
node_modules
~/.npm
key: ${{ runner.os }}-node-${{ matrix.node-version }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node-version }}-npm-
${{ runner.os }}-node-${{ matrix.node-version }}-

- name: Install dependencies
run: npm ci

- name: Security audit
run: npm audit --audit-level moderate
continue-on-error: true

- name: Build project
run: npm run build

- name: Run tests
run: npm test
env:
AGILITY_GUID: ${{ secrets.AGILITY_GUID }}
AGILITY_FETCH_API_KEY: ${{ secrets.AGILITY_FETCH_API_KEY }}
AGILITY_PREVIEW_API_KEY: ${{ secrets.AGILITY_PREVIEW_API_KEY }}
AGILITY_BASE_URL: ${{ secrets.AGILITY_BASE_URL }}

- name: Cache build artifacts
uses: actions/cache@v4
with:
path: dist
key: ${{ runner.os }}-build-${{ matrix.node-version }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-${{ matrix.node-version }}-


2 changes: 2 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ esbuild.build({
bundle: true,
outfile: './dist/browser.js',
platform: 'browser',
format: 'esm',
}).catch(() => process.exit(1));

// Build for Node.js
Expand All @@ -21,4 +22,5 @@ esbuild.build({
bundle: true,
outfile: './dist/node.js',
platform: 'node',
format: 'cjs',
}).catch(() => process.exit(1));
19 changes: 19 additions & 0 deletions jest.integration.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const baseConfig = require('./jest.config.js');

// Suppress dotenv logs before any tests run
process.env.DOTENV_CONFIG_SILENT = 'true';

module.exports = {
...baseConfig,
displayName: 'Integration Tests',
testMatch: [
'<rootDir>/test/integration/**/*.integration.test.ts',
'<rootDir>/test/integration/**/*.integration.test.js'
],
testTimeout: 30000, // Integration tests can be slower
setupFilesAfterEnv: [
'<rootDir>/test/integration/setup.ts'
],
// Don't collect coverage for integration tests
collectCoverage: false
};
26 changes: 26 additions & 0 deletions jest.unit.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const baseConfig = require('./jest.config.js');

module.exports = {
...baseConfig,
displayName: 'Unit Tests',
testMatch: [
'<rootDir>/test/unit/**/*.test.ts',
'<rootDir>/test/unit/**/*.test.js'
],
testTimeout: 5000, // Unit tests should be fast
collectCoverageFrom: [
'src/**/*.{ts,js}',
'!src/**/*.d.ts',
'!src/types/generated/**',
'!**/node_modules/**'
],
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80
}
}
};

Loading