Skip to content

fix(tests): convert threaded handler fixtures to .js for Node 20 compat #58

fix(tests): convert threaded handler fixtures to .js for Node 20 compat

fix(tests): convert threaded handler fixtures to .js for Node 20 compat #58

Workflow file for this run

name: PR & Branch CI
on:
push:
branches-ignore:
- main
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
matrix:
node: [20.x, 22.x, 24.x]
stack: [simple]
include:
- node: 22.x
stack: full
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
cache-dependency-path: package.json
- name: Install deps
run: npm ci
- name: Generate & Build
run: npm run build
- name: Detect Generation Drift (non-blocking)
id: drift
run: |
if ! git diff --quiet; then
echo 'drift=true' >> $GITHUB_OUTPUT
echo 'Generation produced changes (reporting only).' >&2
git diff --name-only | sed 's/^/CHANGED: /'
git diff > _gen-drift.patch || true
else
echo 'drift=false' >> $GITHUB_OUTPUT
fi
- name: Upload Drift Patch
# Only upload a single canonical drift patch from Node 20.x to avoid artifact 409 conflicts
if: steps.drift.outputs.drift == 'true' && matrix.node == '20.x' && matrix.stack == 'simple'
uses: actions/upload-artifact@v4
with:
name: generation-drift
path: _generation-drift.patch
- name: Unit Tests
run: npm test
- name: Start Integration Stack
working-directory: docker
run: |
if [ "${{ matrix.stack }}" == "full" ]; then
docker compose -f docker-compose-full.yaml up -d
else
docker compose -f docker-compose.yaml up -d
fi
- name: Wait for Services Healthy
run: |
set -e
attempts=0
max_attempts=60
while [ $attempts -lt $max_attempts ]; do
code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:9600/actuator/health/status || true)
[ "$code" = "200" ] && echo "Broker healthy" && break
attempts=$((attempts+1))
sleep 5
# Optional: Check if containers are still running
if [ "${{ matrix.stack }}" == "full" ]; then
docker compose -f docker/docker-compose-full.yaml ps -q | xargs docker inspect -f '{{.State.Status}}' | grep -v running || true
fi
done
[ $attempts -ge $max_attempts ] && echo "Broker not healthy" && exit 1 || true
- name: Integration Tests
run: npm run test:integration
- name: Capture Docker Logs (always)
if: always()
run: |
mkdir -p _logs
COMPOSE_FILE="docker/docker-compose.yaml"
if [ "${{ matrix.stack }}" == "full" ]; then
COMPOSE_FILE="docker/docker-compose-full.yaml"
fi
docker compose -f $COMPOSE_FILE logs > ../_logs/compose.log 2>&1 || true
- name: Shutdown Integration Stack (always)
if: always()
working-directory: docker
run: |
COMPOSE_FILE="docker-compose.yaml"
if [ "${{ matrix.stack }}" == "full" ]; then
COMPOSE_FILE="docker-compose-full.yaml"
fi
docker compose -f $COMPOSE_FILE down -v || true
- name: Upload Logs Artifact (on failure)
if: failure()
uses: actions/upload-artifact@v4
with:
# Include node version and stack so parallel matrix legs don't conflict
name: integration-docker-logs-${{ matrix.node }}-${{ matrix.stack }}
path: _logs/compose.log
- name: Append Job Summary
if: always()
run: |
status="${{ job.status }}"
driftFlag="${{ steps.drift.outputs.drift }}"
{
echo "### Node ${{ matrix.node }} (${{ matrix.stack }}) Summary";
echo "- Status: ${status}";
if [ "${driftFlag}" = "true" ]; then
echo "- Generation Drift: detected";
else
echo "- Generation Drift: none";
fi
echo "";
} >> $GITHUB_STEP_SUMMARY