From 4990b2d033753bf68cfa41aefc2439423fb3391b Mon Sep 17 00:00:00 2001 From: shicanwei Date: Thu, 5 Mar 2026 17:19:11 +0800 Subject: [PATCH 1/4] ci: pass PR_ID to T-one env_info for fork PR test script support Signed-off-by: shicanwei --- .github/workflows/integration-test.yml | 27 +++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 930a765c56..a2da8faef0 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -2,10 +2,22 @@ name: 'Integration test (Linux)' on: push: - branches: [ "main" ] + branches: [ "PR_ID_test" ] + paths: + - 'mooncake-*/**' + - 'extern/**' + - 'CMakeLists.txt' + - 'scripts/**' + - '.github/workflows/**' pull_request_target: - branches: [ "main" ] + branches: [ "PR_ID_test" ] types: [opened, synchronize, reopened, labeled] + paths: + - 'mooncake-*/**' + - 'extern/**' + - 'CMakeLists.txt' + - 'scripts/**' + - '.github/workflows/**' jobs: @@ -18,9 +30,13 @@ jobs: if: ${{ env.tone_user_name != '' }} run: | SHA="${{ github.event.pull_request.head.sha }}" + PR_ID="${{ github.event.pull_request.number }}" + if [ "${{ github.event_name }}" = "push" ]; then SHA="${{ github.sha }}" + PR_ID="" fi + echo "PR_ID=${PR_ID}" max_attempts=120 attempt=1 while [ $attempt -le $max_attempts ]; do @@ -53,9 +69,14 @@ jobs: echo "Failed to fetch artifacts after $max_attempts attempts" exit 1 fi + + ENV_INFO="ARTIFACT_ID=${artifact_id} GIT_REPO=${{ github.repository }}" + if [ -n "$PR_ID" ]; then + ENV_INFO="${ENV_INFO} PR_ID=${PR_ID}" + 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-${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 + curl -s -H 'Content-Type: application/json' -X POST -d "{\"workspace\":\"mooncake_test\",\"project\":\"mooncake-ci\",\"template\":\"mooncake-ci-test\",\"name\":\"mooncake-ci-${SHA}\",\"username\":\"${{ secrets.TONE_USER_NAME }}\",\"env_ifs\":\" \",\"env_info\":\"${ENV_INFO}\",\"signature\":\"$signature\"}" https://tone.openanolis.cn/api/job/create/ > job.json if [ "$(jq .code job.json)" == 200 ]; then echo "job created" else From 46c80c92075914330c870351f171b7c74fa5d4d1 Mon Sep 17 00:00:00 2001 From: "shicanwei.scw" Date: Thu, 5 Mar 2026 19:47:25 +0800 Subject: [PATCH 2/4] fix ci.yml Signed-off-by: shicanwei.scw --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af4d6f34be..a3b7d0d4a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ on: push: branches: [ "main" ] pull_request: - branches: [ "main" ] + branches: [ "main", "PR_ID_test" ] types: [opened, synchronize, reopened, labeled] From 1739bc470ca72d419ae1ad3b030ba236a9c4cff3 Mon Sep 17 00:00:00 2001 From: "shicanwei.scw" Date: Thu, 5 Mar 2026 20:40:09 +0800 Subject: [PATCH 3/4] rm paths test Signed-off-by: shicanwei.scw --- .github/workflows/integration-test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index a2da8faef0..3db5e740d2 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -12,12 +12,12 @@ on: pull_request_target: branches: [ "PR_ID_test" ] types: [opened, synchronize, reopened, labeled] - paths: - - 'mooncake-*/**' - - 'extern/**' - - 'CMakeLists.txt' - - 'scripts/**' - - '.github/workflows/**' + # paths: + # - 'mooncake-*/**' + # - 'extern/**' + # - 'CMakeLists.txt' + # - 'scripts/**' + # - '.github/workflows/**' jobs: From ecf617ec07da6559324ad7cb318241c4be3dc511 Mon Sep 17 00:00:00 2001 From: "shicanwei.scw" Date: Thu, 5 Mar 2026 20:59:38 +0800 Subject: [PATCH 4/4] fix Signed-off-by: shicanwei.scw --- .github/workflows/ci.yml | 2 +- .github/workflows/integration-test.yml | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3b7d0d4a6..af4d6f34be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ on: push: branches: [ "main" ] pull_request: - branches: [ "main", "PR_ID_test" ] + branches: [ "main" ] types: [opened, synchronize, reopened, labeled] diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 3db5e740d2..3a717738a1 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -2,7 +2,7 @@ name: 'Integration test (Linux)' on: push: - branches: [ "PR_ID_test" ] + branches: [ "main" ] paths: - 'mooncake-*/**' - 'extern/**' @@ -10,14 +10,14 @@ on: - 'scripts/**' - '.github/workflows/**' pull_request_target: - branches: [ "PR_ID_test" ] + branches: [ "main" ] types: [opened, synchronize, reopened, labeled] - # paths: - # - 'mooncake-*/**' - # - 'extern/**' - # - 'CMakeLists.txt' - # - 'scripts/**' - # - '.github/workflows/**' + paths: + - 'mooncake-*/**' + - 'extern/**' + - 'CMakeLists.txt' + - 'scripts/**' + - '.github/workflows/**' jobs: