forked from pytorch/TensorRT
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (83 loc) · 2.38 KB
/
linter.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
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Lint Code
on:
pull_request:
types: [opened, synchronize, ready_for_review, review_requested, reopened]
jobs:
cpp-linting:
name: C++ Linting
runs-on: ubuntu-latest
permissions:
actions: write
checks: write
contents: write
deployments: none
id-token: write
issues: write
discussions: write
packages: write
pull-requests: write
repository-projects: none
security-events: none
statuses: write
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Setup env
run: |
sudo ln -s $GITHUB_EVENT_PATH /GITHUB_EVENT.json
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Install dependencies
run: |
pip3 install -r $GITHUB_WORKSPACE/.github/scripts/requirements.txt
pip3 install -r $GITHUB_WORKSPACE/requirements-dev.txt
- name: Lint C++
run: |
cd $GITHUB_WORKSPACE
python3 $GITHUB_WORKSPACE/.github/scripts/run_cpp_linter.py
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
py-linting:
name: Python Linting
runs-on: ubuntu-latest
permissions:
actions: write
checks: write
contents: write
deployments: none
id-token: write
issues: write
discussions: write
packages: write
pull-requests: write
repository-projects: none
security-events: none
statuses: write
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Setup env
run: |
sudo ln -s $GITHUB_EVENT_PATH /GITHUB_EVENT.json
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Install dependencies
run: |
pip3 install -r $GITHUB_WORKSPACE/.github/scripts/requirements.txt
pip3 install -r $GITHUB_WORKSPACE/requirements-dev.txt
- name: Lint Python
run: |
cd $GITHUB_WORKSPACE
python3 $GITHUB_WORKSPACE/.github/scripts/run_py_linter.py
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}