Update linting workflows for frontend and Python code (#2171)

* chore: Update pre-commit hooks and dependencies

* chore: Add linting workflow for frontend code

* chore: Update linting workflow for Python code and include tests in pull requests

* chore: Add Ruff style check workflow for Python code
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-06-14 06:27:48 -07:00 • committed by GitHub
commit a9cb7b0f5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 115 additions and 36 deletions

51
.github/workflows/lint-py.yml vendored Normal file
View file

@ -0,0 +1,51 @@
name: Lint Python
on:
pull_request:
paths:
- "poetry.lock"
- "pyproject.toml"
- "src/backend/**"
- "tests/**"
env:
POETRY_VERSION: "1.8.2"
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.12"
- "3.11"
- "3.10"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_caching"
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ env.POETRY_VERSION }}
cache-key: ${{ runner.os }}-poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Python dependencies
run: |
poetry env use ${{ matrix.python-version }}
poetry install
- name: Get .mypy_cache to speed up mypy
uses: actions/cache@v4
env:
SEGMENT_DOWNLOAD_TIMEOUT_MIN: "2"
with:
path: |
./.mypy_cache
key: ${{ runner.os }}-mypy-${{ hashFiles('**/pyproject.toml') }}
- name: Run linters
uses: wearerequired/lint-action@v1
with:
github_token: ${{ secrets.github_token }}
# Enable linters
git_email: "gabriel@langflow.org"
mypy: true
mypy_args: '--namespace-packages -p "langflow"'