diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4451503 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,18 @@ +name: CI +on: + push: + branches: [main, master] + pull_request: +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20, 22] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: npm install --no-audit --no-fund + - run: npm test diff --git a/package.json b/package.json index c4bbf7f..e1fb4a3 100644 --- a/package.json +++ b/package.json @@ -7,14 +7,15 @@ "git-pulse": "./bin/pulse.js" }, "scripts": { - "start": "node bin/pulse.js" + "start": "node bin/pulse.js", + "test": "node --test" }, "dependencies": { "chalk": "^5.3.0", "commander": "^12.0.0" }, "engines": { - "node": ">=18" + "node": ">=20" }, "author": "NickCirv ", "license": "MIT", diff --git a/test/smoke.test.js b/test/smoke.test.js new file mode 100644 index 0000000..2c3dbd3 --- /dev/null +++ b/test/smoke.test.js @@ -0,0 +1,6 @@ +import { test } from 'node:test' +import { execFileSync } from 'node:child_process' +import { fileURLToPath } from 'node:url' +import { dirname, join } from 'node:path' +const root = join(dirname(fileURLToPath(import.meta.url)), '..') +test('entry is valid JavaScript', () => { execFileSync('node', ['--check', join(root, 'bin/pulse.js')]) })