-
Notifications
You must be signed in to change notification settings - Fork 24
79 lines (65 loc) · 2.38 KB
/
Copy pathtest-matrix.yml
File metadata and controls
79 lines (65 loc) · 2.38 KB
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
name: Test Matrix
on:
push:
branches: [main, master, dove]
pull_request:
branches: [main, master, dove]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22]
elasticsearch-version: ['8.15.0', '9.0.0']
name: Node ${{ matrix.node-version }} - ES ${{ matrix.elasticsearch-version }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Start Elasticsearch ${{ matrix.elasticsearch-version }}
run: |
docker run -d \
--name elasticsearch \
-p 9200:9200 \
-e "discovery.type=single-node" \
-e "xpack.security.enabled=false" \
-e "xpack.security.enrollment.enabled=false" \
docker.elastic.co/elasticsearch/elasticsearch:${{ matrix.elasticsearch-version }}
- name: Wait for Elasticsearch
run: |
echo "Waiting for Elasticsearch to be ready..."
for i in {1..60}; do
# Check cluster health status
HEALTH=$(curl -s "http://localhost:9200/_cluster/health" 2>/dev/null || echo "")
if [ ! -z "$HEALTH" ]; then
STATUS=$(echo $HEALTH | grep -o '"status":"[^"]*"' | cut -d'"' -f4)
echo "Attempt $i: Cluster status is '$STATUS'"
# Wait for yellow or green status (yellow is ok for single-node)
if [ "$STATUS" = "yellow" ] || [ "$STATUS" = "green" ]; then
echo "Elasticsearch is ready!"
# Give it a bit more time to fully stabilize
sleep 5
curl -s "http://localhost:9200/_cluster/health?pretty"
break
fi
else
echo "Attempt $i: Elasticsearch not responding yet..."
fi
if [ $i -eq 60 ]; then
echo "ERROR: Elasticsearch failed to become ready after 5 minutes"
docker logs elasticsearch
exit 1
fi
sleep 5
done
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run tests
run: |
ES_VERSION=${{ matrix.elasticsearch-version }} \
ELASTICSEARCH_URL=http://localhost:9200 \
npm run mocha