Files
wmantly 3f8f56ee35 ci: add redis service (audit/metrics/session models need it on import)
model-redis opens a client when models/index is required, so with no
redis the integration test saw ECONNREFUSED as a post-test unhandled
rejection. Provide redis:7 at 127.0.0.1:6379 in CI (mirrors how
sso-manager-node tests run).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 16:22:26 -04:00

66 lines
1.5 KiB
YAML

name: Pull Request Tests
on:
pull_request:
branches:
- master
push:
branches-ignore:
- master
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
# The audit/metrics/session models are redis-backed (model-redis opens a
# client on import), so the tests need a reachable redis at 127.0.0.1:6379.
services:
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 10
strategy:
matrix:
node-version: [20.x, 22.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'
cache-dependency-path: nodejs/package-lock.json
- name: Install dependencies
working-directory: ./nodejs
run: npm ci
- name: Run all tests
working-directory: ./nodejs
run: npm test
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: test
if: always()
steps:
- name: Check test results
run: |
if [ "${{ needs.test.result }}" != "success" ]; then
echo "Tests failed. PR cannot be merged."
exit 1
fi
echo "All tests passed successfully!"