CI test and build stages
Continuous integration (CI) checks changes using repeatable tests and builds. Continuous delivery prepares verified artifacts for deployment; deployment itself may require approval. A useful pipeline validates source and lockfiles, runs tests using an explicit Node version, builds once, records artifact identity and test evidence, and publishes only to an approved staging destination. A failing check blocks promotion. Review CI actions at immutable commit revisions and keep untrusted pull-request jobs separate from privileged release jobs. Do not expose production credentials to untrusted code or run package lifecycle hooks without review. Do not deploy merely because the build command returned zero, or rebuild differently in each environment without accounting for artifact identity. Sources: https://docs.github.com/en/actions/reference/security/secure-use.
Formal Syntax & Structure
Observe a real test-runner gate (conceptual contract; see example)Working Example
import assert from 'node:assert/strict';import {spawnSync} from 'node:child_process';import {writeFileSync} from 'node:fs';writeFileSync('gate.test.mjs',"import test from 'node:test';import assert from 'node:assert/strict';test('sum',()=>assert.equal(2+2,4));");const result=spawnSync(process.execPath,['--test','gate.test.mjs'],{encoding:'utf8',timeout:2000});assert.equal(result.status,0);console.log('tests passed');