forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 7
73 lines (64 loc) · 2.59 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Lint
on:
pull_request:
push:
branches:
- master
- main
- release/*
- landchecks/*
workflow_dispatch:
# The names of steps that actually test the code should be suffixed with `(nonretryable)`.
# When any other step fails, it's job will be retried once by retryBot.
jobs:
lintrunner:
runs-on: ubuntu-20.04
steps:
- name: Checkout PyTorch
uses: csarofeen/pytorch/.github/actions/checkout-pytorch@master
with:
submodules: false
fetch-depth: 1
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
architecture: x64
check-latest: false
cache: pip
cache-dependency-path: |
**/.github/requirements-gha-cache.txt
- name: Install requirements
run: |
pip install -r .github/requirements-gha-cache.txt --user
- name: Initialize lint dependencies
run: lintrunner init
- name: Do build steps necessary for linters
run: |
python3 -m tools.linter.clang_tidy.generate_build_files
python3 -m tools.generate_torch_version --is_debug=false
python3 -m tools.pyi.gen_pyi \
--native-functions-path aten/src/ATen/native/native_functions.yaml \
--tags-path aten/src/ATen/native/tags.yaml \
--deprecated-functions-path "tools/autograd/deprecated.yaml"
- name: Run lintrunner on all files (nonretryable)
run: |
set +e
if ! lintrunner --force-color --all-files --tee-json=lint.json; then
echo ""
echo -e "\e[1m\e[36mYou can reproduce these results locally by using \`lintrunner\`.\e[0m"
echo -e "\e[1m\e[36mSee https://github.com/csarofeen/pytorch/wiki/lintrunner for setup instructions.\e[0m"
exit 1
fi
- name: Store annotations
if: always() && github.event_name == 'pull_request'
# Don't show this as an error; the above step will have already failed.
continue-on-error: true
run: |
# Use jq to massage the JSON lint output into GitHub Actions workflow commands.
jq --raw-output \
'"::\(if .severity == "advice" or .severity == "disabled" then "warning" else .severity end) file=\(.path),line=\(.line),col=\(.char),title=\(.code) \(.name)::" + (.description | gsub("\\n"; "%0A"))' \
lint.json
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true