Skip to content

Commit 7425700

Browse files
committed
change integration test ci
1 parent 0280d83 commit 7425700

2 files changed

Lines changed: 79 additions & 73 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -340,79 +340,6 @@ jobs:
340340
# python -m unittest mooncake-wheel.tests.test_mooncake_backend_p2p_cpu
341341
shell: bash
342342

343-
test-sglang-integration:
344-
needs: build-flags
345-
runs-on: ubuntu-latest
346-
env:
347-
tone_user_name: ${{ secrets.TONE_USER_NAME }}
348-
steps:
349-
- name: trigger T-one test
350-
if: ${{ env.tone_user_name != '' }}
351-
run: |
352-
max_attempts=5
353-
attempt=1
354-
while [ $attempt -le $max_attempts ]; do
355-
echo "Attempt $attempt: Fetching artifact..."
356-
if curl -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts > artifact.json; then
357-
echo "Successfully fetched artifact"
358-
break
359-
else
360-
echo "Failed to fetch artifact. Retrying..."
361-
sleep 60
362-
fi
363-
attempt=$((attempt + 1))
364-
done
365-
if [ $attempt -gt $max_attempts ]; then
366-
echo "Failed to fetch artifacts after $max_attempts attempts"
367-
exit 1
368-
fi
369-
370-
cat artifact.json
371-
artifact_id=$(jq -r ".artifacts[] | select(.name | contains(\"py312\") ) | .id" artifact.json)
372-
signature="${{ secrets.TONE_USER_NAME }}|${{ secrets.TONE_USER_TOKEN }}|$(python3 -c "import time;print(time.time())")"
373-
signature="$(python3 -c "import base64;print(base64.b64encode(\"$signature\".encode('utf-8')).decode('utf-8'))")"
374-
curl -s -H 'Content-Type: application/json' -X POST -d "{\"workspace\":\"mooncake_test\",\"project\":\"mooncake-ci\",\"template\":\"mooncake-ci-test\",\"name\":\"mooncake-ci-${{ github.sha }}\",\"username\":\"${{ secrets.TONE_USER_NAME }}\",\"env_ifs\":\" \",\"env_info\":\"ARTIFACT_ID=${artifact_id} GIT_REPO=${{ github.repository }}\",\"signature\":\"$signature\"}" https://tone.openanolis.cn/api/job/create/ > job.json
375-
if [ "$(jq .code job.json)" == 200 ]; then
376-
echo "job created"
377-
else
378-
echo "job create failed"
379-
exit 1
380-
fi
381-
job_id=$(jq .data.id job.json)
382-
echo "check job status here and remember to cancel it before restart the job !"
383-
echo "job_url: https://tone.openanolis.cn/ws/gclfnh19/test_result/${job_id}?tab=4"
384-
echo "job_id=${job_id}" >> $GITHUB_ENV
385-
shell: bash
386-
387-
- name: qurey job results
388-
if: ${{ env.tone_user_name != '' }}
389-
run: |
390-
time=0
391-
while true; do
392-
if [ $time -gt 720 ]; then
393-
echo "timeout"
394-
exit 1
395-
fi
396-
signature="${{ secrets.TONE_USER_NAME }}|${{ secrets.TONE_USER_TOKEN }}|$(python3 -c "import time;print(time.time())")"
397-
signature="$(python3 -c "import base64;print(base64.b64encode(\"$signature\".encode('utf-8')).decode('utf-8'))")"
398-
curl -s -H 'Content-Type: application/json' -X POST -d "{\"username\":\"${{ secrets.TONE_USER_NAME }}\", \"signature\":\"$signature\", \"job_id\": \"${job_id}\"}" https://tone.openanolis.cn/api/job/query/ > job_status.json
399-
if ! [ "$(jq .code job_status.json)" == 200 ]; then
400-
echo "job query failed"
401-
exit 1
402-
fi
403-
job_status=$(jq .data.job_second_state job_status.json)
404-
if [[ $job_status =~ "pass" ]]; then
405-
echo "job successful !"
406-
exit 0
407-
elif [[ $job_status =~ "fail" ]] ; then
408-
echo "job failed or stopped !"
409-
exit 1
410-
fi
411-
time=$(( time + 1))
412-
sleep 10
413-
done
414-
shell: bash
415-
416343
build-flags:
417344
if: >-
418345
github.event_name == 'push' ||
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: 'Integration test (Linux)'
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request_target:
7+
branches: [ "main" ]
8+
types: [opened, synchronize, reopened, labeled]
9+
10+
11+
jobs:
12+
test-sglang-integration:
13+
runs-on: ubuntu-latest
14+
env:
15+
tone_user_name: ${{ secrets.TONE_USER_NAME }}
16+
steps:
17+
- name: trigger T-one test
18+
if: ${{ env.tone_user_name != '' }}
19+
run: |
20+
max_attempts=10
21+
attempt=1
22+
while [ $attempt -le $max_attempts ]; do
23+
echo "Attempt $attempt: Fetching artifact..."
24+
if curl -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${{ github.repository }}/actions/artifacts > artifact.json; then
25+
echo "Successfully fetched artifact"
26+
artifact_id=$(jq -r ".artifacts[] | select(.name | contains(\"py312\") ) | select(.workflow_run.head_sha == \"${{ github.sha }}\" ) | .id" artifact.json | head -n 1)
27+
else
28+
echo "Failed to fetch artifact. Retrying..."
29+
sleep 120
30+
fi
31+
attempt=$((attempt + 1))
32+
done
33+
if [ $attempt -gt $max_attempts ]; then
34+
echo "Failed to fetch artifacts after $max_attempts attempts"
35+
exit 1
36+
fi
37+
signature="${{ secrets.TONE_USER_NAME }}|${{ secrets.TONE_USER_TOKEN }}|$(python3 -c "import time;print(time.time())")"
38+
signature="$(python3 -c "import base64;print(base64.b64encode(\"$signature\".encode('utf-8')).decode('utf-8'))")"
39+
curl -s -H 'Content-Type: application/json' -X POST -d "{\"workspace\":\"mooncake_test\",\"project\":\"mooncake-ci\",\"template\":\"mooncake-ci-test\",\"name\":\"mooncake-ci-${{ github.sha }}\",\"username\":\"${{ secrets.TONE_USER_NAME }}\",\"env_ifs\":\" \",\"env_info\":\"ARTIFACT_ID=${artifact_id} GIT_REPO=${{ github.repository }}\",\"signature\":\"$signature\"}" https://tone.openanolis.cn/api/job/create/ > job.json
40+
if [ "$(jq .code job.json)" == 200 ]; then
41+
echo "job created"
42+
else
43+
echo "job create failed"
44+
exit 1
45+
fi
46+
job_id=$(jq .data.id job.json)
47+
echo "check job status here and remember to cancel it before restart the job !"
48+
echo "job_url: https://tone.openanolis.cn/ws/gclfnh19/test_result/${job_id}?tab=4"
49+
echo "job_id=${job_id}" >> $GITHUB_ENV
50+
shell: bash
51+
52+
- name: qurey job results
53+
if: ${{ env.tone_user_name != '' }}
54+
run: |
55+
time=0
56+
while true; do
57+
if [ $time -gt 720 ]; then
58+
echo "timeout"
59+
exit 1
60+
fi
61+
signature="${{ secrets.TONE_USER_NAME }}|${{ secrets.TONE_USER_TOKEN }}|$(python3 -c "import time;print(time.time())")"
62+
signature="$(python3 -c "import base64;print(base64.b64encode(\"$signature\".encode('utf-8')).decode('utf-8'))")"
63+
curl -s -H 'Content-Type: application/json' -X POST -d "{\"username\":\"${{ secrets.TONE_USER_NAME }}\", \"signature\":\"$signature\", \"job_id\": \"${job_id}\"}" https://tone.openanolis.cn/api/job/query/ > job_status.json
64+
if ! [ "$(jq .code job_status.json)" == 200 ]; then
65+
echo "job query failed"
66+
exit 1
67+
fi
68+
job_status=$(jq .data.job_second_state job_status.json)
69+
if [[ $job_status =~ "pass" ]]; then
70+
echo "job successful !"
71+
exit 0
72+
elif [[ $job_status =~ "fail" ]] ; then
73+
echo "job failed or stopped !"
74+
exit 1
75+
fi
76+
time=$(( time + 1))
77+
sleep 10
78+
done
79+
shell: bash

0 commit comments

Comments
 (0)