Skip to content

Commit 3be7ec9

Browse files
authored
Chore: run tests daily against node nightly (#2969)
* chore(.github/workflows): factor out test running * chore: add nightly tests Closes #2932
1 parent dcab693 commit 3be7ec9

File tree

3 files changed

+121
-41
lines changed

3 files changed

+121
-41
lines changed

.github/workflows/nightly.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Nightly tests
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 10 * * *"
7+
8+
jobs:
9+
test:
10+
if: github.repository == 'nodejs/undici'
11+
strategy:
12+
fail-fast: false
13+
max-parallel: 0
14+
matrix:
15+
runs-on:
16+
- ubuntu-latest
17+
- windows-latest
18+
- macos-latest
19+
uses: ./.github/workflows/test.yml
20+
with:
21+
node-version: 22-nightly
22+
runs-on: ${{ matrix.runs-on }}
23+
secrets: inherit
24+
25+
report-failure:
26+
if: failure()
27+
needs: test
28+
runs-on: ubuntu-latest
29+
permissions:
30+
issues: write
31+
steps:
32+
- name: Create or update issue
33+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
34+
with:
35+
script: |
36+
const ISSUE_TITLE = "Nightly tests are failing"
37+
38+
const actionRunUrl = "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
39+
40+
const issueContext = {
41+
owner: context.repo.owner,
42+
repo: context.repo.repo
43+
}
44+
45+
let issue = (await github.rest.issues.listForRepo({
46+
state: "open",
47+
creator: "github-actions[bot]",
48+
...issueContext
49+
})).data.find((issue) => issue.title === ISSUE_TITLE)
50+
51+
if(!issue) {
52+
issue = (await github.rest.issues.create({
53+
title: ISSUE_TITLE,
54+
...issueContext
55+
})).data
56+
}
57+
58+
await github.rest.issues.createComment({
59+
issue_number: issue.number,
60+
body: `Tests against nightly failed, see: ${actionRunUrl}`,
61+
...issueContext
62+
});

.github/workflows/nodejs.yml

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ jobs:
5151
run: npm run lint
5252

5353
test:
54-
name: Test with Node.js ${{ matrix.node-version }} on ${{ matrix.runs-on }}
55-
timeout-minutes: 15
5654
strategy:
5755
fail-fast: false
5856
max-parallel: 0
@@ -61,48 +59,15 @@ jobs:
6159
- 18
6260
- 20
6361
- 21
64-
runs-on:
62+
runs-on:
6563
- ubuntu-latest
6664
- windows-latest
6765
- macos-latest
68-
69-
runs-on: ${{ matrix.runs-on }}
70-
steps:
71-
- name: Checkout
72-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
73-
with:
74-
persist-credentials: false
75-
76-
- name: Setup Node.js@${{ matrix.node-version }}
77-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
78-
with:
79-
node-version: ${{ matrix.node-version }}
80-
81-
- name: Print version information
82-
run: |
83-
echo OS: $(node -p "os.version()")
84-
echo Node.js: $(node --version)
85-
echo npm: $(npm --version)
86-
echo git: $(git --version)
87-
88-
- name: Install dependencies
89-
run: npm install
90-
91-
- name: Print installed dependencies
92-
run: npm ls --all
93-
continue-on-error: true
94-
95-
- name: Run tests
96-
run: npm run coverage:ci
97-
env:
98-
CI: true
99-
NODE_V8_COVERAGE: ./coverage/tmp
100-
101-
- name: Coverage Report
102-
if: matrix.runs-on == 'ubuntu-latest' && matrix.node-version == 20
103-
uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0
104-
with:
105-
token: ${{ secrets.CODECOV_TOKEN }}
66+
uses: ./.github/workflows/test.yml
67+
with:
68+
node-version: ${{ matrix.node-version }}
69+
runs-on: ${{ matrix.runs-on }}
70+
secrets: inherit
10671

10772
test-types:
10873
name: Test TypeScript types

.github/workflows/test.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Run tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
node-version:
7+
required: true
8+
type: string
9+
runs-on:
10+
required: true
11+
type: string
12+
13+
jobs:
14+
test:
15+
name: Test with Node.js ${{ inputs.node-version }} on ${{ inputs.runs-on }}
16+
timeout-minutes: 15
17+
runs-on: ${{ inputs.runs-on }}
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
21+
with:
22+
persist-credentials: false
23+
24+
- name: Setup Node.js@${{ inputs.node-version }}
25+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
26+
with:
27+
node-version: ${{ inputs.node-version }}
28+
29+
- name: Print version information
30+
run: |
31+
echo OS: $(node -p "os.version()")
32+
echo Node.js: $(node --version)
33+
echo npm: $(npm --version)
34+
echo git: $(git --version)
35+
36+
- name: Install dependencies
37+
run: npm install
38+
39+
- name: Print installed dependencies
40+
run: npm ls --all
41+
continue-on-error: true
42+
43+
- name: Run tests
44+
run: npm run coverage:ci
45+
env:
46+
CI: true
47+
NODE_V8_COVERAGE: ./coverage/tmp
48+
49+
- name: Coverage Report
50+
if: inputs.runs-on == 'ubuntu-latest' && inputs.node-version == 20
51+
uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0
52+
with:
53+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)