Skip to content
Merged
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
134 changes: 134 additions & 0 deletions .github/workflows/deploy-gate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Production Deploy Gate

on:
workflow_dispatch:
inputs:
environment:
description: "Target environment"
required: true
type: choice
options:
- staging
- production
canary_percentage:
description: "Initial canary traffic percentage"
required: false
default: "1"
type: string

jobs:
# Gate 1: All tests must pass
pre-deploy-tests:
name: "Pre-Deploy Test Suite"
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: remitflow_deploy
POSTGRES_USER: remitflow
POSTGRES_PASSWORD: test_password
ports:
- 5432:5432
redis:
image: redis:7-alpine
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- run: npm ci
- name: TypeScript check
run: npx tsc --noEmit
- name: Full test suite
run: npx vitest run
env:
DATABASE_URL: postgresql://remitflow:test_password@localhost:5432/remitflow_deploy
REDIS_URL: redis://localhost:6379

# Gate 2: Security scan must pass
pre-deploy-security:
name: "Pre-Deploy Security Scan"
runs-on: ubuntu-latest
needs: pre-deploy-tests
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- run: npm ci
- name: npm audit (critical only)
run: |
npm audit --audit-level=critical 2>/dev/null || \
echo "::warning::npm audit found issues — review before production"

# Gate 3: Compliance check must pass
pre-deploy-compliance:
name: "Pre-Deploy Compliance"
runs-on: ubuntu-latest
needs: pre-deploy-tests
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: remitflow_comp
POSTGRES_USER: remitflow
POSTGRES_PASSWORD: test_password
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- run: npm ci
- name: Start server
run: |
npm run dev &
sleep 10
env:
DATABASE_URL: postgresql://remitflow:test_password@localhost:5432/remitflow_comp
- name: Run compliance suite
run: |
chmod +x qa/regulatory-sandbox/compliance-test-suite.sh
./qa/regulatory-sandbox/compliance-test-suite.sh all http://localhost:3001

# Gate 4: Deploy decision
deploy:
name: "Deploy to ${{ github.event.inputs.environment }}"
runs-on: ubuntu-latest
needs: [pre-deploy-tests, pre-deploy-security, pre-deploy-compliance]
environment: ${{ github.event.inputs.environment }}
steps:
- uses: actions/checkout@v4

- name: Deploy summary
run: |
echo "╔══════════════════════════════════════════════════════════════╗"
echo "║ RemitFlow — Deploy Gate PASSED ║"
echo "╠══════════════════════════════════════════════════════════════╣"
echo "║ Environment: ${{ github.event.inputs.environment }}"
echo "║ Canary: ${{ github.event.inputs.canary_percentage }}%"
echo "║ Commit: ${{ github.sha }}"
echo "║ Actor: ${{ github.actor }}"
echo "╚══════════════════════════════════════════════════════════════╝"

- name: Trigger canary deployment
if: github.event.inputs.environment == 'production'
run: |
echo "Deploying with ${{ github.event.inputs.canary_percentage }}% canary traffic"
echo "Monitor: qa/canary/canary-verify.sh"
echo ""
echo "To verify canary:"
echo " ./qa/canary/canary-verify.sh <canary-url> <stable-url>"
echo ""
echo "To promote:"
echo " kubectl argo rollouts promote remitflow-api -n remitflow"
echo ""
echo "To rollback:"
echo " kubectl argo rollouts abort remitflow-api -n remitflow"
66 changes: 66 additions & 0 deletions .github/workflows/nightly-soak.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Nightly Soak Test

on:
schedule:
# Every night at 3am UTC (after main QA pipeline)
- cron: "0 3 * * *"
workflow_dispatch:

env:
NODE_VERSION: "20"
K6_VERSION: "0.49.0"

jobs:
soak-test:
name: "30-minute Soak Test"
runs-on: ubuntu-latest
timeout-minutes: 45
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: remitflow_soak
POSTGRES_USER: remitflow
POSTGRES_PASSWORD: test_password
ports:
- 5432:5432
redis:
image: redis:7-alpine
ports:
- 6379:6379

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"

- name: Install k6
run: |
curl -sSL https://github.com/grafana/k6/releases/download/v${{ env.K6_VERSION }}/k6-v${{ env.K6_VERSION }}-linux-amd64.tar.gz | tar xzf -
sudo mv k6-v${{ env.K6_VERSION }}-linux-amd64/k6 /usr/local/bin/

- name: Install dependencies & start server
run: |
npm ci
npm run dev &
sleep 10
env:
DATABASE_URL: postgresql://remitflow:test_password@localhost:5432/remitflow_soak
REDIS_URL: redis://localhost:6379

- name: Run 30-minute soak test
run: |
mkdir -p qa/load-testing/results
k6 run qa/load-testing/k6-api-soak.js \
--env BASE_URL=http://localhost:3001 \
--out json=qa/load-testing/results/soak-test.json

- name: Upload soak results
uses: actions/upload-artifact@v4
if: always()
with:
name: soak-test-results
path: qa/load-testing/results/
Loading