Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow lint & linckcheck #133

Merged
merged 1 commit into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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