Feat/3.0/TS-7230 #2528
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Enum Check | |
| on: | |
| pull_request: | |
| branches: | |
| - 'main' | |
| - '3.0' | |
| - '3.1' | |
| - '3.3.6' | |
| paths-ignore: | |
| - 'packaging/**' | |
| - 'docs/**' | |
| - 'tools/tdgpt/**' | |
| - 'source/libs/executor/src/forecastoperator.c' | |
| - 'source/libs/executor/src/anomalywindowoperator.c' | |
| - 'source/dnode/mnode/impl/src/mndAnode.c' | |
| - 'include/common/tanalytics.h' | |
| - 'source/common/src/tanalytics.c' | |
| - 'tests/parallel/tdgpt_cases.task' | |
| - 'tests/script/tsim/analytics' | |
| - '**/*.md' | |
| - '.github/workflows/**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name }}- | |
| ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || inputs.specified_target_branch }}- | |
| ${{ github.event_name == 'pull_request' && github.event.pull_request.number || inputs.specified_pr_number }}-TDengine | |
| cancel-in-progress: true | |
| env: | |
| WKC: '/var/lib/jenkins/workspace/TDinternal/community' | |
| jobs: | |
| enum-check: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: [ "3.10" ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install libclang | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y llvm-17-dev libclang-17-dev | |
| python -m pip install --upgrade pip | |
| python -m pip install libclang | |
| - name: Verify clang Python binding | |
| run: | | |
| python -c "from clang import cindex; print('✅ clang.cindex is available.')" | |
| - name: Determine base branch | |
| id: base | |
| run: echo "BASE_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV | |
| - name: Get changed C/H files | |
| id: changed_files | |
| run: | | |
| git fetch origin $BASE_BRANCH --depth=1 | |
| FILES=$(git diff --name-only origin/$BASE_BRANCH...HEAD | grep -E '\.(c|h)$' || true) | |
| echo "Changed files:" | |
| echo "$FILES" | |
| FILES_JSON=$(echo "$FILES" | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| echo "files=$FILES_JSON" >> $GITHUB_OUTPUT | |
| - name: Run enum check | |
| if: steps.changed_files.outputs.files != '[]' | |
| run: | | |
| echo "Running enum check for changed files" | |
| echo "${{ steps.changed_files.outputs.files }}" | |
| python3 .github/scripts/check_enum_append_only.py \ | |
| --base-branch origin/${{ github.event.pull_request.base.ref }} \ | |
| ${{ join(fromJson(steps.changed_files.outputs.files), ' ') }} | |
| - name: Skip enum check | |
| if: steps.changed_files.outputs.files == '[]' | |
| run: echo "No changed C/H files, skipping enum check." |