Skip to content

Commit

Permalink
Chore: run tests daily against node nightly (#2969)
Browse files Browse the repository at this point in the history
* chore(.github/workflows): factor out test running

* chore: add nightly tests

Closes #2932
  • Loading branch information
mweberxyz committed Mar 16, 2024
1 parent dcab693 commit 3be7ec9
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 41 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Nightly tests

on:
workflow_dispatch:
schedule:
- cron: "0 10 * * *"

jobs:
test:
if: github.repository == 'nodejs/undici'
strategy:
fail-fast: false
max-parallel: 0
matrix:
runs-on:
- ubuntu-latest
- windows-latest
- macos-latest
uses: ./.github/workflows/test.yml
with:
node-version: 22-nightly
runs-on: ${{ matrix.runs-on }}
secrets: inherit

report-failure:
if: failure()
needs: test
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Create or update issue
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const ISSUE_TITLE = "Nightly tests are failing"
const actionRunUrl = "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
const issueContext = {
owner: context.repo.owner,
repo: context.repo.repo
}
let issue = (await github.rest.issues.listForRepo({
state: "open",
creator: "github-actions[bot]",
...issueContext
})).data.find((issue) => issue.title === ISSUE_TITLE)
if(!issue) {
issue = (await github.rest.issues.create({
title: ISSUE_TITLE,
...issueContext
})).data
}
await github.rest.issues.createComment({
issue_number: issue.number,
body: `Tests against nightly failed, see: ${actionRunUrl}`,
...issueContext
});
47 changes: 6 additions & 41 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ jobs:
run: npm run lint

test:
name: Test with Node.js ${{ matrix.node-version }} on ${{ matrix.runs-on }}
timeout-minutes: 15
strategy:
fail-fast: false
max-parallel: 0
Expand All @@ -61,48 +59,15 @@ jobs:
- 18
- 20
- 21
runs-on:
runs-on:
- ubuntu-latest
- windows-latest
- macos-latest

runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false

- name: Setup Node.js@${{ matrix.node-version }}
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ matrix.node-version }}

- name: Print version information
run: |
echo OS: $(node -p "os.version()")
echo Node.js: $(node --version)
echo npm: $(npm --version)
echo git: $(git --version)
- name: Install dependencies
run: npm install

- name: Print installed dependencies
run: npm ls --all
continue-on-error: true

- name: Run tests
run: npm run coverage:ci
env:
CI: true
NODE_V8_COVERAGE: ./coverage/tmp

- name: Coverage Report
if: matrix.runs-on == 'ubuntu-latest' && matrix.node-version == 20
uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
uses: ./.github/workflows/test.yml
with:
node-version: ${{ matrix.node-version }}
runs-on: ${{ matrix.runs-on }}
secrets: inherit

test-types:
name: Test TypeScript types
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Run tests

on:
workflow_call:
inputs:
node-version:
required: true
type: string
runs-on:
required: true
type: string

jobs:
test:
name: Test with Node.js ${{ inputs.node-version }} on ${{ inputs.runs-on }}
timeout-minutes: 15
runs-on: ${{ inputs.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false

- name: Setup Node.js@${{ inputs.node-version }}
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ inputs.node-version }}

- name: Print version information
run: |
echo OS: $(node -p "os.version()")
echo Node.js: $(node --version)
echo npm: $(npm --version)
echo git: $(git --version)
- name: Install dependencies
run: npm install

- name: Print installed dependencies
run: npm ls --all
continue-on-error: true

- name: Run tests
run: npm run coverage:ci
env:
CI: true
NODE_V8_COVERAGE: ./coverage/tmp

- name: Coverage Report
if: inputs.runs-on == 'ubuntu-latest' && inputs.node-version == 20
uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}

0 comments on commit 3be7ec9

Please sign in to comment.