From d4281aa4b60869b93302521e1c2b1f01711bdda9 Mon Sep 17 00:00:00 2001 From: Feng Chao Date: Mon, 3 Mar 2025 14:56:54 +0800 Subject: [PATCH 1/3] ci: add windows build and test job to ci workflow --- .github/workflows/taosd-ci.yml | 146 ++++++++++++++++++++++++++++++++- 1 file changed, 143 insertions(+), 3 deletions(-) diff --git a/.github/workflows/taosd-ci.yml b/.github/workflows/taosd-ci.yml index 5be958adf7..f1ba0072f0 100644 --- a/.github/workflows/taosd-ci.yml +++ b/.github/workflows/taosd-ci.yml @@ -65,7 +65,7 @@ jobs: # 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' ' ' ||:) - if [ $changed_files_non_tdgpt != '' ]; then + if [ "$changed_files_non_tdgpt" != '' ]; then run_function_test="true" else 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' ' ' || :) echo $changed_files_non_doc > ${{ env.WKDIR }}/tmp/${{ env.PR_NUMBER }}_${{ github.run_number }}/docs_changed.txt - name: Check assert testing + if: ${{ env.IS_TDINTERNAL == 'false' }} run: | cd ${{ env.WKC }}/tests/parallel_test ./run_check_assert_container.sh -d ${{ env.WKDIR }} - name: Check void function testing + if: ${{ env.IS_TDINTERNAL == 'false' }} run: | cd ${{ env.WKC }}/tests/parallel_test ./run_check_void_container.sh -d ${{ env.WKDIR }} - name: Build docker container + if: ${{ env.RUN_RUNCTION_TEST == 'true' }} run: | date rm -rf ${{ env.WKC }}/debug @@ -204,6 +207,7 @@ jobs: echo "timeout_cmd=$timeout_cmd" >> $GITHUB_OUTPUT echo "extra_param=$extra_param" >> $GITHUB_OUTPUT - name: Run function returns with a null pointer scan testing + if: ${{ env.IS_TDINTERNAL == 'false' }} run: | 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 }} @@ -215,7 +219,7 @@ jobs: 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 }} - name: Run function test cases - if: ${{ env.RUN_RUNCTION_TEST }} == 'true' + if: ${{ env.RUN_RUNCTION_TEST == 'true'}} run: | cd ${{ env.WKC }}/tests/parallel_test export DEFAULT_RETRY_TIME=2 @@ -224,7 +228,7 @@ jobs: run-tests-on-mac: needs: fetch-parameters - if: ${{ needs.fetch-parameters.outputs.run_function_test == 'false' }} + if: ${{ needs.fetch-parameters.outputs.run_function_test == 'true' }} runs-on: group: CI labels: [self-hosted, macOS, ARM64, testing] @@ -313,3 +317,139 @@ jobs: make -j10 ctest -j10 || exit 7 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\\2019\\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%" + ) + + :: 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%" + ) + 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 From 997ea8691ae526c74cd8d1d0dcacb7bb3612a17f Mon Sep 17 00:00:00 2001 From: Feng Chao Date: Tue, 4 Mar 2025 08:52:32 +0800 Subject: [PATCH 2/3] Apply suggestions from code review Add "exit 1" to handle the exception of the diretory doesn't exist Co-authored-by: WANG Xu --- .github/workflows/taosd-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/taosd-ci.yml b/.github/workflows/taosd-ci.yml index f1ba0072f0..f92db448f6 100644 --- a/.github/workflows/taosd-ci.yml +++ b/.github/workflows/taosd-ci.yml @@ -360,6 +360,7 @@ jobs: git checkout "%TARGET_BRANCH%" ) else ( echo Directory does not exist: "%WIN_INTERNAL_ROOT%" + exit 1 ) :: Prepare community repository @@ -372,6 +373,7 @@ jobs: 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 From 502de809517ecb3f1b241efe1f1a9e7cf620da05 Mon Sep 17 00:00:00 2001 From: Feng Chao Date: Tue, 4 Mar 2025 10:25:23 +0800 Subject: [PATCH 3/3] fix: Update taosd-ci.yml 1. Remove the trigger condition to debug the TDinternal CI workflow 2. Update variable for the same configuration of windows runner --- .github/workflows/taosd-ci.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/taosd-ci.yml b/.github/workflows/taosd-ci.yml index f92db448f6..d2c743aac6 100644 --- a/.github/workflows/taosd-ci.yml +++ b/.github/workflows/taosd-ci.yml @@ -1,14 +1,14 @@ name: TDengine CI Test on: - pull_request: - branches: - - 'main' - - '3.0' - - '3.1' - paths-ignore: - - 'packaging/**' - - 'docs/**' + # pull_request: + # branches: + # - 'main' + # - '3.0' + # - '3.1' + # paths-ignore: + # - 'packaging/**' + # - 'docs/**' repository_dispatch: types: [run-tests] @@ -333,7 +333,7 @@ jobs: 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\\2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat" + 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