Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,49 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm

# 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@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json', 'package.json') }}
restore-keys: |
${{ runner.os }}-npm-

- name: Lint render.yaml
run: |
set -e
npx --yes yaml-lint render.yaml

- name: Install dependencies
run: npm ci
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

Expand Down
35 changes: 35 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import js from "@eslint/js";

export default [
js.configs.recommended,
{
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
process: "readonly",
console: "readonly",
Buffer: "readonly",
__dirname: "readonly",
setTimeout: "readonly",
clearTimeout: "readonly",
fetch: "readonly",
URL: "readonly",
URLSearchParams: "readonly",
Headers: "readonly",
Request: "readonly",
Response: "readonly",
AbortController: "readonly",
TextEncoder: "readonly",
TextDecoder: "readonly",
structuredClone: "readonly",
},
},
rules: {
"no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
},
},
{
ignores: ["node_modules/**", "test/**"],
},
];
Loading
Loading