Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
16 changes: 16 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,22 @@ jobs:
NODE=$(command -v node) make lint-md
env:
NODE_RELEASED_VERSIONS: ${{ steps.get-released-versions.outputs.NODE_RELEASED_VERSIONS }}
lint-nix:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
sparse-checkout: '*.nix'
sparse-checkout-cone-mode: false
- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
- name: Lint Nix files
run: nix-shell -I nixpkgs=./nixpkgs.nix -p 'nixfmt-tree' --run 'treefmt --quiet --fail-on-change'
- if: ${{ failure() }}
name: Show diff
run: git --no-pager diff

lint-py:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths-ignore:
- .mailmap
- README.md
- '*.nix'
- .github/**
- '!.github/workflows/test-linux.yml'
types: [opened, synchronize, reopened, ready_for_review]
Expand All @@ -17,6 +18,7 @@ on:
paths-ignore:
- .mailmap
- README.md
- '*.nix'
- .github/**
- '!.github/workflows/test-linux.yml'

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths-ignore:
- .mailmap
- '**.md'
- '*.nix'
- AUTHORS
- doc/**
- .github/**
Expand All @@ -19,6 +20,7 @@ on:
paths-ignore:
- .mailmap
- '**.md'
- '*.nix'
- AUTHORS
- doc/**
- .github/**
Expand Down
276 changes: 276 additions & 0 deletions .github/workflows/test-shared.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
name: Benchmark and shared librairies

on:
pull_request:
paths-ignore:
- .mailmap
- '**.md'
- AUTHORS
- doc/**
- .github/**
- '!.github/workflows/test-shared.yml'
types: [opened, synchronize, reopened, ready_for_review]
push:
branches:
- main
- canary
- v[0-9]+.x-staging
- v[0-9]+.x
paths-ignore:
- .mailmap
- '**.md'
- AUTHORS
- doc/**
- .github/**
- '!.github/workflows/test-shared.yml'
workflow_dispatch:
inputs:
repo:
type: string
description: GitHub repository to fetch from (default to the current repo)
pr_id:
type: number
required: true
description: The PR to test
commit:
required: true
type: string
description: The expect HEAD of the PR
category:
required: true
type: string
description: The category (or categories) of tests to run, for example buffers, cluster etc. Maps to a folders in node/benchmark
filter:
type: string
description: A substring to restrict the benchmarks to run in a category. e.g. `net-c2c`
runs:
type: number
default: 30
description: How many times to repeat each benchmark

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
FLAKY_TESTS: keep_retrying

permissions:
contents: read

jobs:
build-tarball:
if: github.event.pull_request.draft == false
name: ${{ github.event_name == 'workflow_dispatch' && 'Skipped job' || 'Build slim tarball' }}
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
if: ${{ github.event_name != 'workflow_dispatch' }}
with:
persist-credentials: false

- name: Patch npm gyp (to be able to build addons for the tests)
if: ${{ github.event_name != 'workflow_dispatch' }}
run: |
curl -L https://github.com/nodejs/gyp-next/commit/8224deef984add7e7afe846cfb82c9d3fa6da1fb.diff \
| git apply --directory=deps/npm/node_modules/node-gyp/gyp
git add deps/npm/node_modules/node-gyp/gyp
git config --local user.email "[email protected]"
git config --local user.name "Node.js GitHub Bot"
git commit --fixup HEAD

- name: Make tarball
if: ${{ github.event_name != 'workflow_dispatch' }}
run: |
export DATESTRING=$(date "+%Y-%m-%d")
export COMMIT=$(git rev-parse --short=10 "$GITHUB_SHA")
./configure && make tar -j4 SKIP_XZ=1 SKIP_SHARED_DEPS=1
env:
DISTTYPE: nightly


- name: Upload tarball artifact
if: ${{ github.event_name != 'workflow_dispatch' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: tarballs
path: '*.tar.gz'
compression-level: 0

build:
needs: build-tarball
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-24.04
system: x86_64-linux
- runner: ubuntu-24.04-arm
system: aarch64-linux
- runner: macos-13
system: x86_64-darwin
- runner: macos-latest
system: aarch64-darwin
name: '${{ matrix.system }}: with shared libraries'
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
if: ${{ github.event_name != 'workflow_dispatch' }}
with:
name: tarballs
path: tarballs

- name: Extract tarball
if: ${{ github.event_name != 'workflow_dispatch' }}
run: |
tar xzf tarballs/*.tar.gz -C "$RUNNER_TEMP"
echo "TAR_DIR=$RUNNER_TEMP/$(basename tarballs/*.tar.gz .tar.gz)" >> "$GITHUB_ENV"

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
repository: ${{ inputs.repo || github.repository }}
ref: refs/pull/${{ inputs.pr_id }}/merge
persist-credentials: false
fetch-depth: 2

- name: Validate PR head and roll back to base commit
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
[ "$(git rev-parse HEAD^2)" = "$EXPECTED_SHA" ]
git reset HEAD^ --hard
env:
EXPECTED_SHA: ${{ inputs.commit }}

- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
with:
extra_nix_config: sandbox = true

- name: Configure sccache
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
core.exportVariable('SCCACHE_GHA_VERSION', 'on');
core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on');
core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');

- name: Load shell.nix
if: github.event_name != 'workflow_dispatch'
run: mv "$TAR_DIR"/*.nix .

- name: Load shell.nix
if: github.event_name == 'workflow_dispatch'
run: |
[ -f shell.nix ] || curl -fsLSO https://github.com/${GITHUB_REPOSITORY}/raw/${GITHUB_SHA}/shell.nix
[ -f nixpkgs.nix ] || curl -fsLSO https://github.com/${GITHUB_REPOSITORY}/raw/${GITHUB_SHA}/nixpkgs.nix

- name: Build Node.js ${{ github.event_name == 'workflow_dispatch' && 'on the base commit' || 'and run tests' }}
run: |
nix-shell \
-I nixpkgs=./nixpkgs.nix \
--pure --keep TAR_DIR --keep FLAKY_TESTS \
--keep SCCACHE_GHA_VERSION --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \
--arg loadJSBuiltinsDynamically false \
--arg ccache '(import <nixpkgs> {}).sccache' \
--arg devTools '[]' \
--arg benchmarkTools '[]' \
--run '
make ${{ github.event_name == 'workflow_dispatch' && 'build' || '-C "$TAR_DIR" run' }}-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS"
'

- name: Re-build Node.js on the merge commit
# ccache is disabled here to avoid polluting the cache. Local build outputs should make this build relatively quick anyway.
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
mv out/Release/node base_node
git reset FETCH_HEAD --hard
nix-shell \
-I nixpkgs=./nixpkgs.nix \
--pure \
--arg loadJSBuiltinsDynamically false \
--arg ccache 'null' \
--arg devTools '[]' \
--arg benchmarkTools '[]' \
--run '
make -j4 V=1
'

- name: Run benchmark
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
nix-shell \
-I nixpkgs=./nixpkgs.nix \
--pure --keep FILTER \
--arg loadJSBuiltinsDynamically false \
--arg ccache 'null' \
--arg icu 'null' \
--arg sharedLibDeps '{}' \
--arg devTools '[]' \
--run '
set -o pipefail
./base_node benchmark/compare.js \
--filter "$FILTER" \
--runs ${{ inputs.runs }} \
--old ./base_node --new ./node \
-- ${{ inputs.category }} \
| tee /dev/stderr \
> ${{ matrix.system }}.csv
echo 'Benchmark results:'
echo
echo '```'
Rscript benchmark/compare.R < ${{ matrix.system }}.csv
echo '```'
' | tee /dev/stderr >> "$GITHUB_STEP_SUMMARY"
env:
FILTER: ${{ inputs.filter }}

- name: Upload raw benchmark results
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: csv-${{ matrix.system }}
path: ${{ matrix.system }}.csv

aggregate-benchmark-results:
needs: build
name: Aggregate benchmark results
if: ${{ github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
sparse-checkout: |
benchmark/*.R
*.nix
sparse-checkout-cone-mode: false

- name: Download benchmark raw results
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
pattern: csv-*
merge-multiple: true
path: raw-results

- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
with:
extra_nix_config: sandbox = true

- name: Benchmark results
run: |
nix-shell \
-I nixpkgs=./nixpkgs.nix \
--pure \
--arg loadJSBuiltinsDynamically false \
--arg ccache 'null' \
--arg icu 'null' \
--arg sharedLibDeps '{}' \
--arg devTools '[]' \
--run '
echo 'Benchmark results:'
echo
echo '```'
awk "FNR==1 && NR!=1{next;}{print}" raw-results/*.csv | Rscript benchmark/compare.R
echo '```'
' | tee /dev/stderr >> "$GITHUB_STEP_SUMMARY"
12 changes: 12 additions & 0 deletions .github/workflows/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ on:
- llhttp
- minimatch
- nbytes
- nixpkgs-unstable
- nghttp2
- nghttp3
- ngtcp2
Expand Down Expand Up @@ -198,6 +199,14 @@ jobs:
cat temp-output
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
rm temp-output
- id: nixpkgs-unstable
subsystem: tools
label: tools
run: |
./tools/dep_updaters/update-nixpkgs-pin.sh > temp-output
cat temp-output
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
rm temp-output
- id: nghttp2
subsystem: deps
label: dependencies
Expand Down Expand Up @@ -297,6 +306,9 @@ jobs:
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Nix
if: matrix.id == 'nixpkgs-unstable' && (github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id)
uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
- run: ${{ matrix.run }}
if: github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id
env:
Expand Down
Loading