Skip to content

Commit

Permalink
Add workflow lint & linckcheck (#133)
Browse files Browse the repository at this point in the history
Signed-off-by: Bennu-Li <yunmei.li@zilliz.com>
  • Loading branch information
Bennu-Li committed Apr 7, 2023
1 parent 75738c2 commit 6c93265
Show file tree
Hide file tree
Showing 8 changed files with 9,181 additions and 2 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/linkcheck.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: linkcheck

on:
push:
branches: main
pull_request:
branches: main

env:
POETRY_VERSION: "1.3.1"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.8"
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
pipx install poetry==$POETRY_VERSION
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install dependencies
run: |
poetry install --with docs
- name: Build the docs
run: |
make docs_build
- name: Analyzing the docs with linkcheck
run: |
make docs_linkcheck
34 changes: 34 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: lint

on:
push:
branches: main
pull_request:
branches: main

env:
POETRY_VERSION: "1.3.1"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.8"
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
pipx install poetry==$POETRY_VERSION
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install dependencies
run: |
poetry install
- name: Analysing the code with our lint
run: |
make lint
4 changes: 2 additions & 2 deletions .github/workflows/pylint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- 'gptcache/**'
- 'tests/**'
- '!**.md'
- '.github/workflows/pylint.yml'
- '.github/workflows/**'
jobs:
run:
runs-on: ubuntu-latest
Expand All @@ -22,4 +22,4 @@ jobs:
- name: Python pylint
run: |
pip install pylint==2.10.2
pylint --rcfile=pylint.conf --output-format=colorized gptcache && pylint --rcfile=pylint.conf --output-format=colorized tests.unit_tests
make pylint_check
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,24 @@ create_conda_env:

remove_conda_env:
@bash ./scripts/manage_conda_env.sh remove

docs_build:
cd docs && poetry run make html

docs_clean:
cd docs && poetry run make clean

docs_linkcheck:
poetry run linkchecker docs/_build/html/index.html

PYTHON_FILES=.
lint: PYTHON_FILES=.
lint_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d master | grep -E '\.py$$')

lint lint_diff:
poetry run mypy $(PYTHON_FILES)
poetry run black $(PYTHON_FILES) --check
poetry run ruff .

pylint_check:
pylint --rcfile=pylint.conf --output-format=colorized gptcache && pylint --rcfile=pylint.conf --output-format=colorized tests.unit_tests
8,500 changes: 8,500 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[virtualenvs]
in-project = true

[installer]
modern-installation = false
Loading

0 comments on commit 6c93265

Please sign in to comment.