Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: restore CI test functionality #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
CI: restore test functionality with GHA
- ci: add GHA workflows, test all LTS versions of node on ubuntu & macOS
- package.json: populate files, limit what get published to NPM
- deps(all): bump to latest versions
- fix tap syntax for v18
- chore: add tap output dirs to .gitignore
- ci: run minimal eslint on PRs. Fix lint issues
  • Loading branch information
msimerson committed May 3, 2024
commit ef0fa4efb81c6dcb1a96168f78c1ae6d88932925
11 changes: 11 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
env:
node: true
es2021: true

extends: eslint:recommended

parserOptions:
ecmaVersion: latest

rules:
no-unused-vars: 1
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
pull_request:
push:

env:
CI: true

jobs:
test:
needs: [get-lts]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
node-version: ${{ fromJson(needs.get-lts.outputs.active) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
name: Node ${{ matrix.node-version }} on ubuntu-latest
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test

get-lts:
runs-on: ubuntu-latest
steps:
- id: get
uses: msimerson/node-lts-versions@v1
outputs:
active: ${{ steps.get.outputs.active }}
lts: ${{ steps.get.outputs.lts }}

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm run lint
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
build
node_modules
.nyc_output
.tap
package-lock.json
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

14 changes: 14 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
2024-05-02, Version 1.2.1
=========================

* ci: add GHA workflows, test LTS versions of node on ubuntu & macOS #45

* package.json: populate files, limit what get published to NPM

* deps(all): bump to latest versions

* chore: add tap output dirs to .gitignore

* ci: run minimal eslint on PRs


2019-05-06, Version 1.2.0
=========================

Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
"version": "1.2.0",
"description": "modern syslog - streaming, async, uses nan",
"main": "index.js",
"files": [ "binding.gyp", "CHANGES.md", "core.cc", "Makefile" ],
"os": [
"!win32"
],
"scripts": {
"test": "tap test/test-*.js"
"lint": "npx eslint@8 *.js",
"test": "tap --allow-incomplete-coverage test/test-*.js"
},
"author": "Sam Roberts <[email protected]>",
"homepage": "http:https://github.com/strongloop/modern-syslog",
Expand All @@ -20,11 +22,11 @@
},
"license": "MIT",
"devDependencies": {
"debug": "^4.1.1",
"tap": "^13.1.2"
"debug": "^4.3.4",
"tap": "^18.7.2"
},
"dependencies": {
"nan": "^2.13.2"
"nan": "^2.19.0"
},
"tags": [
"log",
Expand Down
1 change: 0 additions & 1 deletion test/test-compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// License text available at https://opensource.org/licenses/MIT

var Syslog = require('../');
var assert = require('assert');
var tap = require('tap');

tap.test(function(t) {
Expand Down
18 changes: 9 additions & 9 deletions test/test-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ var syslog = require('../');
var tap = require('tap');

tap.test('core properties exist', function(t) {
t.assert(syslog.core);
t.assert(syslog.core.openlog);
t.assert(syslog.core.syslog);
t.assert(syslog.core.setlogmask);
t.assert(syslog.core.closelog);
t.assert(syslog.core.option.LOG_PID);
t.assert(syslog.core.facility.LOG_LOCAL0);
t.assert(syslog.core.level.LOG_DEBUG);
t.ok(syslog.core);
t.ok(syslog.core.openlog);
t.ok(syslog.core.syslog);
t.ok(syslog.core.setlogmask);
t.ok(syslog.core.closelog);
t.ok(syslog.core.option.LOG_PID);
t.ok(syslog.core.facility.LOG_LOCAL0);
t.ok(syslog.core.level.LOG_DEBUG);
t.end();
});

Expand All @@ -33,7 +33,7 @@ function accept(m) {
tap.test(fmt('core syslog accepts %j', m), function(t) {
t.plan(1);
syslog.core.syslog(syslog.core.level.LOG_DEBUG, m, function() {
t.assert(true, 'called back');
t.ok(true, 'called back');
});
});
}
Expand Down
1 change: 0 additions & 1 deletion test/test-openlog.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// License text available at https://opensource.org/licenses/MIT

var tap = require('tap');
var assert = require('assert');
var syslog = require('../');
var o = syslog.option;
var f = syslog.facility;
Expand Down
13 changes: 6 additions & 7 deletions test/test-setmask.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

'use strict';

var assert = require('assert');
var debug = require('debug')('modern-syslog:test');
var syslog = require('../');
var tap = require('tap');
Expand Down Expand Up @@ -35,26 +34,26 @@ tap.test('logUpto', function(t) {
t.equal(mask, 0xff);
mask = upto('LOG_INFO');
t.equal(mask, 0x7f);
t.assert((1 << l.LOG_CRIT) & mask);
t.assert((1 << l.LOG_INFO) & mask);
t.ok((1 << l.LOG_CRIT) & mask);
t.ok((1 << l.LOG_INFO) & mask);
t.equal((1 << l.LOG_DEBUG) & mask, 0);

mask = upto('LOG_NOTICE');
t.equal(mask, 0x3f);
t.assert((1 << l.LOG_NOTICE) & mask);
t.ok((1 << l.LOG_NOTICE) & mask);
t.equal((1 << l.LOG_INFO) & mask, 0);
t.equal((1 << l.LOG_DEBUG) & mask, 0);

mask = upto('LOG_ALERT');
t.equal(mask, 0x03);
t.assert((1 << l.LOG_EMERG) & mask);
t.assert((1 << l.LOG_ALERT) & mask);
t.ok((1 << l.LOG_EMERG) & mask);
t.ok((1 << l.LOG_ALERT) & mask);
t.equal((1 << l.LOG_CRIT) & mask, 0);
t.equal((1 << l.LOG_DEBUG) & mask, 0);

mask = upto('LOG_EMERG');
t.equal(mask, 0x01);
t.assert((1 << l.LOG_EMERG) & mask);
t.ok((1 << l.LOG_EMERG) & mask);
t.equal((1 << l.LOG_ALERT) & mask, 0);
t.equal((1 << l.LOG_CRIT) & mask, 0);
t.equal((1 << l.LOG_DEBUG) & mask, 0);
Expand Down
1 change: 0 additions & 1 deletion test/test-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

var assert = require('assert');
var fmt = require('util').format;
var syslog = require('../');
var tap = require('tap');
Expand Down
1 change: 0 additions & 1 deletion test/test-syslog.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

var assert = require('assert');
var fmt = require('util').format;
var syslog = require('../');
var tap = require('tap');
Expand Down