-
Notifications
You must be signed in to change notification settings - Fork 16
142 lines (127 loc) · 5.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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: RAGStack CI
on:
workflow_dispatch: {}
schedule:
- cron: '0 0 * * *'
pull_request:
paths-ignore:
- '.github/workflows/langchain-master-daily.yml'
- '.github/workflows/release-ragstack.yml'
- '.github/workflows/security-scan.yml'
- 'docs/**'
- 'README.md'
branches:
- main
concurrency:
group: ragstack-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: 'Setup: Python 3.11'
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run ragstack-ai unit tests
run: |
tox
- name: Setup AstraDB prod
uses: ./.github/actions/setup-astra-db
id: astra-db-prod
with:
astra-token: ${{ secrets.E2E_TESTS_ASTRA_PROD_DB_TOKEN }}
db-name: ${{ github.run_id }}
env: PROD
region: us-east-2
cloud: aws
- name: Setup AstraDB dev
uses: ./.github/actions/setup-astra-db
id: astra-db-dev
with:
astra-token: ${{ secrets.E2E_TESTS_ASTRA_DEV_DB_TOKEN }}
db-name: ${{ github.run_id }}
env: DEV
region: us-west-2
cloud: aws
- name: Run notebook tests
env:
ASTRA_DB_APPLICATION_TOKEN: "${{ secrets.E2E_TESTS_ASTRA_PROD_DB_TOKEN }}"
ASTRA_DB_API_ENDPOINT: "${{ steps.astra-db-prod.outputs.db_endpoint }}"
ASTRA_DB_ID: "${{ steps.astra-db-prod.outputs.db_id }}"
OPENAI_API_KEY: "${{ secrets.E2E_TESTS_OPEN_AI_KEY }}"
run: |
tox -e notebooks
- name: Run E2E tests
id: e2e-tests
if: always() && (steps.astra-db-prod.outcome == 'success' && steps.astra-db-dev.outcome == 'success')
env:
ASTRA_DEV_DB_TOKEN: "${{ secrets.E2E_TESTS_ASTRA_DEV_DB_TOKEN }}"
ASTRA_DEV_DB_ENDPOINT: "${{ steps.astra-db-dev.outputs.db_endpoint }}"
ASTRA_DEV_DB_ID: "${{ steps.astra-db-dev.outputs.db_id }}"
ASTRA_PROD_DB_TOKEN: "${{ secrets.E2E_TESTS_ASTRA_PROD_DB_TOKEN }}"
ASTRA_PROD_DB_ENDPOINT: "${{ steps.astra-db-prod.outputs.db_endpoint }}"
ASTRA_PROD_DB_ID: "${{ steps.astra-db-prod.outputs.db_id }}"
OPEN_AI_KEY: "${{ secrets.E2E_TESTS_OPEN_AI_KEY }}"
AZURE_OPEN_AI_KEY: "${{ secrets.E2E_TESTS_AZURE_OPEN_AI_KEY }}"
AZURE_OPEN_AI_ENDPOINT: "${{ secrets.E2E_TESTS_AZURE_OPEN_AI_ENDPOINT }}"
GCLOUD_ACCOUNT_KEY_JSON: "${{ secrets.E2E_TESTS_GCLOUD_ACCOUNT_KEY_JSON }}"
AWS_ACCESS_KEY_ID: "${{ secrets.E2E_TESTS_AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.E2E_TESTS_AWS_SECRET_ACCESS_KEY }}"
BEDROCK_AWS_REGION: "${{ secrets.E2E_TESTS_BEDROCK_AWS_REGION }}"
HUGGINGFACE_HUB_KEY: "${{ secrets.E2E_TESTS_HUGGINGFACE_HUB_KEY }}"
run: |
tox -c ragstack-e2e-tests
- name: Dump report on Github Summary
if: always()
run: |
if [ -f "ragstack-e2e-tests/all-tests-report.txt" ]; then
echo "$(cat ragstack-e2e-tests/all-tests-report.txt)" >> $GITHUB_STEP_SUMMARY
echo "Report added to the summary"
else
echo "Report not found"
fi
- name: Compute commit URL
if: always() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
id: commit-ref
run: echo "commit-ref=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Prepare report for Slack
if: always() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
uses: ./.github/actions/generate-slack-report
with:
from-report-file: ragstack-e2e-tests/failed-tests-report.txt
output-file: slack-report.json
type: "RAGStack Tests"
outcome: ${{ steps.e2e-tests.outcome }}
commit-url: "https://github.com/datastax/ragstack-ai/commits/${{ steps.commit-ref.outputs.commit-ref }}"
- name: Dump report on Slack
if: always() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
uses: slackapi/[email protected]
with:
payload-file-path: "./slack-report.json"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Cleanup Astra prod
if: always()
continue-on-error: true
uses: ./.github/actions/cleanup-astra-db
with:
astra-token: ${{ secrets.E2E_TESTS_ASTRA_PROD_DB_TOKEN }}
db-name: ${{ github.run_id }}
env: PROD
- name: Cleanup Astra dev
if: always()
continue-on-error: true
uses: ./.github/actions/cleanup-astra-db
with:
astra-token: ${{ secrets.E2E_TESTS_ASTRA_DEV_DB_TOKEN }}
db-name: ${{ github.run_id }}
env: DEV