name: CI on: push: branches: ['**'] pull_request: schedule: - cron: '17 4 * * *' permissions: contents: read concurrency: group: ci-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: backend: if: github.event_name != 'schedule' name: Backend runs-on: ubuntu-latest timeout-minutes: 45 services: postgres: image: timescale/timescaledb@sha256:22e8a5ae7aef121d1537afe946dd7cc5deeeb63ab36ce19849d671bd3b663509 env: POSTGRES_PASSWORD: analysis-test-password ports: - 55433:5432 options: >- --shm-size=1g --health-cmd "pg_isready -U postgres" --health-interval 5s --health-timeout 3s --health-retries 10 redis: image: redis@sha256:8b81dd37ff027bec4e516d41acfbe9fe2460070dc6d4a4570a2ac5b9d59df065 ports: - 6379:6379 options: >- --health-cmd "redis-cli ping" --health-interval 5s --health-timeout 3s --health-retries 10 env: TEST_REDIS_URL: redis://127.0.0.1:6379 TEST_ANALYSIS_DATABASE_URL: postgresql://postgres:analysis-test-password@127.0.0.1:55433/postgres TEST_OWNER_ACL_DATABASE_URL: postgresql://postgres:analysis-test-password@127.0.0.1:55433/postgres TEST_VACUUM_DATABASE_URL: postgresql://postgres:analysis-test-password@127.0.0.1:55433/postgres TEST_INGEST_DATABASE_URL: postgresql://postgres:analysis-test-password@127.0.0.1:55433/postgres TEST_OWNER_DATABASE_URL: postgresql://postgres:analysis-test-password@127.0.0.1:55433/meshcore_owner_auth_ci TEST_STATUS_DATABASE_URL: postgresql://postgres:analysis-test-password@127.0.0.1:55433/postgres TEST_SAMPLE_DATABASE_URL: postgresql://postgres:analysis-test-password@127.0.0.1:55433/postgres defaults: run: working-directory: backend steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7 with: node-version-file: .nvmrc cache: npm cache-dependency-path: backend/package-lock.json - run: npm ci # These fakes use the backend MQTT package and never start the DEV stack. - name: Verify DEV startup and broker protection working-directory: . timeout-minutes: 8 run: | python3 -B -m unittest discover -s scripts/full-dev/qualification -p 'test_*.py' -v python3 -B -m unittest discover -s scripts/full-dev/ui -p 'test_*.py' -v node --test scripts/full-dev/replay/disk-reserve.test.mjs scripts/full-dev/alert-bootstrap.test.mjs node --test scripts/local-sample/broker-quiescence.test.mjs scripts/local-sample/broker-quiescence-coherent.test.mjs - name: Check package and local image release identity run: node ../scripts/check-release-identity.mjs - name: Check living documentation without executing runbooks run: node --test ../scripts/check-docs.test.mjs && node ../scripts/check-docs.mjs - name: Audit backend dependencies run: npm audit --audit-level=high - run: npm run typecheck - run: npm run test:external-consumers:sql - run: npm run contract:check - name: Verify shared contract adapters run: node ../scripts/generate-shared-contracts.mjs --check && node --test ../scripts/generate-shared-contracts.test.mjs - name: Configure bounded Redis integration fixture run: | node --input-type=module <<'JS' import { Redis } from 'ioredis'; const url = new URL(process.env.TEST_REDIS_URL); if (url.hostname !== '127.0.0.1' || url.port !== '6379') { throw new Error('Only the isolated CI Redis service may be configured'); } const redis = new Redis(url.href); try { await redis.config('SET', 'maxmemory', '128mb'); await redis.config('SET', 'maxmemory-policy', 'noeviction'); } finally { redis.disconnect(); } JS - run: npm test - run: npm run test:owner-integration - name: Analysis integration (fails fast when PostgreSQL is absent) timeout-minutes: 5 run: npm run test:analysis-integration - name: Verify analytics cancellation releases PostgreSQL locks run: node --import tsx --test src/db/analyticsAbort.integration.test.ts - run: npm run test:owner-acl-integration - run: npm run test:vacuum-integration - name: Configure bounded RAM Redis fixture run: | docker exec '${{ job.services.redis.id }}' redis-cli CONFIG SET maxmemory 96mb docker exec '${{ job.services.redis.id }}' redis-cli CONFIG SET maxmemory-policy noeviction - name: Replay the migration band on a fresh base-schema database # Its own gate, ahead of the ingest group: a fresh volume that cannot # reach head is a release blocker, and it must not stay hidden behind an # unrelated suite. run: timeout 300s npm run test:migration-integration - run: npm run test:ingest-integration - name: Verify owner last-hop history refresh against PostgreSQL run: TEST_OWNER_LAST_HOP_DATABASE_URL="$TEST_INGEST_DATABASE_URL" npm run test:owner-last-hop-integration - name: Verify observer replay timestamps run: node --import tsx --test src/db/statusSampleTime.integration.test.ts src/mqtt/statusTelemetry.integration.test.ts - run: timeout 330s npm run test:privacy-integration - name: Run the isolated initial-map visibility integration run: | TEST_MAP_DATABASE_URL="$(node --input-type=module -e 'const url = new URL(process.env.TEST_INGEST_DATABASE_URL); url.pathname = "/map_stale_dedup_scratch"; process.stdout.write(url.href)')" export TEST_MAP_DATABASE_URL node --input-type=module -e 'import pg from "pg"; const url = new URL(process.env.TEST_MAP_DATABASE_URL); url.pathname = "/postgres"; const admin = new pg.Pool({ connectionString: url.href, max: 1 }); try { const found = await admin.query("SELECT 1 FROM pg_database WHERE datname = $1", ["map_stale_dedup_scratch"]); if (!found.rowCount) await admin.query("CREATE DATABASE map_stale_dedup_scratch"); } finally { await admin.end(); }' node --import tsx --test src/ws/initialStateNodes.integration.test.ts - name: Verify both public socket bootstrap formats against PostgreSQL and Redis run: timeout 150s node --import tsx --test src/ws/initialStateFormats.integration.test.ts - name: Prove 074 is superseded only on post-move databases run: timeout 240s npm run test:migration-supersession - name: Qualify synthetic sample loading against the complete migrated schema run: timeout 240s npm run test:sample-integration - name: Qualify node and timeline delivery and region repair across privacy changes run: timeout 240s node --import tsx --test --test-concurrency=1 src/api/routes/nodePrivacy.integration.test.ts src/api/routes/activityTimeline.integration.test.ts src/repositories/nodeLookup.integration.test.ts src/repositories/pathEvidence.integration.test.ts src/regions/snapshotRefresh.integration.test.ts - name: Verify broker enrollment and existing TCP sessions across reloads run: | ../scripts/test-enrollment-broker.sh node scripts/test-enrollment-continuity.mjs - name: Qualify broker framing and bounded offline replay run: ../scripts/test-mqtt-broker-fixture.sh - run: npm run build - run: npm run test:ram-operational db-audit: # The three `*.audit.test.ts` files added in #195 are real PostgreSQL # regressions that skip themselves when no fixture database is supplied, so # they need a job that fails when they skip instead of passing quietly. # Plain PostgreSQL 16 is deliberate: the audit-high fixture refuses any # database where the timescaledb extension is installed, because the # extension's own `timescaledb_experimental.policies` view trips its # stray-table guard. name: Database Audit Tests runs-on: ubuntu-latest timeout-minutes: 10 services: postgres: image: postgres@sha256:5db6dac2ef5dcff512f4f00a009c3c332b9f2f28f24277175bf3e4a3d02ef83a env: POSTGRES_PASSWORD: audit-fixture-password ports: - 5432 options: >- --shm-size=1g --health-cmd "pg_isready -U postgres" --health-interval 5s --health-timeout 3s --health-retries 10 env: AUDIT_TEST_FILES: >- src/db/identity-decryptions.audit.test.ts src/tools/backfillIdentity.audit.test.ts src/tools/backfillIdentity.audit-high.test.ts defaults: run: working-directory: backend steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7 with: node-version-file: .nvmrc cache: npm cache-dependency-path: backend/package-lock.json - run: npm ci --no-audit --no-fund - name: Select the owned audit database port env: AUDIT_DATABASE_PORT: ${{ job.services.postgres.ports[5432] }} run: | test -n "$AUDIT_DATABASE_PORT" printf 'TEST_INGEST_DATABASE_URL=postgresql://postgres:audit-fixture-password@127.0.0.1:%s/postgres\n' "$AUDIT_DATABASE_PORT" >> "$GITHUB_ENV" printf 'TEST_BACKFILL_DATABASE_URL=postgresql://postgres:audit-fixture-password@127.0.0.1:%s/postgres\n' "$AUDIT_DATABASE_PORT" >> "$GITHUB_ENV" - name: Verify the audit fixture database is reachable run: | node --input-type=module <<'JS' import pg from 'pg'; for (const name of ['TEST_INGEST_DATABASE_URL', 'TEST_BACKFILL_DATABASE_URL']) { const value = process.env[name]; if (!value) throw new Error(`${name} is not set for the audit job`); const url = new URL(value); if (!['127.0.0.1', 'localhost', '::1', '[::1]'].includes(url.hostname)) { throw new Error(`${name} must point at the loopback fixture database`); } const pool = new pg.Pool({ connectionString: value, max: 1 }); try { const { rows } = await pool.query('SHOW server_version'); // Host, port and database only: the fixture password is never printed. console.log(`${name} -> ${url.hostname}:${url.port}${url.pathname} PostgreSQL ${rows[0].server_version}`); } finally { await pool.end(); } } JS - name: Run the database-backed audit tests run: | missing=0 for file in $AUDIT_TEST_FILES; do if [ ! -f "$file" ]; then echo "::error file=$file::audit test is missing — it lands with PR #195" missing=1 fi done [ "$missing" -eq 0 ] || exit 1 failed=0 for file in $AUDIT_TEST_FILES; do label="$(basename "$file" .ts)" if ! node --import tsx --test --test-reporter=tap "$file" | tee "audit-${label}.tap"; then failed=1 fi # A skipped audit test means the fixture database was not usable; # treat that as a failure rather than a green run. node scripts/assert-audit-tests-ran.mjs "audit-${label}.tap" "$file" || failed=1 done exit "$failed" - name: Preserve audit test output if: failure() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 with: name: db-audit-tap-${{ github.run_id }}-${{ github.run_attempt }} path: backend/audit-*.tap if-no-files-found: ignore retention-days: 7 identity-backfill: # `backfillIdentity.compressed.test.ts` builds a real hypertable with a # compressed chunk and drives the shipped CLI; plain PostgreSQL cannot stand # in for chunk compression. The file skips itself when no fixture is # supplied, so this job provides TimescaleDB and treats a skip as a failure. name: Identity Backfill (TimescaleDB) runs-on: ubuntu-latest timeout-minutes: 20 services: postgres: image: timescale/timescaledb@sha256:22e8a5ae7aef121d1537afe946dd7cc5deeeb63ab36ce19849d671bd3b663509 env: POSTGRES_PASSWORD: identity-backfill-password ports: - 55435:5432 options: >- --shm-size=1g --health-cmd "pg_isready -U postgres" --health-interval 5s --health-timeout 3s --health-retries 10 env: TEST_BACKFILL_DATABASE_URL: postgresql://postgres:identity-backfill-password@127.0.0.1:55435/postgres defaults: run: working-directory: backend steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7 with: node-version-file: .nvmrc cache: npm cache-dependency-path: backend/package-lock.json - run: npm ci --no-audit --no-fund - name: Run the TimescaleDB identity-backfill suite run: | timeout 180s node --import tsx --test --test-reporter=tap \ src/tools/backfillIdentity.compressed.test.ts | tee identity-backfill.tap node scripts/assert-audit-tests-ran.mjs \ identity-backfill.tap \ src/tools/backfillIdentity.compressed.test.ts \ --min-tests=15 - name: Preserve identity-backfill output if: failure() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 with: name: identity-backfill-tap-${{ github.run_id }}-${{ github.run_attempt }} path: backend/identity-backfill.tap if-no-files-found: ignore retention-days: 7 frontend: if: github.event_name != 'schedule' name: Frontend runs-on: ubuntu-latest defaults: run: working-directory: frontend steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7 with: node-version-file: .nvmrc cache: npm cache-dependency-path: frontend/package-lock.json - run: npm ci - name: Audit frontend dependencies run: npm audit --audit-level=high - run: npm test - run: npm run lint:css - name: Enforce both deployed frontend artifact budgets run: | VITE_BUILD_TARGET=app VITE_APP_HOSTNAME=app.ukmesh.com VITE_SITE=ukmesh VITE_NETWORK=ukmesh VITE_RF_COVERAGE_ENABLED=true npm run build npm run budget VITE_BUILD_TARGET=public-website VITE_APP_HOSTNAME=app.ukmesh.com VITE_SITE=ukmesh npm run build npm run budget - name: Install Chromium for public Lighthouse checks run: | sudo bash ../scripts/ci-ubuntu-https.sh python ../scripts/ci-retry.py apt npx --no-install playwright install-deps chromium npx --no-install playwright install chromium - name: Enforce public Lighthouse navigation budgets run: npm run lighthouse:ci - name: Retain Lighthouse reports if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: name: lighthouse-public-${{ github.run_id }}-${{ github.run_attempt }} path: frontend/test-results/lighthouse-ci if-no-files-found: ignore retention-days: 7 workers-and-compose: if: github.event_name != 'schedule' name: Workers and Compose runs-on: ubuntu-latest env: POSTGRES_USER: meshcore POSTGRES_PASSWORD: ci-postgres-password ALERT_RECEIVER_TOKEN: ci-alert-receiver-token-0123456789abcdef HEALTHCHECK_TEST_CHANNEL_SECRET: 0123456789abcdef0123456789abcdef REDIS_PASSWORD: ci-redis-password JWT_SECRET: ci-test-only-ci-test-only-ci-test-only-ci-test-only OPERATOR_SITE_TOKEN: ci-operator-site-token-0123456789abcdef0123456789abcdef MQTT_USERNAME: backend MQTT_PASSWORD: ci-mqtt-password ANUBIS_ED25519_PRIVATE_KEY_HEX: '0000000000000000000000000000000000000000000000000000000000000001' DATA_LIFECYCLE_RECEIPT_VERIFY_KEY_SHA256: '0000000000000000000000000000000000000000000000000000000000000000' GRAFANA_ADMIN_PASSWORD: ci-grafana-password SOURCE_REVISION: ${{ github.sha }} MOSQUITTO_IMAGE: eclipse-mosquitto@sha256:9cfdd46ad59f3e3e5f592f6baf57ab23e1ad00605509d0f5c1e9b179c5314d87 BUILDKIT_PROGRESS: plain steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7 with: node-version-file: .nvmrc - name: Validate release security waivers run: node scripts/check-trivy-waivers.mjs - name: Check out the pinned Health Check source run: | git submodule update --init -- third_party/meshcore-health-check revision=$(bash scripts/healthcheck-source.sh --verify) printf 'HEALTHCHECK_SOURCE_REF=%s\n' "$revision" >> "$GITHUB_ENV" - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7 with: python-version: '3.12' - name: Check release and monitoring ownership run: | python -m pip install -r scripts/requirements-checks.txt python -m unittest discover -s scripts -p test_ops_contracts.py -v scripts/check-release-components.sh python scripts/check-ops-contracts.py --monitoring --queue-defaults - name: Check PostgreSQL shared-memory inventory run: | python -m pip install -r scripts/requirements-checks.txt python -m unittest discover -s scripts -p 'test_postgres_shm.py' -v python scripts/check-postgres-shm.py - name: Check the local DEV memory and log policy run: | python -B -m unittest discover -s scripts/full-dev -p 'test_*.py' -v python -B -m unittest discover -s scripts/full-dev/lan -p test_policy.py -v node --test scripts/full-dev/lan/site/status.test.mjs - name: Test operator scripts working-directory: scripts run: | npm ci npm audit --audit-level=high npm run typecheck npm test - name: Test forecast publication with synthetic weather fields run: | python -m pip install -r tropo-worker/requirements.txt python -B -m unittest discover -s tropo-worker -v - name: Compile Python workers run: python -m py_compile viewshed-worker/worker.py viewshed-worker/link_queue_v3.py viewshed-worker/viewshed_queue_v2.py viewshed-worker/backfill_profiles.py viewshed-worker/rf/*.py - name: Test CI network retries run: python -m unittest discover -s scripts -p test_ci_retry.py -v - name: Test live owner baseline activation run: python -B scripts/test_owner_baseline_promote.py - name: Pull build and test images with bounded retries run: | # Some services reuse an image built by a different service. Exclude # those local aliases as well as services with their own build block. images="$(docker compose \ -f docker-compose.yml -f docker-compose.ci.yml --profile dev \ config --format json | python -c ' import json, sys services = json.load(sys.stdin)["services"].values() built = {service["image"] for service in services if "build" in service} print("\n".join(sorted({service["image"] for service in services} - built))) ')" while IFS= read -r image; do python scripts/ci-retry.py pull docker pull "$image" done <<<"$images" # Preload every external FROM image, including multi-stage builds. # BuildKit can still request metadata; the build wrapper covers that. while IFS= read -r image; do python scripts/ci-retry.py pull docker pull "$image" done < <(awk 'toupper($1) == "FROM" && $2 != "scratch" { print $2 }' \ Dockerfile Dockerfile.backend Dockerfile.app Dockerfile.website \ Dockerfile.mesh-health-check Dockerfile.mosquitto-reloader \ viewshed-worker/Dockerfile tagger-worker/Dockerfile \ third_party/hopreach/Dockerfile | sort -u) - name: Build worker images run: python scripts/ci-retry.py build docker build --build-arg USE_AZURE_UBUNTU_MIRROR=true -f viewshed-worker/Dockerfile -t meshcore-viewshed-worker:test viewshed-worker - name: Test retained observed-link worker image run: scripts/test-worker-fixtures.sh - name: Bootstrap clean Mosquitto credentials env: MOSQUITTO_CONFIG_DIR: /tmp/meshcore-ci-mosquitto run: | install -d -m 700 "$MOSQUITTO_CONFIG_DIR" cp mosquitto/mosquitto.conf "$MOSQUITTO_CONFIG_DIR/mosquitto.conf" scripts/bootstrap-mosquitto.sh for credential in passwd acl; do mode="$( docker run --rm \ --user 1000:1883 \ --cap-drop ALL \ --entrypoint stat \ -v "$MOSQUITTO_CONFIG_DIR:/mosquitto/config:ro" \ "$MOSQUITTO_IMAGE" \ -c '%a' "/mosquitto/config/$credential" )" test "$mode" = 640 done - name: Validate Compose configuration run: | docker compose -f docker-compose.yml -f docker-compose.ci.yml config --quiet docker compose -f docker-compose.yml -f docker-compose.ci.yml config --format json \ | jq -e ' (.services.timescaledb.command | index("max_worker_processes=24") != null) and (.networks.default.ipam.config[0].ip_range == "172.30.0.128/25")' >/dev/null MQTT_INGEST_MODE=ram MQTT_RAM_BATCH_SIZE=37 \ docker compose -f docker-compose.yml -f docker-compose.ci.yml config --format json \ | jq -e ' .services.backend.environment.MQTT_INGEST_MODE == "ram" and .services["mqtt-ingest"].environment.MQTT_INGEST_MODE == "ram" and .services["mqtt-ingest"].environment.MQTT_RAM_BATCH_SIZE == "37" and .services["mqtt-ingest"].environment.MQTT_RAM_QUEUE_MAX_BYTES == "33554432"' >/dev/null - name: Validate tracked build and Compose inventory run: | scripts/check-release-components.sh while IFS= read -r context; do [[ "$context" == *'$''{{'* ]] && continue test -d "$context" done < <(sed -n 's/^[[:space:]]*context: //p' .github/workflows/release.yml) while IFS= read -r dockerfile; do [[ "$dockerfile" == *'$''{{'* ]] && continue test -f "$dockerfile" done < <(sed -n 's/^[[:space:]]*file: //p' .github/workflows/release.yml) compose_services="$(docker compose -f docker-compose.yml -f docker-compose.ci.yml --profile dev config --services)" for service in \ db-migrate backend mqtt-ingest privacy-remat-worker region-snapshot-worker app-ukmesh website-ukmesh website-dev mesh-health-check \ mosquitto-reloader link-worker link-backfill-worker hopreach \ timescaledb mosquitto; do grep -Fxq "$service" <<<"$compose_services" done - name: Build every application image and smoke an empty-volume stack run: | project="meshcore-ci-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" publisher_user="ci-e2e-publisher" publisher_password="ci-e2e-publisher-password" observer="CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC" cleanup() { status=$? if [ "$status" -ne 0 ]; then docker compose -f docker-compose.yml -f docker-compose.ci.yml --project-name "$project" ps --all || true docker compose -f docker-compose.yml -f docker-compose.ci.yml --project-name "$project" logs --tail 100 backend mqtt-ingest mosquitto alert-receiver alert-forward-sink alert-receiver-bootstrap || true fi } trap cleanup EXIT # Create each Argon2 entry independently. Updating an existing # password file with this image is not reliable on hosted runners. docker run --rm \ --user "$(id -u):$(id -g)" \ -v "$PWD/mosquitto:/mosquitto/config" \ "$MOSQUITTO_IMAGE" \ mosquitto_passwd -b -c /mosquitto/config/.passwd-backend \ "$MQTT_USERNAME" "$MQTT_PASSWORD" docker run --rm \ --user "$(id -u):$(id -g)" \ -v "$PWD/mosquitto:/mosquitto/config" \ "$MOSQUITTO_IMAGE" \ mosquitto_passwd -b -c /mosquitto/config/.passwd-publisher \ "$publisher_user" "$publisher_password" cp mosquitto/.passwd-backend mosquitto/passwd cat mosquitto/.passwd-publisher >>mosquitto/passwd unlink mosquitto/.passwd-backend unlink mosquitto/.passwd-publisher printf 'user %s\ntopic read meshcore/#\ntopic read ukmesh/#\ntopic read meshcore-test/#\ntopic write meshcore/_system/ingest/meshcore-analytics-ingest\n' \ "$MQTT_USERNAME" >mosquitto/acl printf '\nuser %s\ntopic write meshcore-test/CI/%s/packets\ntopic write meshcore-test/CI/%s/status\n' \ "$publisher_user" "$observer" "$observer" >>mosquitto/acl chmod 640 mosquitto/passwd mosquitto/acl scripts/bootstrap-mosquitto.sh python scripts/ci-retry.py build docker build \ --build-arg SOURCE_REVISION="$SOURCE_REVISION" \ --build-arg VITE_APP_HOSTNAME=app.ukmesh.com \ -f Dockerfile -t meshcore-combined:test . # A private checkout must still produce a readable non-root reloader. chmod 0600 docker/mosquitto-reloader.py python scripts/ci-retry.py build docker compose -f docker-compose.yml -f docker-compose.ci.yml \ --project-name "$project" \ --profile dev \ build \ backend app-ukmesh website-ukmesh website-dev mesh-health-check \ mosquitto-reloader link-worker hopreach tagger-worker APP_IMAGE="${BACKEND_IMAGE:-meshcore-analytics-backend:local}" bash scripts/test-dev-external-health.sh bash scripts/test-analytics-snapshot.sh APP_IMAGE="${BACKEND_IMAGE:-meshcore-analytics-backend:local}" bash scripts/test-restore-owner-layouts.sh scripts/test-healthcheck-backup.sh python3 scripts/test-mesh-health-probe.py scripts/test-companion-recovery.sh APP_IMAGE="${BACKEND_IMAGE:-meshcore-analytics-backend:local}" scripts/test-restore-mqtt.sh scripts/test-link-queue-contract.sh scripts/test-ci-db-readiness.sh # The broker may create a fresh log with mode 0600. The separate # API's audit scanner needs group read on the owned smoke stack's file. docker compose -f docker-compose.yml -f docker-compose.ci.yml \ --project-name "$project" up -d --no-build --wait --wait-timeout 90 mosquitto docker compose -f docker-compose.yml -f docker-compose.ci.yml \ --project-name "$project" exec -T --user 0:0 mosquitto sh -ec \ 'chown 1883:1883 /mosquitto/log /mosquitto/log/mosquitto.log; chmod 0750 /mosquitto/log; chmod 0640 /mosquitto/log/mosquitto.log' if ! docker compose -f docker-compose.yml -f docker-compose.ci.yml \ --project-name "$project" \ --profile dev \ up --detach --no-build --scale link-backfill-worker=0 --scale tagger-worker=0 \ --wait --wait-timeout 360; then docker compose -f docker-compose.yml -f docker-compose.ci.yml \ --project-name "$project" logs --no-color --tail=200 timescaledb db-migrate exit 1 fi # Exercise real tagger SQL against the owned database without an external classifier. database_container="$(docker compose -f docker-compose.yml -f docker-compose.ci.yml --project-name "$project" ps -q timescaledb)" docker run --rm --network "container:$database_container" \ --entrypoint python3 \ -e TEST_INGEST_DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@127.0.0.1:5432/meshcore" \ -v "$PWD/tagger-worker:/app/tests:ro" \ meshcore-analytics-tagger-worker:local -m unittest discover -s /app/tests -p test_tagger_candidates.py -v # link-backfill-worker is intentionally a finite job. Running it # separately lets Compose wait for the long-lived stack without # treating this worker's successful exit as a health failure. docker compose -f docker-compose.yml -f docker-compose.ci.yml \ --project-name "$project" \ --profile dev \ run --rm --no-deps link-backfill-worker health_session_id="$( curl --fail --silent --request POST \ --header 'Content-Type: application/json' \ --data '{}' \ http://127.0.0.1:3090/api/sessions \ | jq -er '.id' )" sleep 1 docker compose -f docker-compose.yml -f docker-compose.ci.yml --project-name "$project" exec -T \ -e HEALTH_SESSION_ID="$health_session_id" \ mesh-health-check node --input-type=module <<'NODE' import { readFileSync } from 'node:fs'; const payload = JSON.parse( readFileSync('/app/data/session-results.json', 'utf8'), ); if (!payload.sessions?.some(({ id }) => id === process.env.HEALTH_SESSION_ID)) { throw new Error('health-check session was not persisted by the non-root runtime'); } NODE curl --fail --silent http://127.0.0.1:3000/readyz \ | jq -e '.status == "ready"' >/dev/null curl --fail --silent http://127.0.0.1:3003/ >/dev/null curl --fail --silent http://127.0.0.1:3004/ >/dev/null curl --fail --silent http://127.0.0.1:3003/readyz \ | jq -e '.status == "ready"' >/dev/null curl --fail --silent http://127.0.0.1:3004/readyz \ | jq -e '.status == "ready"' >/dev/null for origin in http://127.0.0.1:3003 http://127.0.0.1:3004; do for path in /metrics /operations /observer-registrations /local-api/operations; do test "$(curl --silent --output /dev/null --write-out '%{http_code}' "${origin}${path}")" = 404 done done backend_metrics="$( docker compose -f docker-compose.yml -f docker-compose.ci.yml --project-name "$project" exec -T backend \ wget -qO- http://127.0.0.1:9091/metrics )" grep -q '^meshcore_process_' <<<"$backend_metrics" docker compose -f docker-compose.yml -f docker-compose.ci.yml --project-name "$project" exec -T \ region-snapshot-worker node --input-type=module <<'NODE' const deadline = Date.now() + 120_000; let healthy = false; while (Date.now() < deadline) { const response = await fetch('http://127.0.0.1:9091/metrics', { signal: AbortSignal.timeout(5000) }); if (/^meshcore_region_snapshot_healthy 1$/m.test(await response.text())) { healthy = true; break; } await new Promise(resolve => setTimeout(resolve, 1000)); } if (!healthy) throw new Error('region snapshot worker did not certify the empty-volume fixture'); NODE MQTT_E2E_OBSERVER="$observer" MQTT_E2E_PUBLISHER="$publisher_user" MQTT_E2E_PASSWORD="$publisher_password" \ scripts/test-compose-data-plane.sh "$project" # The following browser lanes use owned preview servers and API fixtures. # Release the live stack's CPU/RAM after its real data-plane checks, before # software-rendered maps create browser contexts on the shared runner. - name: Clean up live E2E stack if: always() run: | docker compose -f docker-compose.yml -f docker-compose.ci.yml \ --project-name "meshcore-ci-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" \ --profile dev \ down --volumes --remove-orphans - name: Install locked frontend dependencies and Playwright for E2E tests working-directory: frontend run: | npm ci sudo bash ../scripts/ci-ubuntu-https.sh python ../scripts/ci-retry.py apt npx --no-install playwright install-deps chromium npx --no-install playwright install chromium - name: Rehearse browser cache cutover and rollback working-directory: frontend run: npm run test:sw-cutover - name: Rehearse independent DEV route rollback env: TEST_CORESCOPE_APP_EDGE: '1' run: node --test scripts/full-dev/corescope-app/preview.test.mjs - name: Run production browser journeys working-directory: frontend run: npm run test:e2e - name: Verify development renderer and worker module interop working-directory: frontend run: npm run test:dev-renderer - name: Verify production basemap worker and provider recovery working-directory: frontend run: npm run test:basemap - name: Verify owner, region and topology browser contracts working-directory: frontend run: npm run test:browser-contracts - name: Test compressed-chunk maintenance safety gates run: scripts/test-vacuum-maintenance.sh - name: Test immutable release rollback and schema compatibility gates run: scripts/test-replace-container.sh - name: Test split infrastructure resolver dry run run: scripts/test-infra-compose.sh - name: Preserve browser failure diagnostics if: failure() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 with: name: browser-failure-${{ github.run_id }}-${{ github.run_attempt }} path: frontend/test-results if-no-files-found: ignore retention-days: 7 hopreach-rf: if: github.event_name != 'schedule' name: HopReach RF gates runs-on: ubuntu-latest timeout-minutes: 20 env: GO_TEST_IMAGE: golang:1.23-bookworm@sha256:167053a2bb901972bf2c1611f8f52c44d5fe7e762e5cab213708d82c421614db steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7 with: python-version: '3.12' - name: Pull the pinned Go test image with bounded retries run: python scripts/ci-retry.py pull docker pull "$GO_TEST_IMAGE" - name: Prepare shared Go compiler and module caches run: mkdir -p "$RUNNER_TEMP/ukmesh-go-cache/build" "$RUNNER_TEMP/ukmesh-go-cache/mod" - name: Test HopReach parity and progressive publication run: | docker run --rm \ --user "$(id -u):$(id -g)" \ -e HOME=/tmp \ -e GOCACHE=/go-cache/build \ -e GOMODCACHE=/go-cache/mod \ -v "$RUNNER_TEMP/ukmesh-go-cache:/go-cache" \ -v "$PWD:/work:ro" \ -w /work/third_party/hopreach \ "$GO_TEST_IMAGE" \ go test -count=1 ./... - name: Enforce HopReach UK performance release gate run: | profile_dir="$(mktemp -d)" trap 'rm -rf "$profile_dir"' EXIT docker run --rm \ --user "$(id -u):$(id -g)" \ -e HOME=/tmp \ -e GOCACHE=/go-cache/build \ -e GOMODCACHE=/go-cache/mod \ -v "$RUNNER_TEMP/ukmesh-go-cache:/go-cache" \ -e HOPREACH_PROFILE_DIR=/profiles \ -v "$PWD:/work:ro" \ -v "$profile_dir:/profiles" \ -w /work \ "$GO_TEST_IMAGE" \ /work/scripts/benchmark-hopreach.sh monitoring: if: github.event_name != 'schedule' name: Monitoring configuration runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - name: Validate monitoring configuration run: | docker run --rm \ -v "$PWD/logging/prometheus.yml:/etc/prometheus/prometheus.yml:ro" \ -v "$PWD/logging/rules:/etc/prometheus/rules:ro" \ --entrypoint /bin/promtool \ prom/prometheus@sha256:63805ebb8d2b3920190daf1cb14a60871b16fd38bed42b857a3182bc621f4996 \ check config /etc/prometheus/prometheus.yml docker run --rm \ -v "$PWD/logging/rules:/rules:ro" \ --entrypoint /bin/promtool \ prom/prometheus@sha256:63805ebb8d2b3920190daf1cb14a60871b16fd38bed42b857a3182bc621f4996 \ test rules /rules/meshcore.test.yml docker run --rm \ -v "$PWD/logging:/etc/meshcore:ro" \ --entrypoint /bin/amtool \ prom/alertmanager@sha256:27c475db5fb156cab31d5c18a4251ac7ed567746a2483ff264516437a39b15ba \ check-config /etc/meshcore/alertmanager.yml docker run --rm \ -v "$PWD/logging/alloy/config.alloy:/etc/alloy/config.alloy:ro" \ grafana/alloy@sha256:491b0578c04983fd54fe99b587b6fab4404dc46d0dc16677bd6b00cc1140b308 \ validate /etc/alloy/config.alloy secrets: name: Secret scan runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: fetch-depth: 0 - name: Scan repository with gitleaks uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e # v3.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITLEAKS_VERSION: 8.30.0 - name: Scan full repository history on push and pull request if: github.event_name != 'schedule' run: gitleaks git --redact --no-banner --log-opts=--all