Skip to content

test: profile-ms unit harness uses the in-process cache #24

test: profile-ms unit harness uses the in-process cache

test: profile-ms unit harness uses the in-process cache #24

Workflow file for this run

name: "ci"
on:
push:
branches:
- "v3.0"
- "master"
pull_request:
branches:
- "v3.0"
- "master"
# ponytail: conformance needs the full compose stack (nats/kafka/minio/mongo/redis),
# too heavy to run on every push. Trigger it by hand from the Actions tab when needed.
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: "npm"
- run: npm ci
- run: npm run lint
unit:
runs-on: ubuntu-latest
services:
mongo:
image: mongo:7.0
env:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --quiet --eval 'db.runCommand({ ping: 1 }).ok' || exit 1"
--health-interval 5s
--health-timeout 5s
--health-retries 20
redis:
image: redis:7.2
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 20
env:
MONGO_URL: "mongodb://root:password@localhost:27017/?authSource=admin"
REDIS_ENDPOINT: "localhost:6379"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: "npm"
- run: npm ci
- name: Wait for Mongo auth to accept connections
run: |
for i in $(seq 1 30); do
node -e "const {MongoClient}=require('mongodb');new MongoClient(process.env.MONGO_URL,{serverSelectionTimeoutMS:2000}).connect().then(c=>c.close()).then(()=>process.exit(0)).catch(()=>process.exit(1))" && exit 0
sleep 2
done
echo "Mongo never became reachable" && exit 1
- run: npm test
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
context: .
push: false
tags: chat-server:ci
# Manual only: exercises the real request/response contract (auth, sessions,
# push topics, presigned media) against the whole docker-compose.infra.yml
# stack instead of mocks. Needs secrets/topic env vars the compose file reads
# (TOPIC_NEW_MESSAGE etc., S3_*, MONGO_USER/PASSWORD) so it isn't safe to run
# on every PR from a fork.
#
# To run it here, this job would need to:
# 1. `docker compose --env-file deployment/.env.tmpl -f deployment/docker-compose.infra.yml up -d`
# (plus building/starting the chat-server service images themselves,
# which the infra compose file expects to already exist)
# 2. wait for the stack to be healthy (nats-init/minio-init complete)
# 3. `CONFORMANCE_BASE_URL=http://localhost:<gateway-port> npm run test:conformance`
# 4. `docker compose -f deployment/docker-compose.infra.yml down -v`
conformance:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- run: |
echo "See the comments above this job in ci.yml for the manual conformance run steps"
echo "(not implemented here - needs the full compose stack plus built service images)."