Skip to content

fix(model_ark): callbackInput miss tool info #1608

fix(model_ark): callbackInput miss tool info

fix(model_ark): callbackInput miss tool info #1608

Workflow file for this run

name: EinoExt CI
on:
pull_request:
push:
branches:
- main
env:
COVERAGE_FILE: coverage.out
COVERAGE_PROFILES: coverage.out
BREAKDOWN_FILE: base.coverage
jobs:
unit-test:
runs-on: ubuntu-latest
env:
COVERAGE_FILE: coverage.out
BREAKDOWN_FILE: base.coverage
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
# - name: Go test for every module
# run: |
# modules=`find . -name "go.mod" -exec dirname {} \;`
# echo "all the modules in eino-ext: "
# echo "${modules}"
# coverprofiles=""
# for module in $modules; do
# echo "--------------------------------------------------"
# echo "run unit test for ${module}"
# cd ${module}
# go test -race -coverprofile=./${COVERAGE_FILE} -gcflags="all=-l -N" -coverpkg=./... ./...
# cd -
# coverprofiles="${module}/${COVERAGE_FILE},$coverprofiles"
# done
# # Remove trailing comma from coverprofiles
# coverprofiles=${coverprofiles%,}
# echo "COVERAGE_PROFILES=$coverprofiles" >> $GITHUB_ENV
- name: Go test in go workspace
run: |
modules=`find . -name "go.mod" -exec dirname {} \;`
echo "all the modules in eino-ext: "
echo "${modules}"
if [[ ! -f "go.work" ]];then go work init;fi
list=""
coverpkg=""
for module in $modules; do
go work use ${module}
list="${module}/... ${list}"
coverpkg="${module}/...,${coverpkg}"
done
# trim the last comma
coverpkg=${coverpkg%,}
go work sync
coverprofiles=${COVERAGE_FILE}
go test -race -coverprofile=coverage.out -gcflags="all=-l -N" -coverpkg=$coverpkg $list
echo "COVERAGE_PROFILES=$coverprofiles" >> $GITHUB_ENV
- name: Download base.coverage for diff coverage rate
id: download-base-coverage
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: ${{ env.BREAKDOWN_FILE }}
- name: Calculate coverage
id: calculate-coverage
uses: vladopajic/[email protected]
with:
profile: ${{env.COVERAGE_PROFILES}}
config: ./.testcoverage.yml
breakdown-file-name: ${{ github.ref_name == 'main' && env.BREAKDOWN_FILE || '' }}
diff-base-breakdown-file-name: ${{ steps.download-base-coverage.outcome == 'success' && env.BREAKDOWN_FILE || '' }}
- name: Upload base.coverage of main branch
uses: actions/upload-artifact@v4
if: github.ref_name == 'main'
with:
name: ${{env.BREAKDOWN_FILE}}
path: ${{env.BREAKDOWN_FILE}}
if-no-files-found: error
- name: Find coverage report
if: ${{ always() && github.event.pull_request.number != null }}
uses: peter-evans/find-comment@v3
continue-on-error: true
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'go-test-coverage report:'
- name: Post coverage report
if: ${{ always() && github.event.pull_request.number != null }}
uses: peter-evans/create-or-update-comment@v4
continue-on-error: true
with:
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.find-comment.outputs.comment-id || '' }}
edit-mode: replace
body: |
go-test-coverage report:
```
${{ steps.calculate-coverage.outputs.report && fromJSON(steps.calculate-coverage.outputs.report) || 'No coverage report available' }} ```
reactions: heart
reactions-edit-mode: append
unit-benchmark-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Go BenchMark
run: |
modules=`find . -name "go.mod" -exec dirname {} \;`
echo $modules
list=""
coverpkg=""
if [[ ! -f "go.work" ]];then go work init;fi
for module in $modules; do go work use $module; list=$module"/... "$list; coverpkg=$module"/...,"$coverpkg; done
go work sync
go test -bench=. -run=none -gcflags="all=-N -l" $list
check-submodule-changes:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
repository-projects: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check modified files in submodules
id: check-mods
run: |
# Get all directories containing go.mod
modules=$(find . -name "go.mod" -exec dirname {} \;)
# Get list of modified files
if [ "${{ github.event_name }}" == "pull_request" ]; then
changed_files=$(git diff --name-only origin/${{ github.base_ref }} HEAD)
else
changed_files=$(git diff --name-only HEAD^ HEAD)
fi
# Initialize messages
echo "### Need to create a new tag" > tag_message.txt
echo "The following modules have changes and may need version updates:" >> tag_message.txt
echo "### Documentation Updates" > readme_message.txt
echo "The following README files have been modified:" >> readme_message.txt
need_tag=false
has_readme_changes=false
# Check each module
for module in $modules; do
module_name=${module#./}
# Check for module changes
if echo "$changed_files" | grep -q "^$module_name/"; then
latest_tag=$(git tag -l "${module_name}/v*" | sort -V | tail -n 1)
if [ ! -z "$latest_tag" ]; then
need_tag=true
echo -e "- \`${module_name}\` (Current: ${latest_tag})\n" >> tag_message.txt
fi
# Check for README changes
if echo "$changed_files" | grep -q "^$module_name/README\(_zh\)\?\.md$"; then
has_readme_changes=true
echo -e "- \`${module_name}\` README has been updated\n" >> readme_message.txt
fi
fi
done
# Different message for PR and merge
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo -e "\n⚠️ Please create and push new version tags for these modules after merging this PR." >> tag_message.txt
echo -e "\n⚠️ Please update the official documentation after merging this PR." >> readme_message.txt
else
echo -e "\n⚠️ Changes have been merged to main branch. \nPlease create new version tags for these modules." >> tag_message.txt
echo -e "\n⚠️ Changes have been merged to main branch. \nPlease update the official documentation." >> readme_message.txt
fi
# Save message and prepare webhook payloads
repo_url="https://github.com/${{ github.repository }}/commit/${{ github.sha }}"
if [ "$need_tag" = true ]; then
message="$(cat tag_message.txt)"
jq -n --arg title "Need to create a new tag" \
--arg content "$message" \
--arg repo_url "$repo_url" \
'{
"msg_type": "interactive",
"card": {
"elements": [
{
"tag": "markdown",
"content": $content
},
{
"tag": "action",
"actions": [
{
"tag": "button",
"text": {
"tag": "plain_text",
"content": "🔗 View on GitHub"
},
"url": $repo_url,
"type": "default"
}
]
}
],
"header": {
"title": {
"tag": "plain_text",
"content": "Need to create a new tag"
}
}
}
}' > tag_webhook_payload.json
fi
if [ "$has_readme_changes" = true ]; then
message="$(cat readme_message.txt)"
jq -n --arg title "Documentation Updates" \
--arg content "$message" \
--arg repo_url "$repo_url" \
'{
"msg_type": "interactive",
"card": {
"elements": [
{
"tag": "markdown",
"content": $content
},
{
"tag": "action",
"actions": [
{
"tag": "button",
"text": {
"tag": "plain_text",
"content": "🔗 View Changes on GitHub"
},
"url": $repo_url,
"type": "default"
}
]
}
],
"header": {
"title": {
"tag": "plain_text",
"content": "Documentation Updates Required"
}
}
}
}' > readme_webhook_payload.json
fi
echo "needs_tag=$need_tag" >> $GITHUB_OUTPUT
echo "has_readme_changes=$has_readme_changes" >> $GITHUB_OUTPUT
- name: Find existing comment
if: steps.check-mods.outputs.needs_tag == 'true' && github.event_name == 'pull_request'
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: "### 🏷️ Tag Version Reminder"
- name: Post or update PR comment
if: steps.check-mods.outputs.needs_tag == 'true' && github.event_name == 'pull_request'
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
body-file: tag_message.txt
edit-mode: replace
- name: Send tag webhook notification
if: steps.check-mods.outputs.needs_tag == 'true' && github.event_name == 'push'
run: |
curl -X POST \
-H "Content-Type: application/json" \
-d @tag_webhook_payload.json \
"${{ secrets.FEISHU_WEBHOOK_URL }}"
- name: Send readme webhook notification
if: steps.check-mods.outputs.has_readme_changes == 'true' && github.event_name == 'push'
run: |
curl -X POST \
-H "Content-Type: application/json" \
-d @readme_webhook_payload.json \
"${{ secrets.FEISHU_WEBHOOK_URL }}"