Skip to content

chore(ai): bootstrap governance workflows and PR template #10

chore(ai): bootstrap governance workflows and PR template

chore(ai): bootstrap governance workflows and PR template #10

Workflow file for this run

# @ai-generated: true
# @ai-tool: Copilot
name: Run Unit Tests
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'src/**/*.spec.ts'
- 'karma.conf.js'
permissions:
contents: read
jobs:
node_tests:
name: Node.js tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies (if package.json exists)
shell: bash
run: |
if [ -f package.json ]; then
if [ -f package-lock.json ]; then npm ci; else npm install; fi
else
echo "No package.json; skipping Node setup"; exit 0
fi
- name: Run npm test (if defined)
shell: bash
run: |
if [ -f package.json ]; then
if node -e "const p=require('./package.json');process.exit(p.scripts&&p.scripts['test:ci']?0:1)"; then
npm run test:ci --silent || (echo "::error::npm run test:ci failed"; exit 1)
elif node -e "const p=require('./package.json');process.exit(p.scripts&&p.scripts.test?0:1)"; then
npm test --silent || (echo "::error::npm test failed"; exit 1)
else
echo "No test script defined; skipping Node tests";
fi
else
echo "No package.json; skipping";
fi
python_tests:
name: Python tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then
pip install -r requirements.txt || true
fi
# Ensure pytest available
pip install pytest || true
- name: Run pytest (if tests exist)
shell: bash
env:
PYTHONPATH: ${{ github.workspace }}
run: |
if find tests -type f -name "*.py" 2>/dev/null | grep -q .; then
pytest -q || (echo "::error::pytest failed"; exit 1)
else
echo "No Python tests found; skipping"
fi