Skip to content

Commit 8d9e13a

Browse files
author
Your Name
committed
Workflow python-test.yml
1 parent 7847d42 commit 8d9e13a

File tree

2 files changed

+51
-53
lines changed

2 files changed

+51
-53
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

.github/workflows/python-test.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Python Tests with Elasticsearch
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
services:
13+
elasticsearch:
14+
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.10
15+
ports:
16+
- 9200:9200
17+
options: >-
18+
--health-cmd "curl -s http://localhost:9200/_cluster/health | grep -q '\"status\":\"green\"'"
19+
--health-interval 10s
20+
--health-timeout 120s
21+
--health-retries 10
22+
env:
23+
discovery.type: single-node
24+
ES_JAVA_OPTS: "-Xms2g -Xmx2g"
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v3
29+
30+
- name: Set up Python 3.11
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: 3.11
34+
35+
- name: Install dependencies
36+
run: |
37+
python -m pip install --upgrade pip
38+
pip install -r requirements.txt
39+
40+
- name: Wait for Elasticsearch to be ready
41+
run: |
42+
until curl -s http://localhost:9200 >/dev/null; do
43+
echo "Waiting for Elasticsearch..."
44+
sleep 5
45+
done
46+
47+
- name: Run pytest tests
48+
env:
49+
ES_HOST: http://localhost:9200
50+
run: |
51+
pytest tests/

0 commit comments

Comments
 (0)