cross-platform-simple.ymlโข2.73 kB
---
name: Cross-Platform Simple
on:
workflow_dispatch:
push:
branches: [main]
permissions:
contents: read
env:
NODE_OPTIONS: '--max-old-space-size=4096 --experimental-vm-modules'
CI: true
TEST_PERSONAS_DIR: ${{ github.workspace }}/test-personas
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: ['20.x']
steps:
- name: Checkout
uses: actions/checkout@v4
- 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
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# Cache TypeScript build artifacts
- 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-lock.json') }}
restore-keys: |
typescript-build-${{ runner.os }}-${{ matrix.node-version }}-
typescript-build-${{ runner.os }}-
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
# Cache Jest test results and coverage
- 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.*', 'package-lock.json') }}
restore-keys: |
jest-cache-${{ runner.os }}-${{ matrix.node-version }}-
jest-cache-${{ runner.os }}-
- name: Test
run: npm test