This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 122
88 lines (81 loc) · 3.07 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
name: CI
on: pull_request
jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, '3.10', 3.11]
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.2
- name: install dependencies
run: poetry install --with dev
- name: Run flake8 Check
run: poetry run flake8 .
- name: Run mypy check
run: poetry run mypy .
run-tests:
name: Run tests
runs-on: ubuntu-latest
needs: run-linters
strategy:
matrix:
python-version: [3.9, '3.10', 3.11]
pinecone-plan: ["paid", "starter"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.2
- name: install dependencies
run: poetry install --with dev --all-extras
- name: Run unit tests
run: poetry run pytest --html=report.html --self-contained-html tests/unit
- name: Set Index Name for System / E2E
id: gen_suffix
run: |
RAW_SUFFIX="${{ matrix.python-version }}-${{ matrix.pinecone-plan }}"
SUFFIX="${RAW_SUFFIX//./-}"
echo "${SUFFIX}"
echo "INDEX_NAME_SUFFIX=${SUFFIX}" >> $GITHUB_OUTPUT
- name: Run system tests
env:
INDEX_NAME: system-${{ steps.gen_suffix.outputs.INDEX_NAME_SUFFIX }}
PINECONE_ENVIRONMENT: ${{ matrix.pinecone-plan == 'paid' && secrets.PINECONE_ENVIRONMENT_3 || secrets.PINECONE_ENVIRONMENT_4 }}
PINECONE_API_KEY: ${{ matrix.pinecone-plan == 'paid' && secrets.PINECONE_API_KEY_3 || secrets.PINECONE_API_KEY_4 }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: poetry run pytest -n 3 --dist loadscope --html=report_system.html --self-contained-html tests/system
- name: Run e2e tests
env:
INDEX_NAME: e2e-${{ steps.gen_suffix.outputs.INDEX_NAME_SUFFIX }}
PINECONE_ENVIRONMENT: ${{ matrix.pinecone-plan == 'paid' && secrets.PINECONE_ENVIRONMENT_3 || secrets.PINECONE_ENVIRONMENT_4 }}
PINECONE_API_KEY: ${{ matrix.pinecone-plan == 'paid' && secrets.PINECONE_API_KEY_3 || secrets.PINECONE_API_KEY_4 }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
CE_LOG_FILENAME: e2e.log
run: poetry run pytest -n 3 --dist loadscope --html=report_e2e.html --self-contained-html tests/e2e
- name: upload pytest report.html
uses: actions/upload-artifact@v3
if: always()
with:
name: pytest-report-py${{ matrix.python-version }}-${{ matrix.pinecone-plan }}
path: report*.html
- name: upload e2e test log
uses: actions/upload-artifact@v3
if: failure()
with:
name: e2e-log-failure-report-py${{ matrix.python-version }}-${{ matrix.pinecone-plan }}
path: e2e.log