2022-10-24 21:51:15 +00:00
|
|
|
name: test
|
|
|
|
|
2022-12-04 00:42:59 +00:00
|
|
|
on:
|
2023-07-21 16:20:24 +00:00
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
working-directory:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
description: "From which folder this pipeline executes"
|
2023-11-20 21:09:30 +00:00
|
|
|
langchain-location:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
description: "Relative path to the langchain library folder"
|
2024-07-10 22:45:18 +00:00
|
|
|
python-version:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
description: "Python version to use"
|
2022-12-04 00:42:59 +00:00
|
|
|
|
|
|
|
env:
|
2024-01-17 16:51:20 +00:00
|
|
|
POETRY_VERSION: "1.7.1"
|
2022-10-24 21:51:15 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2023-07-21 16:20:24 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ${{ inputs.working-directory }}
|
2022-10-24 21:51:15 +00:00
|
|
|
runs-on: ubuntu-latest
|
2024-07-10 22:45:18 +00:00
|
|
|
name: "make test #${{ inputs.python-version }}"
|
2022-10-24 21:51:15 +00:00
|
|
|
steps:
|
2023-10-23 14:01:33 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-08-22 19:59:22 +00:00
|
|
|
|
2024-07-10 22:45:18 +00:00
|
|
|
- name: Set up Python ${{ inputs.python-version }} + Poetry ${{ env.POETRY_VERSION }}
|
2023-05-10 13:35:07 +00:00
|
|
|
uses: "./.github/actions/poetry_setup"
|
2022-12-13 13:48:53 +00:00
|
|
|
with:
|
2024-07-10 22:45:18 +00:00
|
|
|
python-version: ${{ inputs.python-version }}
|
2023-08-21 14:35:56 +00:00
|
|
|
poetry-version: ${{ env.POETRY_VERSION }}
|
2023-08-22 19:59:22 +00:00
|
|
|
working-directory: ${{ inputs.working-directory }}
|
2023-08-22 15:36:52 +00:00
|
|
|
cache-key: core
|
2023-08-22 19:59:22 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
shell: bash
|
2023-11-28 21:26:15 +00:00
|
|
|
run: poetry install --with test
|
2023-08-22 19:59:22 +00:00
|
|
|
|
2023-11-20 21:09:30 +00:00
|
|
|
- name: Install langchain editable
|
|
|
|
working-directory: ${{ inputs.working-directory }}
|
|
|
|
if: ${{ inputs.langchain-location }}
|
|
|
|
env:
|
|
|
|
LANGCHAIN_LOCATION: ${{ inputs.langchain-location }}
|
|
|
|
run: |
|
|
|
|
poetry run pip install -e "$LANGCHAIN_LOCATION"
|
|
|
|
|
2023-08-22 15:36:52 +00:00
|
|
|
- name: Run core tests
|
2023-05-11 01:57:39 +00:00
|
|
|
shell: bash
|
2023-11-20 21:09:30 +00:00
|
|
|
run: |
|
|
|
|
make test
|
2023-09-06 15:15:16 +00:00
|
|
|
|
|
|
|
- name: Ensure the tests did not create any additional files
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
STATUS="$(git status)"
|
|
|
|
echo "$STATUS"
|
|
|
|
|
|
|
|
# grep will exit non-zero if the target message isn't found,
|
|
|
|
# and `set -e` above will cause the step to fail.
|
|
|
|
echo "$STATUS" | grep 'nothing to commit, working tree clean'
|
2024-07-19 22:03:19 +00:00
|
|
|
|
|
|
|
- name: Get minimum versions
|
|
|
|
working-directory: ${{ inputs.working-directory }}
|
|
|
|
id: min-version
|
|
|
|
run: |
|
|
|
|
poetry run pip install packaging tomli
|
2024-07-22 17:46:15 +00:00
|
|
|
min_versions="$(poetry run python $GITHUB_WORKSPACE/.github/scripts/get_min_versions.py pyproject.toml pull_request)"
|
2024-07-19 22:03:19 +00:00
|
|
|
echo "min-versions=$min_versions" >> "$GITHUB_OUTPUT"
|
|
|
|
echo "min-versions=$min_versions"
|
|
|
|
|
2024-07-23 14:12:08 +00:00
|
|
|
# Temporarily disabled until we can get the minimum versions working
|
|
|
|
# - name: Run unit tests with minimum dependency versions
|
|
|
|
# if: ${{ steps.min-version.outputs.min-versions != '' }}
|
|
|
|
# env:
|
|
|
|
# MIN_VERSIONS: ${{ steps.min-version.outputs.min-versions }}
|
|
|
|
# run: |
|
|
|
|
# poetry run pip install --force-reinstall $MIN_VERSIONS --editable .
|
|
|
|
# make tests
|
|
|
|
# working-directory: ${{ inputs.working-directory }}
|