-
Notifications
You must be signed in to change notification settings - Fork 65
116 lines (107 loc) · 3.58 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: ci
on: [push]
jobs:
compile:
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Bootstrap poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-in-project: false
- name: Install dependencies
run: poetry install
- name: Compile
run: poetry run mypy .
test:
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Bootstrap poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-in-project: false
- name: Install dependencies
run: poetry install
- name: Test
run: poetry run pytest .
env:
CO_API_KEY: ${{ secrets.COHERE_API_KEY }}
test-langchain-cohere:
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.10.14
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-in-project: false
- name: Install dependencies
run: poetry install
- name: Test langchain-cohere
run: |
echo "Initial dir $(pwd)"
cd ..
echo "Cloning langchain-cohere..."
git clone https://github.com/langchain-ai/langchain-cohere.git && cd langchain-cohere/libs/cohere
echo "Cloned langchain-cohere, current dir $(pwd)"
echo "poetry install --with test,test_integration"
poetry install --with test,test_integration
echo "Going to uninstall cohere package, and install the current version from the repo"
cd ../../../cohere-python && echo "Current dir $(pwd)"
echo "Current dir $(ls)"
pip uninstall cohere
pip install .
cd ../langchain-cohere/libs/cohere
echo "Current cohere installation: $(pip freeze | grep cohere)"
make test
make integration_test
echo "tests passed"
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'
env:
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
publish:
needs: [compile, test]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
- name: Install dependencies
run: poetry install
- name: Publish to pypi
run: |
poetry config repositories.remote https://upload.pypi.org/legacy/
poetry --no-interaction -v publish --build --repository remote --username "$PYPI_USERNAME" --password "$PYPI_PASSWORD"
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}