Merge pull request #29984 from taosdata/td33762

ci: add windows  test job to ci workflow
This commit is contained in:
WANG Xu 2025-03-04 13:35:43 +08:00 committed by GitHub
commit 67d801c5b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 153 additions and 11 deletions

View File

@ -1,14 +1,14 @@
name: TDengine CI Test name: TDengine CI Test
on: on:
pull_request: # pull_request:
branches: # branches:
- 'main' # - 'main'
- '3.0' # - '3.0'
- '3.1' # - '3.1'
paths-ignore: # paths-ignore:
- 'packaging/**' # - 'packaging/**'
- 'docs/**' # - 'docs/**'
repository_dispatch: repository_dispatch:
types: [run-tests] types: [run-tests]
@ -65,7 +65,7 @@ jobs:
# check whether to run function test cases # 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" | tr '\n' ' ' ||:) 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" | tr '\n' ' ' ||:)
if [ $changed_files_non_tdgpt != '' ]; then if [ "$changed_files_non_tdgpt" != '' ]; then
run_function_test="true" run_function_test="true"
else else
run_function_test="false" run_function_test="false"
@ -167,14 +167,17 @@ jobs:
changed_files_non_doc=$(git --no-pager diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD ${{ env.TARGET_BRANCH }}`|grep -v "^docs/en/"|grep -v "^docs/zh/"|grep -v ".md$" | tr '\n' ' ' || :) changed_files_non_doc=$(git --no-pager diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD ${{ env.TARGET_BRANCH }}`|grep -v "^docs/en/"|grep -v "^docs/zh/"|grep -v ".md$" | tr '\n' ' ' || :)
echo $changed_files_non_doc > ${{ env.WKDIR }}/tmp/${{ env.PR_NUMBER }}_${{ github.run_number }}/docs_changed.txt echo $changed_files_non_doc > ${{ env.WKDIR }}/tmp/${{ env.PR_NUMBER }}_${{ github.run_number }}/docs_changed.txt
- name: Check assert testing - name: Check assert testing
if: ${{ env.IS_TDINTERNAL == 'false' }}
run: | run: |
cd ${{ env.WKC }}/tests/parallel_test cd ${{ env.WKC }}/tests/parallel_test
./run_check_assert_container.sh -d ${{ env.WKDIR }} ./run_check_assert_container.sh -d ${{ env.WKDIR }}
- name: Check void function testing - name: Check void function testing
if: ${{ env.IS_TDINTERNAL == 'false' }}
run: | run: |
cd ${{ env.WKC }}/tests/parallel_test cd ${{ env.WKC }}/tests/parallel_test
./run_check_void_container.sh -d ${{ env.WKDIR }} ./run_check_void_container.sh -d ${{ env.WKDIR }}
- name: Build docker container - name: Build docker container
if: ${{ env.RUN_RUNCTION_TEST == 'true' }}
run: | run: |
date date
rm -rf ${{ env.WKC }}/debug rm -rf ${{ env.WKC }}/debug
@ -204,6 +207,7 @@ jobs:
echo "timeout_cmd=$timeout_cmd" >> $GITHUB_OUTPUT echo "timeout_cmd=$timeout_cmd" >> $GITHUB_OUTPUT
echo "extra_param=$extra_param" >> $GITHUB_OUTPUT echo "extra_param=$extra_param" >> $GITHUB_OUTPUT
- name: Run function returns with a null pointer scan testing - name: Run function returns with a null pointer scan testing
if: ${{ env.IS_TDINTERNAL == 'false' }}
run: | run: |
cd ${{ env.WKC }}/tests/parallel_test cd ${{ env.WKC }}/tests/parallel_test
./run_scan_container.sh -d ${{ env.WKDIR }} -b ${{ env.PR_NUMBER }}_${{ github.run_number }} -f ${{ env.WKDIR }}/tmp/${{ env.PR_NUMBER }}_${{ github.run_number }}/docs_changed.txt ${{ steps.get_param.outputs.extra_param }} ./run_scan_container.sh -d ${{ env.WKDIR }} -b ${{ env.PR_NUMBER }}_${{ github.run_number }} -f ${{ env.WKDIR }}/tmp/${{ env.PR_NUMBER }}_${{ github.run_number }}/docs_changed.txt ${{ steps.get_param.outputs.extra_param }}
@ -215,7 +219,7 @@ jobs:
date date
timeout 600 time ./run.sh -e -m /home/m.json -t tdgpt_cases.task -b ${{ env.PR_NUMBER }}_${{ github.run_number }} -l ${{ env.WKDIR }}/log -o 300 ${{ steps.get_param.outputs.extra_param }} timeout 600 time ./run.sh -e -m /home/m.json -t tdgpt_cases.task -b ${{ env.PR_NUMBER }}_${{ github.run_number }} -l ${{ env.WKDIR }}/log -o 300 ${{ steps.get_param.outputs.extra_param }}
- name: Run function test cases - name: Run function test cases
if: ${{ env.RUN_RUNCTION_TEST }} == 'true' if: ${{ env.RUN_RUNCTION_TEST == 'true'}}
run: | run: |
cd ${{ env.WKC }}/tests/parallel_test cd ${{ env.WKC }}/tests/parallel_test
export DEFAULT_RETRY_TIME=2 export DEFAULT_RETRY_TIME=2
@ -224,7 +228,7 @@ jobs:
run-tests-on-mac: run-tests-on-mac:
needs: fetch-parameters needs: fetch-parameters
if: ${{ needs.fetch-parameters.outputs.run_function_test == 'false' }} if: ${{ needs.fetch-parameters.outputs.run_function_test == 'true' }}
runs-on: runs-on:
group: CI group: CI
labels: [self-hosted, macOS, ARM64, testing] labels: [self-hosted, macOS, ARM64, testing]
@ -313,3 +317,141 @@ jobs:
make -j10 make -j10
ctest -j10 || exit 7 ctest -j10 || exit 7
date date
run-tests-on-windows:
needs: fetch-parameters
if: ${{ needs.fetch-parameters.outputs.run_function_test == 'true' }}
runs-on:
group: CI
labels: [self-hosted, Windows, X64, testing]
timeout-minutes: 126
env:
IS_TDINTERNAL: ${{ needs.fetch-parameters.outputs.tdinternal }}
SOURCE_BRANCH: ${{ needs.fetch-parameters.outputs.source_branch }}
TARGET_BRANCH: ${{ needs.fetch-parameters.outputs.target_branch }}
PR_NUMBER: ${{ needs.fetch-parameters.outputs.pr_number }}
WIN_INTERNAL_ROOT: "C:\\workspace\\TDinternal"
WIN_COMMUNITY_ROOT: "C:\\workspace\\TDinternal\\community"
WIN_SYSTEM_TEST_ROOT: "C:\\workspace\\TDinternal\\community\\tests\\system-test"
WIN_VS_PATH: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat"
WIN_CPU_TYPE: "x64"
steps:
- name: Output the environment information
run: |
hostname
taskkill /f /t /im python.exe
taskkill /f /t /im bash.exe
taskkill /f /t /im taosd.exe
ipconfig
set
date /t
time /t
rd /s /Q "%WIN_INTERNAL_ROOT%\debug" || exit 0
shell: cmd
- name: Prepare repositories
run: |
:: Prepare internal repository
if exist "%WIN_INTERNAL_ROOT%" (
cd /d "%WIN_INTERNAL_ROOT%"
git reset --hard
git clean -f
git remote prune origin
git fetch
git checkout "%TARGET_BRANCH%"
) else (
echo Directory does not exist: "%WIN_INTERNAL_ROOT%"
exit 1
)
:: Prepare community repository
if exist "%WIN_COMMUNITY_ROOT%" (
cd /d "%WIN_COMMUNITY_ROOT%"
git reset --hard
git clean -f
git remote prune origin
git fetch
git checkout "%TARGET_BRANCH%"
) else (
echo Directory does not exist: "%WIN_COMMUNITY_ROOT%"
exit 1
)
shell: cmd
- name: Get latest codes and logs for TDinternal PR
if: ${{ env.IS_TDINTERNAL == 'true' }}
run: |
cd %WIN_INTERNAL_ROOT%
git pull origin %TARGET_BRANCH%
git fetch origin +refs/pull/%PR_NUMBER%/merge
git checkout -qf FETCH_HEAD
cd %WIN_COMMUNITY_ROOT%
git remote prune origin
git pull
shell: cmd
- name: Get latest codes and logs for TDengine PR
if: ${{ env.IS_TDINTERNAL == 'false' }}
run: |
cd %WIN_INTERNAL_ROOT%
git pull origin %TARGET_BRANCH%
cd %WIN_COMMUNITY_ROOT%
git remote prune origin
git pull origin %TARGET_BRANCH%
git fetch origin +refs/pull/%PR_NUMBER%/merge
git checkout -qf FETCH_HEAD
shell: cmd
- name: Output branch and log information
run: |
cd %WIN_INTERNAL_ROOT%
git branch
git log -5
cd %WIN_COMMUNITY_ROOT%
git branch
git log -5
shell: cmd
- name: Update submodule
run: |
cd %WIN_COMMUNITY_ROOT%
git submodule update --init --recursive
shell: cmd
- name: Build on windows
run: |
echo "building ..."
time /t
cd %WIN_INTERNAL_ROOT%
mkdir debug
cd debug
time /t
call "%WIN_VS_PATH%" %WIN_CPU_TYPE%
set CL=/MP8
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> cmake"
time /t
cmake .. -G "NMake Makefiles JOM" -DBUILD_TEST=true -DBUILD_TOOLS=true || exit 7
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> jom -j 6"
time /t
jom -j 6 || exit 8
time /t
cd %WIN_COMMUNITY_ROOT%/tests/ci
pip3 install taospy==2.7.21
pip3 install taos-ws-py==0.3.8
xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
shell: cmd
- name: Run ctest
run: |
echo "windows ctest ..."
time /t
cd %WIN_INTERNAL_ROOT%\\debug
ctest -j 1 || exit 7
time /t
shell: cmd
- name: Run function test
run: |
echo "windows test ..."
xcopy /e/y/i/f "%WIN_INTERNAL_ROOT%\debug\build\lib\taos.dll" C:\Windows\System32
ls -l "C:\Windows\System32\taos.dll"
time /t
cd %WIN_SYSTEM_TEST_ROOT%
echo "testing ..."
test-all.bat ci
time /t
shell: cmd