diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 930a765c56..3a717738a1 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -3,9 +3,21 @@ name: 'Integration test (Linux)' on: push: branches: [ "main" ] + paths: + - 'mooncake-*/**' + - 'extern/**' + - 'CMakeLists.txt' + - 'scripts/**' + - '.github/workflows/**' pull_request_target: branches: [ "main" ] 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