Skip to content

Commit 0f58570

Browse files
authored
ci: integrate workflows into nodejs.yml (#2899)
1 parent 071609f commit 0f58570

4 files changed

Lines changed: 77 additions & 55 deletions

File tree

.github/workflows/dependency-review.yml

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

.github/workflows/lint.yml

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

.github/workflows/nodejs.yml

Lines changed: 75 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,49 @@ on:
99
- 'v*'
1010
pull_request:
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
16+
dependency-review:
17+
if: ${{ github.event_name == 'pull_request' }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Harden Runner
21+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
22+
with:
23+
egress-policy: audit
24+
25+
- name: Checkout
26+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
27+
with:
28+
persist-credentials: false
29+
30+
- name: Dependency Review
31+
uses: actions/dependency-review-action@9129d7d40b8c12c1ed0f60400d00c92d437adcce # v4.1.3
32+
33+
lint:
34+
name: Lint
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
39+
with:
40+
persist-credentials: false
41+
42+
- name: Setup Node.js
43+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
44+
with:
45+
node-version: lts/*
46+
47+
- name: Install dependencies
48+
run: npm install
49+
50+
- name: Lint
51+
run: npm run lint
52+
1353
test:
54+
name: Test with Node.js ${{ matrix.node-version }} on ${{ matrix.runs-on }}
1455
timeout-minutes: 15
1556
strategy:
1657
fail-fast: false
@@ -25,16 +66,14 @@ jobs:
2566
- windows-latest
2667

2768
runs-on: ${{ matrix.runs-on }}
28-
2969
steps:
30-
3170
- name: Checkout
32-
uses: actions/checkout@v4
71+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3372
with:
3473
persist-credentials: false
3574

3675
- name: Setup Node.js@${{ matrix.node-version }}
37-
uses: actions/setup-node@v4
76+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
3877
with:
3978
node-version: ${{ matrix.node-version }}
4079

@@ -63,15 +102,42 @@ jobs:
63102
with:
64103
token: ${{ secrets.CODECOV_TOKEN }}
65104

105+
test-types:
106+
name: Test TypeScript types
107+
timeout-minutes: 15
108+
runs-on: ubuntu-latest
109+
steps:
110+
- name: Checkout
111+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
112+
with:
113+
persist-credentials: false
114+
115+
- name: Setup Node.js
116+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
117+
with:
118+
node-version: lts/*
119+
120+
- name: Install dependencies
121+
run: npm install
122+
123+
- name: Run typings tests
124+
run: npm run test:typescript
125+
66126
automerge:
67127
if: >
68128
github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]'
69-
needs: test
129+
needs:
130+
- dependency-review
131+
- test
132+
- test-types
133+
- lint
70134
runs-on: ubuntu-latest
71135
permissions:
72-
pull-requests: write
73136
contents: write
137+
pull-requests: write
138+
actions: write
74139
steps:
75-
- uses: fastify/github-action-merge-dependabot@9e7bfb249c69139d7bdcd8d984f9665edd49020b # v3.10.1
76-
with:
77-
github-token: ${{ secrets.GITHUB_TOKEN }}
140+
- name: Merge Dependabot PR
141+
uses: fastify/github-action-merge-dependabot@9e7bfb249c69139d7bdcd8d984f9665edd49020b # v3.10.1
142+
with:
143+
github-token: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@
8181
"test:typescript": "tsd && tsc --skipLibCheck test/imports/undici-import.ts",
8282
"test:websocket": "borp -p \"test/websocket/*.js\"",
8383
"test:wpt": "node test/wpt/start-fetch.mjs && node test/wpt/start-FileAPI.mjs && node test/wpt/start-mimesniff.mjs && node test/wpt/start-xhr.mjs && node test/wpt/start-websockets.mjs && node test/wpt/start-cacheStorage.mjs && node test/wpt/start-eventsource.mjs",
84-
"coverage": "npm run coverage:clean && cross-env NODE_V8_COVERAGE=./coverage/tmp npm run test && npm run coverage:report",
85-
"coverage:ci": "npm run coverage:clean && cross-env NODE_V8_COVERAGE=./coverage/tmp npm run test && npm run coverage:report:ci",
84+
"coverage": "npm run coverage:clean && cross-env NODE_V8_COVERAGE=./coverage/tmp npm run test:javascript && npm run coverage:report",
85+
"coverage:ci": "npm run coverage:clean && cross-env NODE_V8_COVERAGE=./coverage/tmp npm run test:javascript && npm run coverage:report:ci",
8686
"coverage:clean": "node ./scripts/clean-coverage.js",
8787
"coverage:report": "cross-env NODE_V8_COVERAGE= c8 report",
8888
"coverage:report:ci": "c8 report",

0 commit comments

Comments
 (0)