-
Notifications
You must be signed in to change notification settings - Fork 10
144 lines (119 loc) · 3.64 KB
/
tests.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
143
144
# If you change this name also do it in tests_skipper.yml and ci_metrics.yml
name: Tests
on:
# Activate this workflow manually
workflow_dispatch:
# Run tests nightly against Haystack's main branch
schedule:
- cron: "0 0 * * *"
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
paths:
- "haystack_experimental/**/*.py"
- "test/**/*.py"
- "pyproject.toml"
- ".github/workflows/tests.yml"
env:
PYTHON_VERSION: "3.9"
HATCH_VERSION: "1.13.0"
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
FIRECRAWL_API_KEY: ${{ secrets.FIRECRAWL_API_KEY }}
SERPERDEV_API_KEY: ${{ secrets.SERPERDEV_API_KEY }}
HF_API_TOKEN: ${{ secrets.HF_API_TOKEN }}
OLLAMA_LLM_FOR_TESTS: "llama3.2:3b"
jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Check code format
run: hatch fmt
- name: Linting
run: hatch run test:lint
- name: Typing
run: hatch run test:typing
unit-tests:
name: Unit / ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Run
run: hatch run test:unit
- name: Coveralls
# We upload only coverage for ubuntu as handling both os
# complicates the workflow too much for little to no gain
if: matrix.os == 'ubuntu-latest'
uses: coverallsapp/github-action@v2
with:
path-to-lcov: coverage.xml
- name: Nightly - run unit tests with Haystack main branch
if: github.event_name == 'schedule'
id: nightly-haystack-main
run: |
hatch run pip install git+https://github.com/deepset-ai/haystack.git
hatch run test:unit
integration-tests:
name: Integration / ${{ matrix.os }}
needs: linting
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Install Ollama and pull the required models
if: matrix.os == 'ubuntu-latest'
run: |
curl -fsSL https://ollama.com/install.sh | sh
ollama serve &
# Check if the service is up and running with a timeout of 60 seconds
timeout=60
while [ $timeout -gt 0 ] && ! curl -sSf http://localhost:11434/ > /dev/null; do
echo "Waiting for Ollama service to start..."
sleep 5
((timeout-=5))
done
if [ $timeout -eq 0 ]; then
echo "Timed out waiting for Ollama service to start."
exit 1
fi
ollama pull ${{ env.OLLAMA_LLM_FOR_TESTS }}
- name: Run
run: hatch run test:integration