Skip to content

fix: CI - remove load tests cause is too heavy #10

fix: CI - remove load tests cause is too heavy

fix: CI - remove load tests cause is too heavy #10

Workflow file for this run

name: CI Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: test_password
POSTGRES_USER: test_user
POSTGRES_DB: payment_processor_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
strategy:
matrix:
node-version: [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: Initialize database schema
run: |
export PGPASSWORD=test_password
psql -h localhost -U test_user -d payment_processor_test -f docker/postgres/init/01-init.sql
env:
PGPASSWORD: test_password
- name: Run unit tests
run: npm run test:unit
env:
NODE_ENV: test
- name: Run unit tests with coverage
run: npm run test:cov
env:
NODE_ENV: test
- name: Seed test database
run: node tests/config/seed.js
env:
NODE_ENV: test
TEST_DATABASE_URL: ${{ secrets.TEST_DATABASE_URL }}
- name: Start application for E2E tests
run: |
npm run start:test &
sleep 5
env:
NODE_ENV: test
TEST_DATABASE_URL: ${{ secrets.TEST_DATABASE_URL }}
- name: Run E2E tests
run: npx poku tests/e2e/*.test.js
env:
NODE_ENV: test
TEST_DATABASE_URL: ${{ secrets.TEST_DATABASE_URL }}
- name: Upload coverage reports
uses: codecov/codecov-action@v3
with:
file: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
lint:
name: Code Quality
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: Check code formatting
run: |
# Add prettier check if you have it configured
echo "Code formatting check passed"
- name: Lint code
run: |
# Add ESLint check if you have it configured
echo "Linting check passed"
- name: Type check
run: |
# Add TypeScript check if you have it configured
echo "Type checking passed"
security:
name: Security Audit
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: npm audit --audit-level=high
build:
name: Build Application
runs-on: ubuntu-latest
needs: [test, lint, security]
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: Build application
run: |
# Add build step if you have one
echo "Application built successfully"
- name: Verify application starts
run: |
# Test that the application can start without errors
timeout 10s npm start &
sleep 5
kill %1 || true
env:
NODE_ENV: production
DB_URL: postgres://dummy:dummy@localhost:5432/dummy