Skip to content

Commit 97aabc6

Browse files
committed
tools: test treefmt PR
PR-URL: https://github.com/nodejs/node/pull/00000
1 parent 0998c37 commit 97aabc6

File tree

1 file changed

+3
-242
lines changed

1 file changed

+3
-242
lines changed

.github/workflows/linters.yml

Lines changed: 3 additions & 242 deletions
Original file line numberDiff line numberDiff line change
@@ -21,128 +21,12 @@ permissions:
2121
contents: read
2222

2323
jobs:
24-
lint-addon-docs:
25-
if: github.event.pull_request.draft == false
26-
runs-on: ubuntu-slim
27-
steps:
28-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
29-
with:
30-
persist-credentials: false
31-
- name: Use Node.js ${{ env.NODE_VERSION }}
32-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
33-
with:
34-
node-version: ${{ env.NODE_VERSION }}
35-
- name: Environment Information
36-
run: npx envinfo
37-
- name: Lint addon docs
38-
run: NODE=$(command -v node) make lint-addon-docs
39-
lint-cpp:
40-
if: github.event.pull_request.draft == false
41-
runs-on: ubuntu-slim
42-
steps:
43-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
44-
with:
45-
persist-credentials: false
46-
- name: Set up Python ${{ env.PYTHON_VERSION }}
47-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
48-
with:
49-
python-version: ${{ env.PYTHON_VERSION }}
50-
allow-prereleases: true
51-
- name: Environment Information
52-
run: npx envinfo
53-
- name: Lint C/C++ files
54-
run: make lint-cpp
55-
format-cpp:
56-
if: ${{ github.event.pull_request && github.event.pull_request.draft == false && github.base_ref == github.event.repository.default_branch }}
57-
runs-on: ubuntu-slim
58-
steps:
59-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
60-
with:
61-
fetch-depth: 0
62-
persist-credentials: false
63-
- name: Use Node.js ${{ env.NODE_VERSION }}
64-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
65-
with:
66-
node-version: ${{ env.NODE_VERSION }}
67-
- name: Set up Python ${{ env.PYTHON_VERSION }}
68-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
69-
with:
70-
python-version: ${{ env.PYTHON_VERSION }}
71-
allow-prereleases: true
72-
- name: Environment Information
73-
run: npx envinfo
74-
- name: Format C/C++ files
75-
run: |
76-
make format-cpp-build
77-
# The `make format-cpp` error code is intentionally ignored here
78-
# because it is irrelevant. We already check if the formatter produced
79-
# a diff in the next line.
80-
# Refs: https://github.com/nodejs/node/pull/42764
81-
CLANG_FORMAT_START="$(git merge-base HEAD refs/remotes/origin/$GITHUB_BASE_REF)" \
82-
make format-cpp || true
83-
git --no-pager diff --exit-code && EXIT_CODE="$?" || EXIT_CODE="$?"
84-
if [ "$EXIT_CODE" != "0" ]
85-
then
86-
echo
87-
echo 'ERROR: Please run:'
88-
echo
89-
echo " CLANG_FORMAT_START="$\(git merge-base HEAD ${GITHUB_BASE_REF}\)" make format-cpp"
90-
echo
91-
echo 'to format the commits in your branch.'
92-
exit "$EXIT_CODE"
93-
fi
94-
lint-js-and-md:
95-
if: github.event.pull_request.draft == false
96-
runs-on: ubuntu-slim
97-
steps:
98-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
99-
with:
100-
persist-credentials: false
101-
- name: Use Node.js ${{ env.NODE_VERSION }}
102-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
103-
with:
104-
node-version: ${{ env.NODE_VERSION }}
105-
- name: Environment Information
106-
run: npx envinfo
107-
- name: Lint JavaScript files
108-
run: |
109-
set +e
110-
NODE=$(command -v node) make lint-js
111-
EXIT_CODE="$?"
112-
if [ "$EXIT_CODE" != "0" ]; then
113-
echo
114-
echo 'ERROR: The JavaScript lint validation failed (the errors are logged above).'
115-
echo ' Please fix the lint errors.'
116-
if NODE=$(command -v node) make lint-js-fix > /dev/null 2>&1; then
117-
echo ' Run:'
118-
echo ' make lint-js-fix'
119-
echo ' to fix the lint issues.'
120-
git --no-pager diff
121-
elif git diff --quiet --exit-code; then
122-
echo ' None of the issue is auto-fixable, so manual fixes for'
123-
echo ' all of the issues are required.'
124-
else
125-
echo ' Run:'
126-
echo ' make lint-js-fix'
127-
echo ' to fix the auto-fixable lint issues.'
128-
echo ' Note that some manual fixes are also required.'
129-
fi
130-
echo
131-
exit "$EXIT_CODE"
132-
fi
133-
- name: Get release version numbers
134-
if: ${{ github.event.pull_request && github.event.pull_request.base.ref == github.event.pull_request.base.repo.default_branch }}
135-
id: get-released-versions
136-
run: ./tools/lint-md/list-released-versions-from-changelogs.mjs >> $GITHUB_OUTPUT
137-
- name: Lint markdown files
138-
run: |
139-
echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json"
140-
NODE=$(command -v node) make lint-md
141-
env:
142-
NODE_RELEASED_VERSIONS: ${{ steps.get-released-versions.outputs.NODE_RELEASED_VERSIONS }}
14324
lint-nix:
14425
if: github.event.pull_request.draft == false
14526
runs-on: ubuntu-slim
27+
strategy:
28+
matrix:
29+
n: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, h, i, j, k, l, m, 'n', o, p, q, r, s, t, u, v, w, x, 'y', z]
14630
steps:
14731
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
14832
with:
@@ -160,126 +44,3 @@ jobs:
16044
git --no-pager diff || true
16145
exit "$EXIT_CODE"
16246
fi
163-
164-
lint-py:
165-
if: github.event.pull_request.draft == false
166-
runs-on: ubuntu-slim
167-
steps:
168-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
169-
with:
170-
persist-credentials: false
171-
sparse-checkout: |
172-
/Makefile
173-
/benchmark/
174-
/doc/
175-
/lib/
176-
/src/node_version.h
177-
/tools/
178-
pyproject.toml
179-
*.py
180-
sparse-checkout-cone-mode: false
181-
- name: Set up Python ${{ env.PYTHON_VERSION }}
182-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
183-
with:
184-
python-version: ${{ env.PYTHON_VERSION }}
185-
allow-prereleases: true
186-
- name: Environment Information
187-
run: npx envinfo
188-
- name: Lint Python
189-
run: |
190-
make lint-py-build
191-
make lint-py
192-
lint-yaml:
193-
if: github.event.pull_request.draft == false
194-
runs-on: ubuntu-slim
195-
steps:
196-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
197-
with:
198-
persist-credentials: false
199-
sparse-checkout: |
200-
/Makefile
201-
/tools/pip/
202-
*.yml
203-
*.yaml
204-
sparse-checkout-cone-mode: false
205-
- name: Use Python ${{ env.PYTHON_VERSION }}
206-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
207-
with:
208-
python-version: ${{ env.PYTHON_VERSION }}
209-
allow-prereleases: true
210-
- name: Environment Information
211-
run: npx envinfo
212-
- name: Lint YAML
213-
run: |
214-
make lint-yaml-build || true
215-
make lint-yaml
216-
217-
lint-sh:
218-
if: github.event.pull_request.draft == false
219-
runs-on: ubuntu-slim
220-
steps:
221-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
222-
with:
223-
persist-credentials: false
224-
sparse-checkout: |
225-
/tools/lint-sh.mjs
226-
*.sh
227-
sparse-checkout-cone-mode: false
228-
- run: shellcheck -V
229-
- name: Lint Shell scripts
230-
run: tools/lint-sh.mjs .
231-
lint-codeowners:
232-
if: github.event.pull_request.draft == false
233-
# cannot use ubuntu-slim here because mszostok/codeowners-validator is dockerized
234-
# cannot use ubuntu-24.04-arm here because the docker image is x86 only
235-
runs-on: ubuntu-latest
236-
steps:
237-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
238-
with:
239-
persist-credentials: false
240-
- uses: mszostok/codeowners-validator@7f3f5e28c6d7b8dfae5731e54ce2272ca384592f
241-
with:
242-
checks: files,duppatterns
243-
lint-pr-url:
244-
if: ${{ github.event.pull_request }}
245-
runs-on: ubuntu-slim
246-
steps:
247-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
248-
with:
249-
fetch-depth: 2
250-
persist-credentials: false
251-
sparse-checkout: |
252-
/tools/lint-pr-url.mjs
253-
/doc/api/
254-
sparse-checkout-cone-mode: false
255-
# GH Actions squashes all PR commits, HEAD^ refers to the base branch.
256-
- run: git diff HEAD^ HEAD -G"pr-url:" -- "*.md" | ./tools/lint-pr-url.mjs ${{ github.event.pull_request.html_url }}
257-
lint-readme:
258-
runs-on: ubuntu-slim
259-
steps:
260-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
261-
with:
262-
persist-credentials: false
263-
sparse-checkout: |
264-
README.md
265-
/tools/lint-readme-lists.mjs
266-
sparse-checkout-cone-mode: false
267-
- name: Get team members if possible
268-
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 }}
269-
id: team_members
270-
run: |
271-
get_list_members() {
272-
TEAM="$1"
273-
QUOTE='"'
274-
gh api "/orgs/nodejs/teams/$TEAM/members" -X GET -f per_page=100 --jq "map(.login) | ${QUOTE}${TEAM}=\(tojson)${QUOTE}"
275-
}
276-
[ -z "$GITHUB_TOKEN" ] || (
277-
get_list_members "collaborators"
278-
get_list_members "issue-triage"
279-
get_list_members "tsc"
280-
) >> "$GITHUB_OUTPUT"
281-
env:
282-
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
283-
- run: tools/lint-readme-lists.mjs "$TEAMS"
284-
env:
285-
TEAMS: ${{ tojson(steps.team_members.outputs) }}

0 commit comments

Comments
 (0)