diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index eb86e8e8c5..9d673548ac 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -21,128 +21,269 @@ permissions: contents: read jobs: - lint-addon-docs: - if: github.event.pull_request.draft == false - runs-on: ubuntu-slim - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Environment Information - run: npx envinfo - - name: Lint addon docs - run: NODE=$(command -v node) make lint-addon-docs - lint-cpp: - if: github.event.pull_request.draft == false - runs-on: ubuntu-slim - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - allow-prereleases: true - - name: Environment Information - run: npx envinfo - - name: Lint C/C++ files - run: make lint-cpp - format-cpp: - if: ${{ github.event.pull_request && github.event.pull_request.draft == false && github.base_ref == github.event.repository.default_branch }} - runs-on: ubuntu-slim - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - fetch-depth: 0 - persist-credentials: false - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - allow-prereleases: true - - name: Environment Information - run: npx envinfo - - name: Format C/C++ files - run: | - make format-cpp-build - # The `make format-cpp` error code is intentionally ignored here - # because it is irrelevant. We already check if the formatter produced - # a diff in the next line. - # Refs: https://github.com/nodejs/node/pull/42764 - CLANG_FORMAT_START="$(git merge-base HEAD refs/remotes/origin/$GITHUB_BASE_REF)" \ - make format-cpp || true - git --no-pager diff --exit-code && EXIT_CODE="$?" || EXIT_CODE="$?" - if [ "$EXIT_CODE" != "0" ] - then - echo - echo 'ERROR: Please run:' - echo - echo " CLANG_FORMAT_START="$\(git merge-base HEAD ${GITHUB_BASE_REF}\)" make format-cpp" - echo - echo 'to format the commits in your branch.' - exit "$EXIT_CODE" - fi - lint-js-and-md: - if: github.event.pull_request.draft == false - runs-on: ubuntu-slim - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Environment Information - run: npx envinfo - - name: Lint JavaScript files - run: | - set +e - NODE=$(command -v node) make lint-js - EXIT_CODE="$?" - if [ "$EXIT_CODE" != "0" ]; then - echo - echo 'ERROR: The JavaScript lint validation failed (the errors are logged above).' - echo ' Please fix the lint errors.' - if NODE=$(command -v node) make lint-js-fix > /dev/null 2>&1; then - echo ' Run:' - echo ' make lint-js-fix' - echo ' to fix the lint issues.' - git --no-pager diff - elif git diff --quiet --exit-code; then - echo ' None of the issue is auto-fixable, so manual fixes for' - echo ' all of the issues are required.' - else - echo ' Run:' - echo ' make lint-js-fix' - echo ' to fix the auto-fixable lint issues.' - echo ' Note that some manual fixes are also required.' - fi - echo - exit "$EXIT_CODE" - fi - - name: Get release version numbers - if: ${{ github.event.pull_request && github.event.pull_request.base.ref == github.event.pull_request.base.repo.default_branch }} - id: get-released-versions - run: ./tools/lint-md/list-released-versions-from-changelogs.mjs >> $GITHUB_OUTPUT - - name: Lint markdown files - run: | - echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json" - 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-slim + strategy: + matrix: + n: [ + 0x00, + 0x01, + 0x02, + 0x03, + 0x04, + 0x05, + 0x06, + 0x07, + 0x08, + 0x09, + 0x0a, + 0x0b, + 0x0c, + 0x0d, + 0x0e, + 0x0f, + 0x10, + 0x11, + 0x12, + 0x13, + 0x14, + 0x15, + 0x16, + 0x17, + 0x18, + 0x19, + 0x1a, + 0x1b, + 0x1c, + 0x1d, + 0x1e, + 0x1f, + 0x20, + 0x21, + 0x22, + 0x23, + 0x24, + 0x25, + 0x26, + 0x27, + 0x28, + 0x29, + 0x2a, + 0x2b, + 0x2c, + 0x2d, + 0x2e, + 0x2f, + 0x30, + 0x31, + 0x32, + 0x33, + 0x34, + 0x35, + 0x36, + 0x37, + 0x38, + 0x39, + 0x3a, + 0x3b, + 0x3c, + 0x3d, + 0x3e, + 0x3f, + 0x40, + 0x41, + 0x42, + 0x43, + 0x44, + 0x45, + 0x46, + 0x47, + 0x48, + 0x49, + 0x4a, + 0x4b, + 0x4c, + 0x4d, + 0x4e, + 0x4f, + 0x50, + 0x51, + 0x52, + 0x53, + 0x54, + 0x55, + 0x56, + 0x57, + 0x58, + 0x59, + 0x5a, + 0x5b, + 0x5c, + 0x5d, + 0x5e, + 0x5f, + 0x60, + 0x61, + 0x62, + 0x63, + 0x64, + 0x65, + 0x66, + 0x67, + 0x68, + 0x69, + 0x6a, + 0x6b, + 0x6c, + 0x6d, + 0x6e, + 0x6f, + 0x70, + 0x71, + 0x72, + 0x73, + 0x74, + 0x75, + 0x76, + 0x77, + 0x78, + 0x79, + 0x7a, + 0x7b, + 0x7c, + 0x7d, + 0x7e, + 0x7f, + 0x80, + 0x81, + 0x82, + 0x83, + 0x84, + 0x85, + 0x86, + 0x87, + 0x88, + 0x89, + 0x8a, + 0x8b, + 0x8c, + 0x8d, + 0x8e, + 0x8f, + 0x90, + 0x91, + 0x92, + 0x93, + 0x94, + 0x95, + 0x96, + 0x97, + 0x98, + 0x99, + 0x9a, + 0x9b, + 0x9c, + 0x9d, + 0x9e, + 0x9f, + 0xa0, + 0xa1, + 0xa2, + 0xa3, + 0xa4, + 0xa5, + 0xa6, + 0xa7, + 0xa8, + 0xa9, + 0xaa, + 0xab, + 0xac, + 0xad, + 0xae, + 0xaf, + 0xb0, + 0xb1, + 0xb2, + 0xb3, + 0xb4, + 0xb5, + 0xb6, + 0xb7, + 0xb8, + 0xb9, + 0xba, + 0xbb, + 0xbc, + 0xbd, + 0xbe, + 0xbf, + 0xc0, + 0xc1, + 0xc2, + 0xc3, + 0xc4, + 0xc5, + 0xc6, + 0xc7, + 0xc8, + 0xc9, + 0xca, + 0xcb, + 0xcc, + 0xcd, + 0xce, + 0xcf, + 0xd0, + 0xd1, + 0xd2, + 0xd3, + 0xd4, + 0xd5, + 0xd6, + 0xd7, + 0xd8, + 0xd9, + 0xda, + 0xdb, + 0xdc, + 0xdd, + 0xde, + 0xdf, + 0xe0, + 0xe1, + 0xe2, + 0xe3, + 0xe4, + 0xe5, + 0xe6, + 0xe7, + 0xe8, + 0xe9, + 0xea, + 0xeb, + 0xec, + 0xed, + 0xee, + 0xef, + 0xf0, + 0xf1, + 0xf2, + 0xf3, + 0xf4, + 0xf5, + 0xf6, + 0xf7, + 0xf8, + 0xf9, + 0xfa, + 0xfb, + 0xfc, + 0xfd, + 0xfe, + 0xff, + ] steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -160,126 +301,3 @@ jobs: git --no-pager diff || true exit "$EXIT_CODE" fi - - lint-py: - if: github.event.pull_request.draft == false - runs-on: ubuntu-slim - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - sparse-checkout: | - /Makefile - /benchmark/ - /doc/ - /lib/ - /src/node_version.h - /tools/ - pyproject.toml - *.py - sparse-checkout-cone-mode: false - - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - allow-prereleases: true - - name: Environment Information - run: npx envinfo - - name: Lint Python - run: | - make lint-py-build - make lint-py - lint-yaml: - if: github.event.pull_request.draft == false - runs-on: ubuntu-slim - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - sparse-checkout: | - /Makefile - /tools/pip/ - *.yml - *.yaml - sparse-checkout-cone-mode: false - - name: Use Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - allow-prereleases: true - - name: Environment Information - run: npx envinfo - - name: Lint YAML - run: | - make lint-yaml-build || true - make lint-yaml - - lint-sh: - if: github.event.pull_request.draft == false - runs-on: ubuntu-slim - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - sparse-checkout: | - /tools/lint-sh.mjs - *.sh - sparse-checkout-cone-mode: false - - run: shellcheck -V - - name: Lint Shell scripts - run: tools/lint-sh.mjs . - lint-codeowners: - if: github.event.pull_request.draft == false - # cannot use ubuntu-slim here because mszostok/codeowners-validator is dockerized - # cannot use ubuntu-24.04-arm here because the docker image is x86 only - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - uses: mszostok/codeowners-validator@7f3f5e28c6d7b8dfae5731e54ce2272ca384592f - with: - checks: files,duppatterns - lint-pr-url: - if: ${{ github.event.pull_request }} - runs-on: ubuntu-slim - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - fetch-depth: 2 - persist-credentials: false - sparse-checkout: | - /tools/lint-pr-url.mjs - /doc/api/ - sparse-checkout-cone-mode: false - # GH Actions squashes all PR commits, HEAD^ refers to the base branch. - - run: git diff HEAD^ HEAD -G"pr-url:" -- "*.md" | ./tools/lint-pr-url.mjs ${{ github.event.pull_request.html_url }} - lint-readme: - runs-on: ubuntu-slim - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - sparse-checkout: | - README.md - /tools/lint-readme-lists.mjs - sparse-checkout-cone-mode: false - - name: Get team members if possible - if: ${{ (github.event.pull_request && github.event.pull_request.base.ref == github.event.pull_request.base.repo.default_branch) || github.event.ref == github.event.repository.default_branch }} - id: team_members - run: | - get_list_members() { - TEAM="$1" - QUOTE='"' - gh api "/orgs/nodejs/teams/$TEAM/members" -X GET -f per_page=100 --jq "map(.login) | ${QUOTE}${TEAM}=\(tojson)${QUOTE}" - } - [ -z "$GITHUB_TOKEN" ] || ( - get_list_members "collaborators" - get_list_members "issue-triage" - get_list_members "tsc" - ) >> "$GITHUB_OUTPUT" - env: - GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }} - - run: tools/lint-readme-lists.mjs "$TEAMS" - env: - TEAMS: ${{ tojson(steps.team_members.outputs) }} diff --git a/tools/doc/package-lock.json b/tools/doc/package-lock.json index 70e5728c99..729144b831 100644 --- a/tools/doc/package-lock.json +++ b/tools/doc/package-lock.json @@ -6,7 +6,7 @@ "": { "name": "doc", "dependencies": { - "@node-core/doc-kit": "1.0.2" + "@node-core/doc-kit": "1.2.1" } }, "node_modules/@actions/core": { @@ -519,33 +519,34 @@ } }, "node_modules/@node-core/doc-kit": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@node-core/doc-kit/-/doc-kit-1.0.2.tgz", - "integrity": "sha512-dYTh29FRH7Qcbz8M1WbAu1tg2YVcmCEdt514QcDqJWsRrYJfvzg10OyDODyEPJfKZ4+OUN/VPi3knGoGfOSNkQ==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@node-core/doc-kit/-/doc-kit-1.2.1.tgz", + "integrity": "sha512-BQxHKolHLEBqHi4UJCeLehTL9ia3uOcjB5Aw0FYqmmYUxDxq0jCDrx9LvHlm0adjoLPwAH+0NJ4xu2dU4V0cPA==", "dependencies": { "@actions/core": "^3.0.0", "@heroicons/react": "^2.2.0", "@minify-html/wasm": "^0.18.1", "@node-core/rehype-shiki": "^1.4.1", - "@node-core/ui-components": "^1.6.1", + "@node-core/ui-components": "^1.6.3", "@orama/orama": "^3.1.18", "@orama/ui": "^1.5.4", "@rollup/plugin-virtual": "^3.0.2", "@swc/html-wasm": "^1.15.18", "acorn": "^8.16.0", "commander": "^14.0.3", - "dedent": "^1.7.1", + "dedent": "^1.7.2", "estree-util-to-js": "^2.0.0", "estree-util-visit": "^2.0.0", "github-slugger": "^2.0.0", + "glob-parent": "^6.0.2", "globals": "^17.3.0", "hast-util-to-string": "^3.0.1", "hastscript": "^9.0.1", - "lightningcss-wasm": "^1.31.1", + "lightningcss-wasm": "^1.32.0", "mdast-util-slice-markdown": "^2.0.1", "piscina": "^5.1.4", - "preact": "^10.28.4", - "preact-render-to-string": "^6.6.3", + "preact": "^10.29.0", + "preact-render-to-string": "^6.6.6", "reading-time": "^1.5.0", "recma-jsx": "^1.0.1", "rehype-raw": "^7.0.0", @@ -555,7 +556,7 @@ "remark-parse": "^11.0.0", "remark-rehype": "^11.1.2", "remark-stringify": "^11.0.0", - "rolldown": "^1.0.0-rc.6", + "rolldown": "^1.0.0-rc.10", "semver": "^7.7.4", "shiki": "^4.0.0", "tinyglobby": "^0.2.15", @@ -566,13 +567,24 @@ "unist-util-remove": "^4.0.0", "unist-util-select": "^5.1.0", "unist-util-visit": "^5.1.0", - "vfile": "^6.0.3", - "yaml": "^2.8.2" + "yaml": "^2.8.3" }, "bin": { "doc-kit": "bin/cli.mjs" } }, + "node_modules/@node-core/doc-kit/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/@node-core/rehype-shiki": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/@node-core/rehype-shiki/-/rehype-shiki-1.4.1.tgz", diff --git a/tools/doc/package.json b/tools/doc/package.json index 9d143e9724..ca1ac8ca37 100644 --- a/tools/doc/package.json +++ b/tools/doc/package.json @@ -2,6 +2,6 @@ "name": "doc", "private": true, "dependencies": { - "@node-core/doc-kit": "1.0.2" + "@node-core/doc-kit": "1.2.1" } } diff --git a/tools/nix/pkgs.nix b/tools/nix/pkgs.nix index b9c9654395..b080914824 100644 --- a/tools/nix/pkgs.nix +++ b/tools/nix/pkgs.nix @@ -1,21 +1,10 @@ arg: let repo = "https://github.com/NixOS/nixpkgs"; - rev = "832efc09b4caf6b4569fbf9dc01bec3082a00611"; + rev = "a6522db5b947cd7026a40d02acc3ca261364e9c8"; nixpkgs = import (builtins.fetchTarball { url = "${repo}/archive/${rev}.tar.gz"; - sha256 = "1sxhlp1khk9ifh24lcg5qland4pg056l5jhyfw8xq3qmpavf390x"; + sha256 = "0md4mhjs9vmb261hqzz5x1nq7a5nw0lhc0zkwh8550g61f6q5n67"; }) arg; in nixpkgs -// { - nixfmt-tree = nixpkgs.nixfmt-tree.overrideAttrs (old: { - patches = (old.patches or [ ]) ++ [ - (nixpkgs.fetchpatch2 { - url = "https://github.com/numtide/treefmt/commit/b96016b4e38ffc76518087b3b0c9bbfa190d5225.patch?full_index=1"; - revert = true; - hash = "sha256-DcxT2OGPX6Kmxhqa56DjZsSh2hoyhPyVmE17ULeryv8="; - }) - ]; - }); -}