Test/node runner #153
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| node: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install | |
| run: npm ci | |
| - name: API health (offline) | |
| run: | | |
| DEV_NO_API=1 node backend/index.cjs & echo $! > api.pid | |
| for i in {1..20}; do | |
| if curl -fsS http://127.0.0.1:8790/health >/dev/null; then | |
| curl -fsS http://127.0.0.1:8790/health | tee health.json; break | |
| fi | |
| sleep 0.3 | |
| done | |
| kill $(cat api.pid) | |
| - name: Run ESLint (npx ESLint v8) | |
| run: npx -y eslint@8 . | |
| continue-on-error: true | |
| - name: Lint (if present) | |
| run: npm run -s lint --if-present | |
| - name: Test (if present) | |
| run: npm run -s test --if-present | |
| python: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install deps (if requirements.txt) | |
| run: | | |
| if [ -f requirements.txt ]; then | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| fi | |
| - name: Run pytest if tests are present | |
| run: | | |
| if ls -1 tests test_*.py 2>/dev/null | grep -q .; then | |
| pip install pytest | |
| PYTHONPATH=. pytest -q | |
| else | |
| echo "No python tests found; skipping" | |
| fi |