mirror of
https://github.com/kennethreitz/langchain.git
synced 2026-06-05 23:00:18 +00:00
f2560188ec
Ensure that we cache the linting virtualenv as well as the pip cache for the `pip install -e langchain` step. This is a win of about 60-90s overall. Before:  After: 
60 lines
1.6 KiB
YAML
60 lines
1.6 KiB
YAML
name: lint
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
working-directory:
|
|
required: true
|
|
type: string
|
|
description: "From which folder this pipeline executes"
|
|
|
|
env:
|
|
POETRY_VERSION: "1.4.2"
|
|
|
|
jobs:
|
|
build:
|
|
defaults:
|
|
run:
|
|
working-directory: ${{ inputs.working-directory }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version:
|
|
- "3.8"
|
|
- "3.9"
|
|
- "3.10"
|
|
- "3.11"
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/cache@v3
|
|
id: cache-pip
|
|
name: Cache langchain editable pip install - ${{ matrix.python-version }}
|
|
env:
|
|
SEGMENT_DOWNLOAD_TIMEOUT_MIN: "15"
|
|
with:
|
|
path: |
|
|
~/.cache/pip
|
|
key: pip-editable-langchain-deps-${{ runner.os }}-${{ runner.arch }}-py-${{ matrix.python-version }}
|
|
- name: Install poetry
|
|
run: |
|
|
pipx install poetry==$POETRY_VERSION
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
env:
|
|
SEGMENT_DOWNLOAD_TIMEOUT_MIN: "15"
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: poetry
|
|
cache-dependency-path: |
|
|
${{ inputs.working-directory == '' && '.' || inputs.working-directory }}/**/poetry.lock
|
|
- name: Install dependencies
|
|
run: |
|
|
poetry install
|
|
- name: Install langchain editable
|
|
if: ${{ inputs.working-directory != 'langchain' }}
|
|
run: |
|
|
pip install -e ../langchain
|
|
- name: Analysing the code with our lint
|
|
run: |
|
|
make lint
|