extended-node-compatibility.ymlโข3.73 kB
---
name: Extended Node Compatibility
on:
push:
branches: [main, develop]
schedule:
- cron: '0 6 * * 1' # Weekly on Monday 6 AM UTC
workflow_dispatch:
permissions:
contents: read
env:
NODE_OPTIONS: '--max-old-space-size=4096 --experimental-vm-modules'
CI: true
TEST_PERSONAS_DIR: ${{ github.workspace }}/test-personas
TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }}
jobs:
extended-compatibility:
name: Test (${{ matrix.os }}, Node ${{ matrix.node-version }})
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: ['20.x', '22.x']
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Fetch tags for signature verification
shell: bash
run: git fetch --tags --force
- name: Validate environment
# Use bash for cross-platform compatibility (Windows/macOS/Linux)
shell: bash
run: |
echo "๐ Validating CI environment..."
echo "TEST_PERSONAS_DIR: $TEST_PERSONAS_DIR"
echo "NODE_OPTIONS: $NODE_OPTIONS"
echo "CI: $CI"
# Verify TEST_PERSONAS_DIR is set
if [ -z "$TEST_PERSONAS_DIR" ]; then
echo "โ TEST_PERSONAS_DIR is not set!"
exit 1
fi
# Display workspace info for debugging
echo "GitHub workspace: ${{ github.workspace }}"
echo "Runner OS: ${{ runner.os }}"
echo "Current directory: $(pwd)"
echo "โ
Environment validation passed"
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Cache TypeScript build
uses: actions/cache@v4
with:
path: |
dist/
build/
*.tsbuildinfo
key: typescript-build-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('src/**/*.ts', 'tsconfig*.json', 'package.json', 'package-lock.json') }}
# REMOVED restore-keys to prevent using stale caches with old compiled code
# This ensures we always rebuild when source files change
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Cache Jest
uses: actions/cache@v4
with:
path: |
.jest-cache/
test/coverage/
node_modules/.cache/jest/
key: jest-cache-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('test/__tests__/**/*.ts', 'test/jest.config.*', 'src/**/*.ts', 'package.json', 'package-lock.json') }}
# REMOVED restore-keys for consistency with TypeScript cache fix
# Jest cache can also become stale and cause test failures
- name: Run test suite
run: npm test
- name: Compatibility validation
run: |
echo "โ
Extended Node Compatibility Complete!"
echo "Platform: ${{ matrix.os }}"
echo "Node.js: ${{ matrix.node-version }}"
- name: Notify on scheduled failure
if: failure() && github.event_name == 'schedule'
run: |
echo "๐จ Extended Node Compatibility failed on scheduled run"
echo "This indicates a potential compatibility issue with Node.js ${{ matrix.node-version }} on ${{ matrix.os }}"
echo "Please investigate: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"