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: 22 additions & 10 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
push:
branches: ['main']
branches: [master, main]
pull_request:
branches: ['main']
branches: [master, main]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache: npm
- run: npm ci
- run: npm run build --if-present
- run: npm run lint
- run: npm run format:check
- run: npm test
- run: npm run coverage:check
# Uploaded from one matrix leg only — the report is identical across them, and
# two legs writing the same artifact name is an error. Makes a coverage
# regression inspectable from the failing run instead of only reproducible locally.
- name: Upload coverage report
if: matrix.node-version == '22.x'
uses: actions/upload-artifact@v7
with:
name: coverage-report
# Only the readable report, not all of `coverage/`. c8 also writes its
# raw V8 dump to coverage/tmp, which is ~97% of the bytes and inspectable
# by nothing — measured at 23 MB of tmp against a 647 kB report. Uploading
# the directory ships that dead weight on every run for the whole
# retention window, and the step exists to make a failure *readable*.
# Requires c8 to emit a report: `"reporter": ["text", "lcov"]`.
path: |
coverage/lcov-report
coverage/lcov.info
retention-days: 14
22 changes: 13 additions & 9 deletions .github/workflows/standards-check.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Enforces the shared standard. Tool-neutral, no AI. Fails CI if this repo drifts.
# Synced into target repos by `nrstd sync` as .github/workflows/standards-check.yml.
# Fails CI if the repo drifts from the shared standard. Tool-neutral (no AI).
# `nrstd audit` exits non-zero on any gap, so a repo adopting this should run
# `nrstd sync --write` first — otherwise its next push goes red on pre-existing drift.
name: Standards check

on:
push:
branches: [master, main]
pull_request:

permissions:
contents: read
jobs:
standards:
runs-on: ubuntu-latest
Expand All @@ -14,9 +17,10 @@ jobs:
- uses: actions/setup-node@v7
with:
node-version: 20.x
cache: 'npm'
# node-red-standards is declared as a devDependency (public repo,
# HTTPS tarball URL), so `npm ci` installs it and `npx nrstd`
# runs the local binary without an additional network fetch.
- run: npm ci
- run: npx nrstd audit
# Resolved from Git, not the npm registry: this package is deliberately
# unpublished (README "Install", option B), so a bare
# `npx --yes node-red-standards` fails every run with E404 before it can
# audit anything — which reads as drift when it is really a missing
# package. The repo is public, so no token is needed. If it is ever
# published, the short form becomes available and this can go back.
- run: npx --yes github:windkh/node-red-standards audit
7 changes: 3 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,24 @@
"globals": "^17.6.0",
"node-red": "^5.0.1",
"node-red-node-test-helper": "^0.3.6",
"node-red-standards": "https://codeload.github.com/windkh/node-red-standards/tar.gz/1726fe5133771b88b9c4fd17e64413cca595992e",
"node-red-standards": "github:windkh/node-red-standards",
"prettier": "^3.8.3"
},
"c8": {
"reporter": [
"text",
"lcov"
],
"exclude": [
"test/**",
"test-helpers/**",
"examples/**",
"doc/**",
"eslint.config.js"
],
"lines": 56,
"statements": 56,
"branches": 71,
"functions": 64
}
}