Skip to content

Commit a8808b9

Browse files
committed
Add pre-commit and lint workflow
1 parent 810e3ce commit a8808b9

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

.github/workflows/lint.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# pre-commit is a tool to perform a predefined set of tasks manually and/or
2+
# automatically before git commits are made.
3+
#
4+
# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level
5+
#
6+
# Common tasks
7+
#
8+
# - Register git hooks: pre-commit install
9+
# - Run on all files: pre-commit run --all-files
10+
#
11+
# These pre-commit hooks are run as CI.
12+
#
13+
# NOTE: if it can be avoided, add configs/args in pyproject.toml or below instead of creating a new `.config.file`.
14+
# https://pre-commit.ci/#configuration
15+
ci:
16+
autoupdate_schedule: monthly
17+
autofix_commit_msg: |
18+
[pre-commit.ci] Apply automatic pre-commit fixes
19+
20+
repos:
21+
- repo: https://github.com/pre-commit/pre-commit-hooks
22+
rev: v4.6.0
23+
hooks:
24+
- id: end-of-file-fixer
25+
exclude: '\.svg$'
26+
- id: trailing-whitespace
27+
exclude: '\.svg$'
28+
- id: check-json
29+
- id: check-yaml
30+
args: [--allow-multiple-documents, --unsafe]
31+
- id: check-toml
32+
33+
- repo: https://github.com/astral-sh/ruff-pre-commit
34+
rev: v0.5.6
35+
hooks:
36+
- id: ruff
37+
args: ["--fix"]

tensorflow_serving/tools/pip_package/setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,7 @@
9898
'Topic :: Software Development :: Libraries',
9999
'Topic :: Software Development :: Libraries :: Python Modules',
100100
],
101+
extras_require={
102+
'lint': ['pre-commit'],
103+
},
101104
)

0 commit comments

Comments
 (0)