mirror of https://github.com/nodejs/node.git
110 lines
3.2 KiB
YAML
110 lines
3.2 KiB
YAML
name: linters
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
- v[0-9]+.x-staging
|
|
- v[0-9]+.x
|
|
|
|
env:
|
|
PYTHON_VERSION: 3.9
|
|
NODE_VERSION: 14.x
|
|
|
|
jobs:
|
|
lint-addon-docs:
|
|
if: github.event.pull_request.draft == false
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Use Node.js ${{ env.NODE_VERSION }}
|
|
uses: actions/setup-node@v1
|
|
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-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
- name: Environment Information
|
|
run: npx envinfo
|
|
- name: Lint C/C++ files
|
|
run: make lint-cpp
|
|
lint-md:
|
|
if: github.event.pull_request.draft == false
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Use Node.js ${{ env.NODE_VERSION }}
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
- name: Environment Information
|
|
run: npx envinfo
|
|
- name: Lint docs
|
|
run: |
|
|
echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json"
|
|
NODE=$(command -v node) make lint-md
|
|
lint-js:
|
|
if: github.event.pull_request.draft == false
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Use Node.js ${{ env.NODE_VERSION }}
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
- name: Environment Information
|
|
run: npx envinfo
|
|
- name: Lint JavaScript files
|
|
run: NODE=$(command -v node) make lint-js
|
|
lint-py:
|
|
if: github.event.pull_request.draft == false
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
- name: Environment Information
|
|
run: npx envinfo
|
|
- name: Lint Python
|
|
run: |
|
|
make lint-py-build || true
|
|
NODE=$(command -v node) make lint-py
|
|
lint-sh:
|
|
if: github.event.pull_request.draft == false
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- run: shellcheck -V
|
|
- name: Lint Shell scripts
|
|
run: tools/lint-sh.js .
|
|
lint-codeowners:
|
|
if: github.event.pull_request.draft == false
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: mszostok/codeowners-validator@v0.4.0
|
|
with:
|
|
checks: "files,duppatterns"
|
|
lint-pr-url:
|
|
if: ${{ github.event.pull_request }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 2
|
|
# 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 }}
|