Skip to content

chore: CLI-only passthrough architecture + version 2.2.0 #86

chore: CLI-only passthrough architecture + version 2.2.0

chore: CLI-only passthrough architecture + version 2.2.0 #86

Workflow file for this run

name: CI
on:
push:
branches: [ main, master ]
paths-ignore:
- '**.md'
- 'docs/**'
- '.gitignore'
- 'LICENSE'
pull_request:
branches: [ main, master ]
paths-ignore:
- '**.md'
- 'docs/**'
- '.gitignore'
- 'LICENSE'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.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: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint
- name: Run typecheck
run: npm run typecheck
- name: Run tests
run: npm test
- name: Run test coverage
run: npm run test:coverage
- name: Check coverage threshold
run: |
# Extract coverage percentage from report and fail if below threshold
COVERAGE=$(npm run test:coverage 2>&1 | grep "All files" | awk '{print $4}' | sed 's/%//')
echo "Coverage: $COVERAGE%"
if (( $(echo "$COVERAGE < 65" | bc -l) )); then
echo "❌ Coverage $COVERAGE% is below minimum threshold of 65%"
exit 1
fi
echo "✅ Coverage $COVERAGE% meets minimum threshold of 65%"
build:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build CLI
run: npm run build
- name: Test CLI basic functionality (Node.js 20.x)
run: |
# Test basic CLI functionality
node dist/cli.js --version
node dist/cli.js --help
- name: Test CLI with Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: 'npm'
- name: Test CLI basic functionality (Node.js 18.x)
run: |
# Test basic CLI functionality on Node.js 18.x
node dist/cli.js --version
node dist/cli.js --help
test-binary-build:
runs-on: ubuntu-latest
needs: test
# Only test binary building on main/master pushes and PRs
if: github.event_name == 'pull_request' || (github.event_name == 'push' && contains(github.ref, 'refs/heads/main'))
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Test binary build process
run: |
npm run build
# Test bundling
npx esbuild src/cli.ts \
--bundle \
--platform=node \
--target=node18 \
--outfile=dist/cli-bundled.js \
--banner:js="#!/usr/bin/env node"
# Test bundled CLI
node dist/cli-bundled.js --version
node dist/cli-bundled.js --help
# Test binary creation (Linux only for CI speed)
mkdir -p dist/binaries
npx pkg dist/cli-bundled.js \
--targets node18-linux-x64 \
--output dist/binaries/capiscio-linux-x64
# Test created binary
chmod +x dist/binaries/capiscio-linux-x64
./dist/binaries/capiscio-linux-x64 --version
./dist/binaries/capiscio-linux-x64 --help
security:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run security audit
run: |
# Check production dependencies (block high/critical only)
npm audit --audit-level high --omit=dev
# Check dev dependencies (block high/critical only)
npm audit --audit-level high --include=dev