Skip to content

Merge pull request #92 from allocsys/dependabot/npm_and_yarn/dev-depe… #838

Merge pull request #92 from allocsys/dependabot/npm_and_yarn/dev-depe…

Merge pull request #92 from allocsys/dependabot/npm_and_yarn/dev-depe… #838

Workflow file for this run

name: CI
on:
push:
branches: ["**"]
pull_request:
branches: [main]
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: "22"
# Manual cache (not setup-node's built-in `cache: npm`) because that
# option errors out at setup time if no lockfile is present -- and a
# missing/out-of-sync lockfile is a case we want to survive, not fail
# on. hashFiles() silently skips any pattern that matches nothing, so
# this works whether or not package-lock.json exists.
- name: Cache npm dependencies
uses: actions/cache@v6
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json', 'package.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Lint deploy config files
run: |
set -e
npx --yes yaml-lint render.yaml
node -e "JSON.parse(require('fs').readFileSync('vercel.json', 'utf8')); console.log('vercel.json is valid JSON.')"
- name: Install dependencies
run: |
set -e
if [ -f package-lock.json ]; then
if npm ci; then
echo "Installed via npm ci (lockfile in sync)."
else
echo "::warning::package-lock.json is out of sync with package.json -- falling back to npm install so CI can still run. Trigger the 'Generate lockfile' workflow (workflow_dispatch) to regenerate and commit an up-to-date lockfile."
rm -rf node_modules
npm install
fi
else
echo "::warning::No package-lock.json found -- falling back to npm install so CI can still run. Trigger the 'Generate lockfile' workflow (workflow_dispatch) to generate and commit one."
npm install
fi
- name: Syntax-check all source files
run: |
set -e
find . -name "*.js" -not -path "./node_modules/*" -print0 | xargs -0 -n1 node --check
- name: Lint
run: npm run lint
- name: Run unit tests
run: npm test
- name: Smoke test -- server boots and GET /health responds
run: |
set -e
node server.js &
SERVER_PID=$!
ok=""
for i in $(seq 1 10); do
if curl -sf http://localhost:8080/health > /dev/null; then
ok=1
break
fi
sleep 1
done
kill "$SERVER_PID" || true
if [ -z "$ok" ]; then
echo "Server did not become healthy in time"
exit 1
fi
echo "Health check passed"