|
7 | 7 | required: true
|
8 | 8 | type: string
|
9 | 9 | description: "From which folder this pipeline executes"
|
| 10 | + python-version: |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + description: "Python version to use" |
10 | 14 |
|
11 | 15 | env:
|
12 |
| - POETRY_VERSION: "1.7.1" |
13 | 16 | WORKDIR: ${{ inputs.working-directory == '' && '.' || inputs.working-directory }}
|
14 | 17 |
|
| 18 | + # This env var allows us to get inline annotations when ruff has complaints. |
| 19 | + RUFF_OUTPUT_FORMAT: github |
| 20 | + UV_FROZEN: "true" |
| 21 | + |
15 | 22 | jobs:
|
16 | 23 | build:
|
| 24 | + name: "make lint #${{ inputs.python-version }}" |
17 | 25 | runs-on: ubuntu-latest
|
18 |
| - env: |
19 |
| - # This number is set "by eye": we want it to be big enough |
20 |
| - # so that it's bigger than the number of commits in any reasonable PR, |
21 |
| - # and also as small as possible since increasing the number makes |
22 |
| - # the initial `git fetch` slower. |
23 |
| - FETCH_DEPTH: 50 |
24 |
| - strategy: |
25 |
| - matrix: |
26 |
| - # Only lint on the min and max supported Python versions. |
27 |
| - # It's extremely unlikely that there's a lint issue on any version in between |
28 |
| - # that doesn't show up on the min or max versions. |
29 |
| - # |
30 |
| - # GitHub rate-limits how many jobs can be running at any one time. |
31 |
| - # Starting new jobs is also relatively slow, |
32 |
| - # so linting on fewer versions makes CI faster. |
33 |
| - python-version: |
34 |
| - - "3.9" |
35 |
| - - "3.11" |
| 26 | + timeout-minutes: 20 |
36 | 27 | steps:
|
37 |
| - - uses: actions/checkout@v3 |
38 |
| - - name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }} |
39 |
| - uses: "./.github/actions/poetry_setup" |
40 |
| - with: |
41 |
| - python-version: ${{ matrix.python-version }} |
42 |
| - poetry-version: ${{ env.POETRY_VERSION }} |
43 |
| - working-directory: ${{ inputs.working-directory }} |
44 |
| - cache-key: lint-with-extras |
45 |
| - |
46 |
| - - name: Check Poetry File |
47 |
| - shell: bash |
48 |
| - working-directory: ${{ inputs.working-directory }} |
49 |
| - run: | |
50 |
| - poetry check |
| 28 | + - uses: actions/checkout@v4 |
51 | 29 |
|
52 |
| - - name: Check lock file |
53 |
| - shell: bash |
54 |
| - working-directory: ${{ inputs.working-directory }} |
55 |
| - run: | |
56 |
| - poetry lock --check |
| 30 | + - name: Set up Python ${{ inputs.python-version }} + uv |
| 31 | + uses: "./.github/actions/uv_setup" |
| 32 | + with: |
| 33 | + python-version: ${{ inputs.python-version }} |
57 | 34 |
|
58 | 35 | - name: Install dependencies
|
59 |
| - # Also installs dev/lint/test/typing dependencies, to ensure we have |
60 |
| - # type hints for as many of our libraries as possible. |
61 |
| - # This helps catch errors that require dependencies to be spotted, for example: |
62 |
| - # https://github.com/langchain-ai/langchain/pull/10249/files#diff-935185cd488d015f026dcd9e19616ff62863e8cde8c0bee70318d3ccbca98341 |
63 |
| - # |
64 |
| - # If you change this configuration, make sure to change the `cache-key` |
65 |
| - # in the `poetry_setup` action above to stop using the old cache. |
66 |
| - # It doesn't matter how you change it, any change will cause a cache-bust. |
67 | 36 | working-directory: ${{ inputs.working-directory }}
|
68 | 37 | run: |
|
69 |
| - poetry install --with dev,lint,test,typing |
70 |
| -
|
71 |
| - - name: Get .mypy_cache to speed up mypy |
72 |
| - uses: actions/cache@v3 |
73 |
| - env: |
74 |
| - SEGMENT_DOWNLOAD_TIMEOUT_MIN: "2" |
75 |
| - with: |
76 |
| - path: | |
77 |
| - ${{ env.WORKDIR }}/.mypy_cache |
78 |
| - key: mypy-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ inputs.working-directory }}-${{ hashFiles(format('{0}/poetry.lock', env.WORKDIR)) }} |
| 38 | + uv sync --group test |
79 | 39 |
|
80 | 40 | - name: Analysing the code with our lint
|
81 | 41 | working-directory: ${{ inputs.working-directory }}
|
|
0 commit comments