Skip to content

Commit 430a343

Browse files
committed
ci: automatically test on all LTS node
- with example for testing on extra versions - add node 21, as a "not LTS" example - ci: test windows too, for curiousity - ci: add coverage workflow - package.json: replace devDeps with npx
1 parent 9e1b2cd commit 430a343

File tree

4 files changed

+47
-9
lines changed

4 files changed

+47
-9
lines changed

.github/workflows/coverage.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: coverage
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '*.md'
7+
pull_request:
8+
9+
env:
10+
CI: true
11+
NODE_ENV: cov
12+
13+
jobs:
14+
coverage:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/setup-node@v4
18+
- uses: actions/checkout@v4
19+
- run: npm install
20+
- name: run coverage
21+
run: npx -y c8 --reporter=lcov npm test
22+
- name: codecov
23+
uses: codecov/codecov-action@v3
24+
# - name: Coveralls
25+
# uses: coverallsapp/github-action@master
26+
# with:
27+
# github-token: ${{ secrets.github_token }}

.github/workflows/main.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,34 @@ on:
1010

1111
jobs:
1212
build:
13-
runs-on: ubuntu-latest
13+
needs: [ get-lts ]
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ ubuntu-latest, windows-latest ]
19+
node:
20+
- ${{ fromJson(needs.get-lts.outputs.active) }}
21+
- 21
1422
steps:
1523
- name: Checkout
1624
uses: actions/checkout@v4
1725
- name: Set up Node.js
1826
uses: actions/setup-node@v4
1927
with:
20-
node-version-file: '.nvmrc'
28+
node-version: ${{ matrix.node }}
2129
- name: Install dependencies
2230
run: npm install
2331
- name: Build
2432
run: npm run build
2533
- name: Test
2634
run: npm test
35+
36+
get-lts:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- id: get
40+
uses: msimerson/node-lts-versions@v1
41+
outputs:
42+
lts: ${{ steps.get.outputs.lts }}
43+
active: ${{ steps.get.outputs.active }}

.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,9 @@
4040
"punycode.es6.js"
4141
],
4242
"scripts": {
43-
"test": "mocha tests",
43+
"test": "npx mocha tests",
4444
"build": "node scripts/prepublish.js"
4545
},
46-
"devDependencies": {
47-
"codecov": "^3.8.3",
48-
"nyc": "^15.1.0",
49-
"mocha": "^10.2.0"
50-
},
5146
"jspm": {
5247
"map": {
5348
"./punycode.js": {

0 commit comments

Comments
 (0)