diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6f086ef91..efbc163c1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,6 @@ on: branches: [ "main" ] types: [opened, synchronize, reopened, labeled] - jobs: build: if: >- @@ -340,79 +339,6 @@ jobs: # python -m unittest mooncake-wheel.tests.test_mooncake_backend_p2p_cpu shell: bash - test-sglang-integration: - needs: build-flags - runs-on: ubuntu-latest - env: - tone_user_name: ${{ secrets.TONE_USER_NAME }} - steps: - - name: trigger T-one test - if: ${{ env.tone_user_name != '' }} - run: | - max_attempts=5 - attempt=1 - while [ $attempt -le $max_attempts ]; do - echo "Attempt $attempt: Fetching artifact..." - 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 - echo "Successfully fetched artifact" - break - else - echo "Failed to fetch artifact. Retrying..." - sleep 60 - fi - attempt=$((attempt + 1)) - done - if [ $attempt -gt $max_attempts ]; then - echo "Failed to fetch artifacts after $max_attempts attempts" - exit 1 - fi - - cat artifact.json - artifact_id=$(jq -r ".artifacts[] | select(.name | contains(\"py312\") ) | .id" artifact.json) - signature="${{ secrets.TONE_USER_NAME }}|${{ secrets.TONE_USER_TOKEN }}|$(python3 -c "import time;print(time.time())")" - signature="$(python3 -c "import base64;print(base64.b64encode(\"$signature\".encode('utf-8')).decode('utf-8'))")" - 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 - if [ "$(jq .code job.json)" == 200 ]; then - echo "job created" - else - echo "job create failed" - exit 1 - fi - job_id=$(jq .data.id job.json) - echo "check job status here and remember to cancel it before restart the job !" - echo "job_url: https://tone.openanolis.cn/ws/gclfnh19/test_result/${job_id}?tab=4" - echo "job_id=${job_id}" >> $GITHUB_ENV - shell: bash - - - name: qurey job results - if: ${{ env.tone_user_name != '' }} - run: | - time=0 - while true; do - if [ $time -gt 720 ]; then - echo "timeout" - exit 1 - fi - signature="${{ secrets.TONE_USER_NAME }}|${{ secrets.TONE_USER_TOKEN }}|$(python3 -c "import time;print(time.time())")" - signature="$(python3 -c "import base64;print(base64.b64encode(\"$signature\".encode('utf-8')).decode('utf-8'))")" - 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 - if ! [ "$(jq .code job_status.json)" == 200 ]; then - echo "job query failed" - exit 1 - fi - job_status=$(jq .data.job_second_state job_status.json) - if [[ $job_status =~ "pass" ]]; then - echo "job successful !" - exit 0 - elif [[ $job_status =~ "fail" ]] ; then - echo "job failed or stopped !" - exit 1 - fi - time=$(( time + 1)) - sleep 10 - done - shell: bash - build-flags: if: >- github.event_name == 'push' || diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml new file mode 100644 index 0000000000..eaa6345899 --- /dev/null +++ b/.github/workflows/integration-test.yml @@ -0,0 +1,89 @@ +name: 'Integration test (Linux)' + +on: + push: + branches: [ "main" ] + pull_request_target: + branches: [ "main" ] + types: [opened, synchronize, reopened, labeled] + + +jobs: + test-sglang-integration: + runs-on: ubuntu-latest + env: + tone_user_name: ${{ secrets.TONE_USER_NAME }} + steps: + - name: trigger T-one test + if: ${{ env.tone_user_name != '' }} + run: | + max_attempts=10 + attempt=1 + while [ $attempt -le $max_attempts ]; do + echo "Attempt $attempt: Fetching artifact..." + 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 + artifact_id=$(jq -r ".artifacts[] | select(.name | contains(\"py312\") ) | select(.workflow_run.head_sha == \"${{ github.event.pull_request.head.sha }}\" ) | .id" artifact.json | head -n 1) + if [ -n "$artifact_id" ]; then + echo "Successfully fetched expected artifact id $artifact_id" + break + else + echo "Failed to fetch expected artifact. Retrying..." + if [ $attempt -lt $max_attempts ]; then + sleep $((attempt * 60)) + fi + fi + else + echo "Failed to fetch artifacts. Retrying..." + if [ $attempt -lt $max_attempts ]; then + sleep $((attempt * 60)) + fi + fi + attempt=$((attempt + 1)) + done + if [ $attempt -gt $max_attempts ]; then + echo "Failed to fetch artifacts after $max_attempts attempts" + exit 1 + fi + signature="${{ secrets.TONE_USER_NAME }}|${{ secrets.TONE_USER_TOKEN }}|$(python3 -c "import time;print(time.time())")" + signature="$(python3 -c "import base64;print(base64.b64encode(\"$signature\".encode('utf-8')).decode('utf-8'))")" + 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 + if [ "$(jq .code job.json)" == 200 ]; then + echo "job created" + else + echo "job create failed" + exit 1 + fi + job_id=$(jq .data.id job.json) + echo "check job status here and remember to cancel it before restart the job !" + echo "job_url: https://tone.openanolis.cn/ws/gclfnh19/test_result/${job_id}?tab=4" + echo "job_id=${job_id}" >> $GITHUB_ENV + shell: bash + + - name: qurey job results + if: ${{ env.tone_user_name != '' }} + run: | + time=0 + while true; do + if [ $time -gt 720 ]; then + echo "timeout" + exit 1 + fi + signature="${{ secrets.TONE_USER_NAME }}|${{ secrets.TONE_USER_TOKEN }}|$(python3 -c "import time;print(time.time())")" + signature="$(python3 -c "import base64;print(base64.b64encode(\"$signature\".encode('utf-8')).decode('utf-8'))")" + 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 + if ! [ "$(jq .code job_status.json)" == 200 ]; then + echo "job query failed" + exit 1 + fi + job_status=$(jq .data.job_second_state job_status.json) + if [[ $job_status =~ "pass" ]]; then + echo "job successful !" + exit 0 + elif [[ $job_status =~ "fail" ]] ; then + echo "job failed or stopped !" + exit 1 + fi + time=$(( time + 1)) + sleep 10 + done + shell: bash \ No newline at end of file