Skip to content

Commit 63a2dda

Browse files
committed
ci:refactor the file
1 parent e9e932d commit 63a2dda

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,38 @@ jobs:
303303
# SYSTEM INTEGRATION TEST
304304
# -------------------------------
305305

306-
- name: Check API routes
307-
run: curl -s http://localhost:3001/openapi.json | python3 -m json.tool | grep '"path"'
306+
- name: Register CI test user
307+
run: |
308+
curl -s -X POST http://localhost:3001/auth/register \
309+
-H "Content-Type: application/json" \
310+
-d '{"email":"ci@hooktrace.test","password":"ci_test_pass"}' \
311+
| python3 -m json.tool || true
312+
313+
- name: Login and get token
314+
run: |
315+
RESP=$(curl -s -X POST http://localhost:3001/auth/login \
316+
-H "Content-Type: application/json" \
317+
-d '{"email":"ci@hooktrace.test","password":"ci_test_pass"}')
318+
echo "Login response: $RESP"
319+
TOKEN=$(echo $RESP | python3 -c "import sys,json; print(json.load(sys.stdin).get('access_token',''))")
320+
echo "TOKEN=$TOKEN" >> $GITHUB_ENV
321+
322+
- name: Create a route
323+
run: |
324+
RESP=$(curl -s -X POST http://localhost:3001/routes/ \
325+
-H "Content-Type: application/json" \
326+
-H "Authorization: Bearer $TOKEN" \
327+
-d '{"name":"ci-test-route"}')
328+
echo "Create route response: $RESP"
329+
ROUTE_TOKEN=$(echo $RESP | python3 -c "import sys,json; print(json.load(sys.stdin).get('token',''))")
330+
ROUTE_PATH=$(echo $RESP | python3 -c "import sys,json; print(json.load(sys.stdin).get('route','ci'))")
331+
echo "ROUTE_TOKEN=$ROUTE_TOKEN" >> $GITHUB_ENV
332+
echo "ROUTE_PATH=$ROUTE_PATH" >> $GITHUB_ENV
308333
309334
- name: Send test webhook
310335
run: |
311336
RESPONSE=$(curl -s -o /tmp/webhook_response.txt -w "%{http_code}" \
312-
-X POST http://localhost:3001/webhook \
337+
-X POST http://localhost:3001/r/$ROUTE_TOKEN/$ROUTE_PATH \
313338
-H "Content-Type: application/json" \
314339
-d '{"event":"ci_test","data":{"source":"github-actions"}}')
315340
echo "Response code: $RESPONSE"

0 commit comments

Comments
 (0)