Skip to content

Commit a983ea2

Browse files
committed
test: add GHA testing, nuke Travis
1 parent 3a0d8c2 commit a983ea2

File tree

6 files changed

+97
-20
lines changed

6 files changed

+97
-20
lines changed

.github/workflows/ci.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
env:
8+
CI: true
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/setup-node@v4
15+
- uses: actions/checkout@v4
16+
- run: npm install
17+
- run: npm install eslint@^8
18+
- run: npm run lint
19+
20+
coverage:
21+
if: false
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/setup-node@v4
25+
- uses: actions/checkout@v4
26+
- run: npm install
27+
- name: run coverage
28+
run: |
29+
npm install --no-save c8
30+
npx c8 --reporter=lcov npm test
31+
env:
32+
NODE_ENV: cov
33+
34+
- name: codecov
35+
uses: codecov/codecov-action@v4
36+
37+
- name: Coveralls
38+
uses: coverallsapp/github-action@master
39+
with:
40+
github-token: ${{ secrets.github_token }}
41+
42+
ubuntu:
43+
needs: [lint, get-lts]
44+
runs-on: ubuntu-latest
45+
strategy:
46+
matrix:
47+
node-version: ${{ fromJson(needs.get-lts.outputs.active) }}
48+
fail-fast: false
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: actions/setup-node@v4
52+
name: Node ${{ matrix.node-version }} on ubuntu-latest
53+
with:
54+
node-version: ${{ matrix.node-version }}
55+
- run: npm install
56+
- run: npm run test
57+
58+
windows:
59+
needs: [lint, get-lts]
60+
runs-on: windows-latest
61+
strategy:
62+
matrix:
63+
node-version: ${{ fromJson(needs.get-lts.outputs.active) }}
64+
fail-fast: false
65+
steps:
66+
- uses: actions/checkout@v4
67+
- uses: actions/setup-node@v4
68+
name: Node.js ${{ matrix.node-version }} on windows-latest
69+
with:
70+
node-version: ${{ matrix.node-version }}
71+
- run: npm install
72+
- run: npm run test
73+
74+
get-lts:
75+
runs-on: ubuntu-latest
76+
steps:
77+
- id: get
78+
uses: msimerson/node-lts-versions@v1
79+
outputs:
80+
active: ${{ steps.get.outputs.active }}
81+
lts: ${{ steps.get.outputs.lts }}
82+
min: ${{ steps.get.outputs.min }}

.travis.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2+
## Unreleased
3+
4+
* ci: replace travis (dead) with Github Actions GHA)
5+
* ci: automatically test on ubuntu & windows
6+
* ci: automatically test on the LTS versions of node.js
7+
* deps: remove mocha & eslint, they get auto-installed by npx when needed
8+
9+
110
## 1.1.3
211

312
* fix LICENSE name

package-lock.json

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"author": "Alexandru Mărășteanu <hello@alexei.ro>",
66
"main": "src/sprintf.js",
77
"scripts": {
8-
"test": "mocha test/*.js",
8+
"test": "npx mocha test/*.js",
99
"pretest": "npm run lint",
10-
"lint": "eslint .",
11-
"lint:fix": "eslint --fix ."
10+
"lint": "npx eslint@^8 .",
11+
"lint:fix": "npx eslint@^8 --fix ."
1212
},
1313
"repository": {
1414
"type": "git",
@@ -18,16 +18,14 @@
1818
"readmeFilename": "README.md",
1919
"devDependencies": {
2020
"benchmark": "^2.1.4",
21-
"eslint": "^5.10.0",
2221
"gulp": "^3.9.1",
2322
"gulp-benchmark": "^1.1.1",
2423
"gulp-eslint": "^5.0.0",
2524
"gulp-header": "^2.0.5",
2625
"gulp-mocha": "^6.0.0",
2726
"gulp-rename": "^1.4.0",
2827
"gulp-sourcemaps": "^2.6.4",
29-
"gulp-uglify": "^3.0.1",
30-
"mocha": "^5.2.0"
28+
"gulp-uglify": "^3.0.1"
3129
},
3230
"overrides": {
3331
"graceful-fs": "^4.2.11"

src/sprintf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@
210210
* export to either browser or node.js
211211
*/
212212
/* eslint-disable quote-props */
213+
/* eslint no-redeclare: [ "warn" ] */
213214
if (typeof exports !== 'undefined') {
214215
exports['sprintf'] = sprintf
215216
exports['vsprintf'] = vsprintf

0 commit comments

Comments
 (0)