Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: run tests daily against node nightly #2969

Merged
merged 2 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 * * *"
Copy link
Contributor Author

@mweberxyz mweberxyz Mar 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most days the nightly lands between 7:30-9:30 - see dates here: https://nodejs.org/download/nightly/


jobs:
test:
if: github.repository == 'nodejs/undici'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be kind to forks, only run in upstream repo.

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 }}