-
Notifications
You must be signed in to change notification settings - Fork 2
127 lines (106 loc) · 3.76 KB
/
ci.yml
File metadata and controls
127 lines (106 loc) · 3.76 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
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
name: CI/CD Pipeline
on:
push:
branches: [ master, main, develop ]
pull_request:
branches: [ master, main ]
env:
ARANGO_USER: dev
ARANGO_PASSWORD: sandbox
ARANGO_DB: dev
ARANGO_ROOT_PASSWORD: openSesame
jobs:
api-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Start ArangoDB
run: |
# Create backup directory for volume mounting
mkdir -p .backup
# Run ArangoDB container with host network
docker run \
--name arangodb-dev \
--network host \
-e ARANGO_ROOT_PASSWORD=${ARANGO_ROOT_PASSWORD} \
-v $(pwd)/.backup:/backup \
-d arangodb/arangodb:latest
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Install Foxx CLI
run: bun add -g foxx-cli
- name: Install Hurl
run: |
curl -LO https://github.com/Orange-OpenSource/hurl/releases/download/4.1.0/hurl_4.1.0_amd64.deb
sudo dpkg -i hurl_4.1.0_amd64.deb
- name: Wait for ArangoDB
run: |
max_wait=120
delay=2
total=0
echo "Waiting for ArangoDB to be ready..."
echo "Checking container status..."
docker ps -a | grep arangodb-dev
echo "Checking container logs..."
docker logs arangodb-dev | tail -10
while [ $total -le $max_wait ]; do
echo "Testing connection to localhost:8529 with credentials..."
if curl -f -u "root:${ARANGO_ROOT_PASSWORD}" http://localhost:8529/_api/version > /dev/null 2>&1; then
echo "ArangoDB is ready and authentication working!"
break
else
echo "Connection failed, checking container status..."
docker ps -a | grep arangodb-dev
fi
echo "Wait ${total}s / ${max_wait}s"
total=$((total + delay))
sleep $delay
done
if [ $total -gt $max_wait ]; then
echo "ArangoDB failed to start within ${max_wait}s"
echo "Final container logs:"
docker logs arangodb-dev | tail -20
exit 1
fi
- name: Setup Database
run: |
# Create database and user using arangosh
docker exec arangodb-dev arangosh \
--server.username root \
--server.password ${ARANGO_ROOT_PASSWORD} \
--javascript.execute-string "db._createDatabase('${ARANGO_DB}',{},[{username: '${ARANGO_USER}', passwd: '${ARANGO_PASSWORD}', active: true}]);"
- name: Register Foxx API services
run: |
foxx server set dev http://${ARANGO_USER}:${ARANGO_PASSWORD}@localhost:8529
- name: Install API services
run: |
foxx install /api . --server dev --database ${ARANGO_DB}
- name: Update test variables
run: |
echo "URL=http://localhost:8529/_db/${ARANGO_DB}/api" > tests/hurl/.vars
- name: Run API tests
run: |
mkdir -p test-results/hurl
hurl --test \
--report-junit test-results/hurl/results.xml \
--variables-file tests/hurl/.vars \
tests/hurl/hello.hurl
- name: Upload test results
uses: actions/upload-artifact@v7
if: always()
with:
name: test-results
path: test-results/
retention-days: 30
# - name: Publish test results
# uses: dorny/test-reporter@v2
# if: always()
# with:
# name: API Tests
# path: test-results/hurl/results.xml
# reporter: java-junit