Skip to content

fix(messages): emit Socket.io newMessage on user-message POST #842

fix(messages): emit Socket.io newMessage on user-message POST

fix(messages): emit Socket.io newMessage on user-message POST #842

Workflow file for this run

name: Tests
on:
push:
branches: [ main, v1.0.x ]
pull_request:
branches: [ main, v1.0.x ]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test & Coverage
runs-on: ubuntu-latest
env:
JWT_SECRET: test-jwt-secret
SENDGRID_API_KEY: fake-api-key
SENDGRID_FROM_EMAIL: test@example.com
FRONTEND_URL: http://localhost:3000
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install dependencies
run: |
npm ci --include=dev
cd backend
npm ci --include=dev
cd ../frontend
npm install --legacy-peer-deps
cd ../commonly-mcp
npm ci --include=dev
cd ..
- name: Backend TypeScript check
run: |
cd backend
npm run tsc:check
- name: Run backend tests with coverage
run: |
cd backend
npx jest --coverage --forceExit
- name: Run frontend tests with coverage
run: |
cd frontend
npx jest --coverage --watchAll=false --forceExit
- name: Run commonly-mcp tests
run: |
cd commonly-mcp
npm test
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: backend/coverage/
service-test:
name: Service Tests (Tier 1 — real DBs)
runs-on: ubuntu-latest
needs: test
services:
mongo:
image: mongo:7
ports: ["27017:27017"]
options: >-
--health-cmd "mongosh --eval 'db.runCommand(\"ping\").ok'"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: postgres:16
ports: ["5432:5432"]
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: commonly-test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
JWT_SECRET: test-jwt-secret
SENDGRID_API_KEY: fake-api-key
SENDGRID_FROM_EMAIL: test@example.com
FRONTEND_URL: http://localhost:3000
INTEGRATION_TEST: "true"
MONGO_URI: mongodb://localhost:27017/commonly-test
PG_HOST: localhost
PG_PORT: "5432"
PG_DATABASE: commonly-test
PG_USER: postgres
PG_PASSWORD: postgres
PG_SSL_ENABLED: "false"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install backend dependencies
run: cd backend && npm ci --include=dev
- name: Run service tests (Tier 1)
run: |
cd backend
npx jest --testPathPattern="__tests__/service" --forceExit --runInBand
chart-lint:
name: Chart Lint (Tier 1.5)
runs-on: ubuntu-latest
env:
# Pin CRD schemas to a known commit to avoid drift.
# Update manually by running: gh api /repos/datreeio/CRDs-catalog/commits/main --jq .sha
CRDS_CATALOG_SHA: 15e9b72701ce617b0ac15da611a7fb2e54b980dd
KUBECONFORM_VERSION: v0.7.0
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Helm
uses: azure/setup-helm@v4
with:
version: v3.14.0
- name: Install kubeconform
run: |
curl -sSL "https://github.com/yannh/kubeconform/releases/download/${KUBECONFORM_VERSION}/kubeconform-linux-amd64.tar.gz" -o kc.tgz
sudo tar -xzf kc.tgz -C /usr/local/bin/ kubeconform
kubeconform -v
- name: Render and lint dev chart
run: |
helm template commonly-dev k8s/helm/commonly \
-f k8s/helm/commonly/values.yaml \
-f k8s/helm/commonly/values-dev.yaml \
| kubeconform --strict --summary -output text \
--schema-location "https://raw.githubusercontent.com/datreeio/CRDs-catalog/${CRDS_CATALOG_SHA}/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json" \
--schema-location default
- name: Render and lint prod chart (if values-prod.yaml exists)
run: |
if [ -f k8s/helm/commonly/values-prod.yaml ]; then
helm template commonly-prod k8s/helm/commonly \
-f k8s/helm/commonly/values.yaml \
-f k8s/helm/commonly/values-prod.yaml \
| kubeconform --strict --summary -output text \
--schema-location "https://raw.githubusercontent.com/datreeio/CRDs-catalog/${CRDS_CATALOG_SHA}/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json" \
--schema-location default
else
echo "values-prod.yaml not present yet (lands in ADR-009 Phase 5); skipping prod lint."
fi