Skip to content

Commit

Permalink
Switch from Travis to GitHub Actions for CI (#642)
Browse files Browse the repository at this point in the history
- add package-lock.json (as is recommended and because 'npm ci' requires it)
- some fixes to jsstyle for the newer Perl version on ubuntu-latest runners
- use "files" in package.json to reduce the noise files in published packages
  • Loading branch information
trentm authored Jun 28, 2020
1 parent 554837b commit 088371c
Show file tree
Hide file tree
Showing 9 changed files with 3,045 additions and 41 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Check Lint/Style
on: [push, pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
# Use current node LTS version.
node-version: '12.x'
- run: npm ci
- run: npm run check
61 changes: 61 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Test

on:
push:
paths-ignore:
- 'docs/**'
- '*.md'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'

jobs:
# Test once on every (available) plat, using LTS node version
# (https://nodejs.org/en/about/releases/).
#
# TODO: add windows-latest when moved to node-tap and don't have to
# rely on shell globbing
test-plats:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm ci
- run: npm test

# Test once for every supported node version (don't repeat the LTS
# node version from the previous step). Only test on one
# platform to not overkill the number of builds.
test-vers:
strategy:
matrix:
node: ['8.x', '10.x', '14.x']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: npm ci
- run: npm test

# Test older versions separately because really old node/npm don't support
# 'npm ci'.
test-old-vers:
strategy:
matrix:
node: ['0.10.x', '4.x', '6.x']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: npm install
- run: npm test
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
*.log
!/test/corpus/*.log
/*.tgz
/test/*.log.0
/test/log.test.rot.log.*
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

SHELL := bash

#---- Tools

NODEUNIT := ./node_modules/.bin/nodeunit
Expand All @@ -22,8 +24,6 @@ NODEOPT ?= $(HOME)/opt
#---- Files

JSSTYLE_FILES := $(shell find lib test tools examples -name "*.js") bin/bunyan
# All test files *except* dtrace.test.js.
NON_DTRACE_TEST_FILES := $(shell ls -1 test/*.test.js | grep -v dtrace | xargs)


#---- Targets
Expand All @@ -34,10 +34,10 @@ all $(NODEUNIT):
# Ensure all version-carrying files have the same version.
.PHONY: versioncheck
versioncheck:
@echo version is: $(shell cat package.json | json version)
[[ `cat package.json | json version` == `grep '^## ' CHANGES.md | head -2 | tail -1 | awk '{print $$2}'` ]]
[[ `cat package.json | json version` == `grep '^var VERSION' bin/bunyan | awk -F"'" '{print $$2}'` ]]
[[ `cat package.json | json version` == `grep '^var VERSION' lib/bunyan.js | awk -F"'" '{print $$2}'` ]]
@echo version is: $(shell node -e 'console.log(require("./package.json").version)')
[[ `node -e 'console.log(require("./package.json").version)'` == `grep '^## ' CHANGES.md | head -2 | tail -1 | awk '{print $$2}'` ]]
[[ `node -e 'console.log(require("./package.json").version)'` == `grep '^var VERSION' bin/bunyan | awk -F"'" '{print $$2}'` ]]
[[ `node -e 'console.log(require("./package.json").version)'` == `grep '^var VERSION' lib/bunyan.js | awk -F"'" '{print $$2}'` ]]
@echo Version check ok.

.PHONY: cutarelease
Expand Down Expand Up @@ -97,8 +97,8 @@ test: $(NODEUNIT)
test -z "$(DTRACE_UP_IN_HERE)" || test -n "$(SKIP_DTRACE)" || \
(node -e 'require("dtrace-provider").createDTraceProvider("isthisthingon")' && \
echo "\nNote: Use 'SKIP_DTRACE=1 make test' to skip parts of the test suite that require root." && \
$(SUDO) $(NODEUNIT) test/dtrace.test.js)
$(NODEUNIT) $(NON_DTRACE_TEST_FILES)
$(SUDO) $(NODEUNIT) test/dtrace/*.test.js)
$(NODEUNIT) test/*.test.js # non-dtrace test files

# Test will all node supported versions (presumes install locations I use on
# my machine -- "~/opt/node-VER"):
Expand Down
Loading

0 comments on commit 088371c

Please sign in to comment.