Skip to content

Commit b13f5c5

Browse files
Add tests for langchain (#533)
* Add tests for langchain * update langchain-cohere test to ensure that no new files are created * use current cohere-python changes for langchain-cohere test * logging for more infos * add more logging * minor logic changes to test ci * add cd dir * update cd dir * update paths * clean up ci.yaml file * Move langchain-cohere test to separate workflow * remove langchain-cohere from ci workflow * update python version to 3.10.14 * use same ci file for workflow * Update .github/workflows/ci.yml Co-authored-by: harry-cohere <[email protected]> * Update ci.yml to use github actions poetry install * Poetry install --with test,test_integration * update poetry configs * Nits --------- Co-authored-by: harry-cohere <[email protected]>
1 parent f7c268f commit b13f5c5

File tree

1 file changed

+58
-5
lines changed

1 file changed

+58
-5
lines changed

.github/workflows/ci.yml

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ jobs:
1212
with:
1313
python-version: 3.8
1414
- name: Bootstrap poetry
15-
run: |
16-
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
15+
uses: snok/install-poetry@v1
16+
with:
17+
version: 1.5.1
18+
virtualenvs-in-project: false
1719
- name: Install dependencies
1820
run: poetry install
1921
- name: Compile
@@ -28,15 +30,66 @@ jobs:
2830
with:
2931
python-version: 3.8
3032
- name: Bootstrap poetry
31-
run: |
32-
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
33+
uses: snok/install-poetry@v1
34+
with:
35+
version: 1.5.1
36+
virtualenvs-in-project: false
3337
- name: Install dependencies
3438
run: poetry install
3539
- name: Test
3640
run: poetry run pytest .
3741
env:
3842
CO_API_KEY: ${{ secrets.COHERE_API_KEY }}
39-
43+
44+
test-langchain-cohere:
45+
runs-on: ubuntu-20.04
46+
steps:
47+
- name: Checkout repo
48+
uses: actions/checkout@v3
49+
- name: Set up python
50+
uses: actions/setup-python@v4
51+
with:
52+
python-version: 3.10.14
53+
- name: Install and configure Poetry
54+
uses: snok/install-poetry@v1
55+
with:
56+
version: 1.5.1
57+
virtualenvs-in-project: false
58+
- name: Install dependencies
59+
run: poetry install
60+
- name: Test langchain-cohere
61+
run: |
62+
echo "Initial dir $(pwd)"
63+
cd ..
64+
echo "Cloning langchain-cohere..."
65+
git clone https://github.com/langchain-ai/langchain-cohere.git && cd langchain-cohere/libs/cohere
66+
echo "Cloned langchain-cohere, current dir $(pwd)"
67+
68+
echo "poetry install --with test,test_integration"
69+
poetry install --with test,test_integration
70+
71+
echo "Going to uninstall cohere package, and install the current version from the repo"
72+
cd ../../../cohere-python && echo "Current dir $(pwd)"
73+
echo "Current dir $(ls)"
74+
pip uninstall cohere
75+
pip install .
76+
cd ../langchain-cohere/libs/cohere
77+
78+
echo "Current cohere installation: $(pip freeze | grep cohere)"
79+
make test
80+
make integration_test
81+
echo "tests passed"
82+
83+
set -eu
84+
85+
STATUS="$(git status)"
86+
echo "$STATUS"
87+
88+
# grep will exit non-zero if the target message isn't found,
89+
# and `set -e` above will cause the step to fail.
90+
echo "$STATUS" | grep 'nothing to commit, working tree clean'
91+
env:
92+
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
4093

4194
publish:
4295
needs: [compile, test]

0 commit comments

Comments
 (0)