ci: update ci workflow to fix param issue
This commit is contained in:
parent
a84188458e
commit
51b259b87f
|
@ -9,9 +9,26 @@ on:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'packaging/**'
|
- 'packaging/**'
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
specified_source_branch:
|
||||||
|
description: 'Enter the source branch name of TDengine'
|
||||||
|
required: false
|
||||||
|
default: 'unavailable'
|
||||||
|
type: string
|
||||||
|
specified_target_branch:
|
||||||
|
description: 'Enter the target branch name of TDengine'
|
||||||
|
required: false
|
||||||
|
default: 'unavailable'
|
||||||
|
type: string
|
||||||
|
specified_pr_number:
|
||||||
|
description: 'Enter the PR number of TDengine'
|
||||||
|
required: false
|
||||||
|
default: 'unavailable'
|
||||||
|
type: string
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}-TDengine
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.specified_target_branch }}-${{ github.event_name == 'workflow_dispatch' }}-TDengine
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
@ -30,45 +47,49 @@ jobs:
|
||||||
id: parameters
|
id: parameters
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
target_branch=${{ github.event.pull_request.base.ref }}
|
if ${{ github.event_name == 'wrokflow_dispatch' }}; then
|
||||||
|
|
||||||
# Fetch the latest code from the target branch
|
|
||||||
cd ${{ env.WKC }}
|
|
||||||
git reset --hard
|
|
||||||
git clean -f
|
|
||||||
git remote prune origin
|
|
||||||
git fetch
|
|
||||||
git checkout "$target_branch"
|
|
||||||
git remote prune origin
|
|
||||||
git pull >/dev/null
|
|
||||||
|
|
||||||
# Check whether to run tdgpt test cases
|
|
||||||
changed_files_non_doc=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD $target_branch) | grep -v "^docs/en/" | grep -v "^docs/zh/" | grep -v ".md$" | tr '\n' ' ' || :)
|
|
||||||
echo "changed files exclude doc: ${changed_files_non_doc}"
|
|
||||||
|
|
||||||
if [[ -n "$changed_files_non_doc" && "$changed_files_non_doc" =~ (forecastoperator\.c|anomalywindowoperator\.c|tanalytics\.h|tanalytics\.c|tdgpt_cases\.task|analytics|tdgpt) ]]; then
|
|
||||||
run_tdgpt_test="true"
|
|
||||||
else
|
|
||||||
run_tdgpt_test="false"
|
|
||||||
fi
|
|
||||||
echo "run tdgpt test: ${run_tdgpt_test}"
|
|
||||||
|
|
||||||
# Check whether to run function test cases
|
|
||||||
changed_files_non_tdgpt=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD $target_branch) | \
|
|
||||||
grep -v "^docs/en/" | \
|
|
||||||
grep -v "^docs/zh/" | \
|
|
||||||
grep -v ".md$" | \
|
|
||||||
grep -Ev "forecastoperator\.c|anomalywindowoperator\.c|tanalytics\.h|tanalytics\.c|tdgpt_cases\.task|analytics|tdgpt" | \
|
|
||||||
tr '\n' ' ' || :)
|
|
||||||
echo "changed files exclude tdgpt: ${changed_files_non_tdgpt}"
|
|
||||||
|
|
||||||
if [ -n "$changed_files_non_tdgpt" ]; then
|
|
||||||
run_function_test="true"
|
run_function_test="true"
|
||||||
|
run_tdgpt_test="false"
|
||||||
else
|
else
|
||||||
run_function_test="false"
|
target_branch=${{ github.event.pull_request.base.ref }}
|
||||||
fi
|
|
||||||
|
|
||||||
echo "run function test: ${run_function_test}"
|
# Fetch the latest code from the target branch
|
||||||
|
cd ${{ env.WKC }}
|
||||||
|
git reset --hard
|
||||||
|
git clean -f
|
||||||
|
git remote prune origin
|
||||||
|
git fetch
|
||||||
|
git checkout "$target_branch"
|
||||||
|
git remote prune origin
|
||||||
|
git pull >/dev/null
|
||||||
|
|
||||||
|
# Check whether to run tdgpt test cases
|
||||||
|
changed_files_non_doc=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD $target_branch) | grep -v "^docs/en/" | grep -v "^docs/zh/" | grep -v ".md$" | tr '\n' ' ' || :)
|
||||||
|
echo "changed files exclude doc: ${changed_files_non_doc}"
|
||||||
|
|
||||||
|
if [[ -n "$changed_files_non_doc" && "$changed_files_non_doc" =~ (forecastoperator\.c|anomalywindowoperator\.c|tanalytics\.h|tanalytics\.c|tdgpt_cases\.task|analytics|tdgpt) ]]; then
|
||||||
|
run_tdgpt_test="true"
|
||||||
|
else
|
||||||
|
run_tdgpt_test="false"
|
||||||
|
fi
|
||||||
|
echo "run tdgpt test: ${run_tdgpt_test}"
|
||||||
|
|
||||||
|
# Check whether to run function test cases
|
||||||
|
changed_files_non_tdgpt=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD $target_branch) | \
|
||||||
|
grep -v "^docs/en/" | \
|
||||||
|
grep -v "^docs/zh/" | \
|
||||||
|
grep -v ".md$" | \
|
||||||
|
grep -Ev "forecastoperator\.c|anomalywindowoperator\.c|tanalytics\.h|tanalytics\.c|tdgpt_cases\.task|analytics|tdgpt" | \
|
||||||
|
tr '\n' ' ' || :)
|
||||||
|
echo "changed files exclude tdgpt: ${changed_files_non_tdgpt}"
|
||||||
|
|
||||||
|
if [ -n "$changed_files_non_tdgpt" ]; then
|
||||||
|
run_function_test="true"
|
||||||
|
else
|
||||||
|
run_function_test="false"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "run function test: ${run_function_test}"
|
||||||
|
|
||||||
# Output the results for GitHub Actions
|
# Output the results for GitHub Actions
|
||||||
echo "run_function_test=$run_function_test" >> $GITHUB_OUTPUT
|
echo "run_function_test=$run_function_test" >> $GITHUB_OUTPUT
|
||||||
|
@ -79,24 +100,33 @@ jobs:
|
||||||
echo ${{ github.event.pull_request.number }}
|
echo ${{ github.event.pull_request.number }}
|
||||||
|
|
||||||
run-tests-on-linux:
|
run-tests-on-linux:
|
||||||
uses: taosdata/.github/.github/workflows/run-tests-on-linux.yml@main
|
uses: taosdata/.github/.github/workflows/run-tests-on-linux.yml@ci/test/workflow
|
||||||
needs: fetch-parameters
|
needs: fetch-parameters
|
||||||
if: ${{ needs.fetch-parameters.outputs.run_tdgpt_test == 'true' || needs.fetch-parameters.outputs.run_function_test == 'true' }}
|
if: ${{ needs.fetch-parameters.outputs.run_tdgpt_test == 'true' || needs.fetch-parameters.outputs.run_function_test == 'true' }}
|
||||||
with:
|
with:
|
||||||
tdinternal: false
|
tdinternal: false
|
||||||
run_function_test: ${{ needs.fetch-parameters.outputs.run_function_test == 'true' }}
|
run_function_test: ${{ needs.fetch-parameters.outputs.run_function_test == 'true' }}
|
||||||
run_tdgpt_test: ${{ needs.fetch-parameters.outputs.run_tdgpt_test == 'true' }}
|
run_tdgpt_test: ${{ needs.fetch-parameters.outputs.run_tdgpt_test == 'true' }}
|
||||||
|
specified_source_branch: ${{ github.event.inputs.specified_source_branch }}
|
||||||
|
specified_target_branch: ${{ github.event.inputs.specified_target_branch }}
|
||||||
|
specified_pr_number: ${{ github.event.inputs.specified_pr_number }}
|
||||||
|
|
||||||
run-tests-on-mac:
|
run-tests-on-mac:
|
||||||
uses: taosdata/.github/.github/workflows/run-tests-on-macos.yml@main
|
uses: taosdata/.github/.github/workflows/run-tests-on-macos.yml@ci/test/workflow
|
||||||
needs: fetch-parameters
|
needs: fetch-parameters
|
||||||
if: ${{ needs.fetch-parameters.outputs.run_function_test == 'true' }}
|
if: ${{ needs.fetch-parameters.outputs.run_function_test == 'true' }}
|
||||||
with:
|
with:
|
||||||
tdinternal: false
|
tdinternal: false
|
||||||
|
specified_source_branch: ${{ github.event.inputs.specified_source_branch }}
|
||||||
|
specified_target_branch: ${{ github.event.inputs.specified_target_branch }}
|
||||||
|
specified_pr_number: ${{ github.event.inputs.specified_pr_number }}
|
||||||
|
|
||||||
run-tests-on-windows:
|
run-tests-on-windows:
|
||||||
uses: taosdata/.github/.github/workflows/run-tests-on-windows.yml@main
|
uses: taosdata/.github/.github/workflows/run-tests-on-windows.yml@ci/test/workflow
|
||||||
needs: fetch-parameters
|
needs: fetch-parameters
|
||||||
if: ${{ needs.fetch-parameters.outputs.run_function_test == 'true' }}
|
if: ${{ needs.fetch-parameters.outputs.run_function_test == 'true' }}
|
||||||
with:
|
with:
|
||||||
tdinternal: false
|
tdinternal: false
|
||||||
|
specified_source_branch: ${{ github.event.inputs.specified_source_branch }}
|
||||||
|
specified_target_branch: ${{ github.event.inputs.specified_target_branch }}
|
||||||
|
specified_pr_number: ${{ github.event.inputs.specified_pr_number }}
|
||||||
|
|
Loading…
Reference in New Issue