-
Notifications
You must be signed in to change notification settings - Fork 53
45 lines (43 loc) · 1.62 KB
/
lint.yaml
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
name: Format & Lint
on:
push:
branches: [main]
pull_request:
jobs:
format-and-lint:
if: github.repository == 'hidet-org/hidet' || github.repository == 'CentML/hidet'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install torch torchvision torchaudio
pip install -r requirements.txt
pip install -r requirements-dev.txt
sudo apt-get update
sudo apt-get install clang-format
- name: Format with black
run: |
# stop the build if format is not correct
echo "Running with " $(pip freeze | grep "black")
python -m black --skip-string-normalization --skip-magic-trailing-comma --line-length 120 --check ./python/hidet ./tests
- name: Lint with pylint
run: |
echo "Running with" $(pip freeze | grep "pylint")
python -m pylint --rcfile ./scripts/lint/pylintrc -j $(nproc) ./python/hidet
- name: Format with clang-format
run: |
echo "Running with" $(clang-format --version)
find ./src ./include -iname '*.h' -o -iname '*.cpp' \
| xargs clang-format -style=file:scripts/lint/.clang-format --dry-run -Werror