mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
port the rest of the linters over to github actions
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27768 Test Plan: Imported from OSS Differential Revision: D17888973 Pulled By: suo fbshipit-source-id: 635bef7854084404d08673d99b1bae502e0dc833
This commit is contained in:
committed by
Facebook Github Bot
parent
57d4f8e3d7
commit
ba20ad999c
128
.github/workflows/lint.yml
vendored
128
.github/workflows/lint.yml
vendored
@ -7,6 +7,92 @@ on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
consistent-circleci:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7.4
|
||||
architecture: x64
|
||||
- name: Checkout PyTorch
|
||||
uses: actions/checkout@master
|
||||
- name: Ensure consistent CircleCI YAML config
|
||||
run: |
|
||||
pip install -r requirements.txt
|
||||
cd .circleci && ./ensure-consistency.py
|
||||
|
||||
validate-docker-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7.4
|
||||
architecture: x64
|
||||
- name: Checkout PyTorch
|
||||
uses: actions/checkout@master
|
||||
- name: Ensure Docker version is correctly deployed
|
||||
run: .circleci/validate-docker-version.py
|
||||
|
||||
shellcheck-jenkins:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: actions/checkout@master
|
||||
- name: Shellcheck Jenkins scripts
|
||||
run: |
|
||||
sudo apt-get install -y shellcheck
|
||||
.jenkins/run-shellcheck.sh
|
||||
|
||||
ensure-no-tabs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: actions/checkout@master
|
||||
- name: Ensure no tabs
|
||||
run: |
|
||||
(! git grep -I -l $'\t' -- . ':(exclude)*.svg' ':(exclude)**Makefile' ':(exclude)**/contrib/**' ':(exclude)third_party' ':(exclude).gitattributes' ':(exclude).gitmodules' || (echo "The above files have tabs; please convert them to spaces"; false))
|
||||
|
||||
ensure-not-executable:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: actions/checkout@master
|
||||
- name: Ensure C++ source files are not executable
|
||||
run: |
|
||||
(! find . \( -path ./third_party -o -path ./.git -o -path ./torch/bin -o -path ./build \) -prune -o -type f -executable -regextype posix-egrep -not -regex '.+(\.(bash|sh|py|so)|git-pre-commit)$' -print | grep . || (echo 'The above files have executable permission; please remove their executable permission by using `chmod -x`'; false))
|
||||
|
||||
mypy-typecheck:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7.4
|
||||
architecture: x64
|
||||
- name: Checkout PyTorch
|
||||
uses: actions/checkout@master
|
||||
- name: MyPy typecheck
|
||||
run: |
|
||||
pip install mypy mypy-extensions
|
||||
mypy @mypy-files.txt
|
||||
|
||||
cpp_doc_check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7.4
|
||||
architecture: x64
|
||||
- name: Checkout PyTorch
|
||||
uses: actions/checkout@master
|
||||
- name: C++ docs check
|
||||
run: |
|
||||
sudo apt-get install -y doxygen && pip install -r requirements.txt
|
||||
cd docs/cpp/source && ./check-doxygen.sh
|
||||
|
||||
flake8-py3:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@ -47,6 +133,48 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
flake8-py2:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 2.x
|
||||
architecture: x64
|
||||
- name: Fetch PyTorch
|
||||
uses: actions/checkout@master
|
||||
- name: Checkout PR tip
|
||||
run: |
|
||||
set -eux
|
||||
if [ -z "${GITHUB_HEAD_REF}" ]; then
|
||||
# We are on master, just set the SHA from our current location
|
||||
echo ::set-output name=commit_sha::${GITHUB_SHA}
|
||||
else
|
||||
# We are on a PR, so actions/checkout leaves us on merge commit.
|
||||
# Check out the actual tip of the branch.
|
||||
PR_TIP=$(git rev-parse HEAD^2)
|
||||
git checkout ${PR_TIP}
|
||||
echo ::set-output name=commit_sha::${PR_TIP}
|
||||
fi
|
||||
id: get_pr_tip
|
||||
- name: Run flake8
|
||||
run: |
|
||||
set -eux
|
||||
pip install flake8
|
||||
rm -rf .circleci
|
||||
flake8 --exit-zero > ${GITHUB_WORKSPACE}/flake8-output.txt
|
||||
cat ${GITHUB_WORKSPACE}/flake8-output.txt
|
||||
- name: Add annotations
|
||||
uses: pytorch/add-annotations-github-action@master
|
||||
with:
|
||||
check_name: 'flake8-py2'
|
||||
linter_output_path: 'flake8-output.txt'
|
||||
commit_sha: ${{ steps.get_pr_tip.outputs.commit_sha }}
|
||||
regex: '^(?<filename>.*?):(?<lineNumber>\d+):(?<columnNumber>\d+): (?<errorCode>\w\d+) (?<errorDesc>.*)'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
||||
clang-tidy:
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -1,87 +0,0 @@
|
||||
trigger:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
- job: consistent_circleci
|
||||
displayName: "Ensure consistent CircleCI YAML"
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: "3.7"
|
||||
- script: pip install -r requirements.txt
|
||||
- script: cd .circleci && ./ensure-consistency.py
|
||||
|
||||
- job: validate_docker_version
|
||||
displayName: "Ensure Docker version is correctly deployed"
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: "3.7"
|
||||
- script: .circleci/validate-docker-version.py
|
||||
|
||||
- job: shellcheck_jenkins
|
||||
displayName: "Shellcheck Jenkins scripts"
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- script: sudo apt-get install -y shellcheck
|
||||
- script: .jenkins/run-shellcheck.sh
|
||||
|
||||
- job: ensure_no_tabs
|
||||
displayName: "Ensure no tabs"
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: "2.7"
|
||||
- script: (! git grep -I -l $'\t' -- . ':(exclude)*.svg' ':(exclude)**Makefile' ':(exclude)**/contrib/**' ':(exclude)third_party' ':(exclude).gitattributes' ':(exclude).gitmodules' || (echo "The above files have tabs; please convert them to spaces"; false))
|
||||
|
||||
- job: ensure_not_executable
|
||||
displayName: "Ensure C++ source files are not executable"
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: "2.7"
|
||||
- script: (! find . \( -path ./third_party -o -path ./.git -o -path ./torch/bin -o -path ./build \) -prune -o -type f -executable -regextype posix-egrep -not -regex '.+(\.(bash|sh|py|so)|git-pre-commit)$' -print | grep . || (echo 'The above files have executable permission; please remove their executable permission by using `chmod -x`'; false))
|
||||
|
||||
- job: python_27_lint
|
||||
displayName: "Python 2.7 Lint"
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: "2.7"
|
||||
- script: pip install flake8
|
||||
- script: |
|
||||
rm -rf .circleci
|
||||
flake8 1>&2
|
||||
|
||||
- job: mypy_typecheck
|
||||
displayName: "MyPy typecheck"
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: "3.6"
|
||||
- script: pip install mypy mypy-extensions
|
||||
- script: mypy @mypy-files.txt
|
||||
|
||||
- job: cpp_doc_check
|
||||
displayName: "CPP doc check"
|
||||
pool:
|
||||
vmImage: 'Ubuntu 16.04'
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: "3.6"
|
||||
- script: sudo apt-get install -y doxygen && pip install -r requirements.txt
|
||||
- script: cd docs/cpp/source && ./check-doxygen.sh
|
Reference in New Issue
Block a user