-
Notifications
You must be signed in to change notification settings - Fork 29
116 lines (109 loc) · 4.25 KB
/
test.yaml
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: Internal test runner
on:
workflow_call:
inputs:
environment:
description: 'Environment to run the tests in'
required: false
default: null
type: string
python-version:
description: 'Python version to run the tests in'
required: true
type: string
use-llms:
description: 'Use LLM in the tests'
required: false
type: string
default: ""
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
environment: ${{ inputs.environment }}
services:
nats:
image: diementros/nats:js
ports:
- 4222:4222
env:
NATS_URL: nats://localhost:4222
steps:
- name: Set up environment variables
run: |
# check if an environment var or secret is defined and set env var to its value
# vars
if [ -n "${{ vars.AZURE_API_VERSION }}" ]; then
echo "AZURE_API_VERSION=${{ vars.AZURE_API_VERSION }}" >> $GITHUB_ENV
fi
if [ -n "${{ vars.AZURE_API_ENDPOINT }}" ]; then
echo "AZURE_API_ENDPOINT=${{ vars.AZURE_API_ENDPOINT }}" >> $GITHUB_ENV
fi
if [ -n "${{ vars.AZURE_GPT35_MODEL }}" ]; then
echo "AZURE_GPT35_MODEL=${{ vars.AZURE_GPT35_MODEL }}" >> $GITHUB_ENV
fi
if [ -n "${{ vars.AZURE_GPT4_MODEL }}" ]; then
echo "AZURE_GPT4_MODEL=${{ vars.AZURE_GPT4_MODEL }}" >> $GITHUB_ENV
fi
if [ -n "${{ vars.AZURE_GPT4o_MODEL }}" ]; then
echo "AZURE_GPT4o_MODEL=${{ vars.AZURE_GPT4o_MODEL }}" >> $GITHUB_ENV
fi
# secrets
if [ -n "${{ secrets.AZURE_OPENAI_API_KEY }}" ]; then
echo "AZURE_OPENAI_API_KEY=${{ secrets.AZURE_OPENAI_API_KEY }}" >> $GITHUB_ENV
fi
if [ -n "${{ secrets.TOGETHER_API_KEY }}" ]; then
echo "TOGETHER_API_KEY=${{ secrets.TOGETHER_API_KEY }}" >> $GITHUB_ENV
fi
if [ -n "${{ secrets.OPENAI_API_KEY }}" ]; then
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> $GITHUB_ENV
fi
if [ -n "${{ secrets.ANTHROPIC_API_KEY }}" ]; then
echo "ANTHROPIC_API_KEY=${{ secrets.ANTHROPIC_API_KEY }}" >> $GITHUB_ENV
fi
if [ -n "${{ secrets.BING_API_KEY }}" ]; then
echo "BING_API_KEY=${{ secrets.BING_API_KEY }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: "pip"
cache-dependency-path: pyproject.toml
- uses: actions/cache@v4
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test-v04
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[docs,testing]
- name: Install Pydantic v2
run: pip install --pre "pydantic>=2,<3"
- run: mkdir coverage
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Test without LLMs
if: ${{ inputs.use-llms == ''}}
run: bash scripts/test.sh -vv -m "not (anthropic or azure_oai or openai or togetherai or llm)"
env:
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ inputs.python-version }}-${{ inputs.use-llms }}
CONTEXT: ${{ runner.os }}-py${{ inputs.python-version }}-${{ inputs.use-llms }}
- name: Test with LLMs
if: ${{ inputs.use-llms != '' }}
run: bash scripts/test.sh -vv -m "${{ inputs.use-llms }}"
env:
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ inputs.python-version }}-${{ inputs.use-llms }}
CONTEXT: ${{ runner.os }}-py${{ inputs.python-version }}-${{ inputs.use-llms }}
- name: Check coverage file
run: ls -al coverage
- name: Store coverage files
uses: actions/upload-artifact@v4
with:
name: .coverage.${{ runner.os }}-py${{ inputs.python-version }}-${{ inputs.use-llms }}
path: coverage/.coverage.*
if-no-files-found: error
overwrite: true
include-hidden-files: true