Skip to content

Commit 9078d96

Browse files
committed
Refactor and improve code quality
- Extract repeated patterns into utility functions - Modularize query handlers into separate files - Add TypeScript interfaces and type definitions - Improve error handling with better context - Add retry logic for transient Elasticsearch errors - Externalize ES version compatibility configuration - Add validation utilities - Add GitHub Actions workflow for multi-version testing - Add comprehensive documentation (API.md, ES9-COMPATIBILITY.md) - Improve type safety throughout codebase
1 parent 4bf56c2 commit 9078d96

38 files changed

+4134
-585
lines changed

.github/workflows/test-matrix.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Test Matrix
2+
3+
on:
4+
push:
5+
branches: [ main, master, dove ]
6+
pull_request:
7+
branches: [ main, master, dove ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [18, 20]
16+
elasticsearch-version: ['8.15.0', '9.0.0']
17+
18+
name: Node ${{ matrix.node-version }} - ES ${{ matrix.elasticsearch-version }}
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
28+
- name: Start Elasticsearch ${{ matrix.elasticsearch-version }}
29+
run: |
30+
docker run -d \
31+
--name elasticsearch \
32+
-p 9200:9200 \
33+
-e "discovery.type=single-node" \
34+
-e "xpack.security.enabled=false" \
35+
-e "xpack.security.enrollment.enabled=false" \
36+
docker.elastic.co/elasticsearch/elasticsearch:${{ matrix.elasticsearch-version }}
37+
38+
- name: Wait for Elasticsearch
39+
run: |
40+
for i in {1..30}; do
41+
if curl -s "http://localhost:9200/_cluster/health" > /dev/null 2>&1; then
42+
echo "Elasticsearch is ready"
43+
break
44+
fi
45+
echo "Waiting for Elasticsearch..."
46+
sleep 5
47+
done
48+
49+
- name: Install dependencies
50+
run: npm ci
51+
52+
- name: Build
53+
run: npm run build
54+
55+
- name: Run tests
56+
run: |
57+
ES_VERSION=${{ matrix.elasticsearch-version }} \
58+
ELASTICSEARCH_URL=http://localhost:9200 \
59+
npm run mocha
60+
61+
- name: Upload coverage
62+
if: matrix.node-version == '20' && matrix.elasticsearch-version == '8.15.0'
63+
uses: codecov/codecov-action@v3
64+
with:
65+
file: ./coverage/lcov.info

0 commit comments

Comments
 (0)