mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Add cmakelint to CI (#35525)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/35525 Differential Revision: D20696655 Pulled By: malfet fbshipit-source-id: 1b15cd730066c8a80440b39110f7f0d51f8ebad0
This commit is contained in:
committed by
Facebook GitHub Bot
parent
58f5a89c9a
commit
25fe7f33ce
1
.cmakelintrc
Normal file
1
.cmakelintrc
Normal file
@ -0,0 +1 @@
|
||||
filter=-convention/filename,-linelength,-package/consistency,-readability/logic,+readability/mixedcase,-readability/wonkycase,-syntax,-whitespace/eol,+whitespace/extra,-whitespace/indent,-whitespace/mismatch,-whitespace/newline,-whitespace/tabs
|
29
.github/workflows/lint.yml
vendored
29
.github/workflows/lint.yml
vendored
@ -172,3 +172,32 @@ jobs:
|
||||
regex: '^(?<filename>.*?):(?<lineNumber>\d+):(?<columnNumber>\d+): (?<errorDesc>.*?) \[(?<errorCode>.*)\]'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
cmakelint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.x
|
||||
architecture: x64
|
||||
- name: Fetch PyTorch
|
||||
uses: actions/checkout@v1
|
||||
- name: Checkout PR tip
|
||||
run: |
|
||||
set -eux
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
# We are on a PR, so actions/checkout leaves us on a merge commit.
|
||||
# Check out the actual tip of the branch.
|
||||
git checkout ${{ github.event.pull_request.head.sha }}
|
||||
fi
|
||||
echo ::set-output name=commit_sha::$(git rev-parse HEAD)
|
||||
id: get_pr_tip
|
||||
- name: Run cmakelint
|
||||
run: |
|
||||
set -eux
|
||||
pip install cmakelint
|
||||
cmakelint --version
|
||||
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | \
|
||||
grep -E -z -v '^(cmake/Modules/|cmake/Modules_CUDA_fix/)' | \
|
||||
xargs -0 cmakelint --config=.cmakelintrc --spaces=2 --quiet
|
||||
|
Reference in New Issue
Block a user