name: Build and Test
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
build-bun:
name: Build with Bun
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Build project
run: bun run build
- name: Check build output
run: |
if [ ! -f dist/index.js ]; then
echo "Build failed - dist/index.js not found"
exit 1
fi
echo "Build successful"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-bun
path: dist/
build-node:
name: Build with Node.js
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- name: Check build output
run: |
if [ ! -f dist/index.js ]; then
echo "Build failed - dist/index.js not found"
exit 1
fi
echo "Build successful"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-node-${{ matrix.node-version }}
path: dist/
lint:
name: Lint TypeScript
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: npm install
- name: Check TypeScript compilation
run: npx tsc --noEmit
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: npm install
- name: Run npm audit
run: npm audit --audit-level=high
continue-on-error: true