Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading