Carry a value in and out of a stream field the way the catalog states #1348
Workflow file for this run
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
| # This workflow computes the clang-tidy check for the git diff between base and head. | |
| # we generate GitHub PR annotations based on the output of clang-tidy if this workflow was called within the context | |
| # of a pr. | |
| name: Clang-Tidy-Diff | |
| on: | |
| workflow_call: | |
| inputs: | |
| dev_image_tag: | |
| required: true | |
| type: string | |
| description: "Docker image tag of the development image" | |
| head_sha: | |
| type: string | |
| required: true | |
| description: "commit sha of head" | |
| base_sha: | |
| type: string | |
| required: true | |
| description: "commit sha of base" | |
| number_of_commits: | |
| type: number | |
| required: false | |
| default: -1 | |
| # We need to use pull_request to run this workflow starting from our base repo and pull_request_target to run this | |
| # workflow in our base repo (but starting from a fork), as clang-tidy-pr-comments needs 'write' permissions to our repo. This is solely possible | |
| # with pull_request_target as pull_request provides 'read' permissions. | |
| pull_request: | |
| types: [ opened, synchronize, reopened ] | |
| pull_request_target: | |
| types: [ opened, synchronize, reopened ] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| checks: write | |
| jobs: | |
| get-dev-images: | |
| uses: ./.github/workflows/get_dev_images.yml | |
| secrets: inherit | |
| with: | |
| branch-name: ${{ github.head_ref }} | |
| head_sha: ${{ github.event.pull_request.head.sha }} | |
| setup: | |
| needs: [get-dev-images] | |
| name: Setup inputs | |
| runs-on: ubuntu-latest | |
| outputs: | |
| dev_image_tag: ${{ steps.set_vars.outputs.dev_image_tag }} | |
| head_sha: ${{ steps.set_vars.outputs.head_sha }} | |
| base_sha: ${{ steps.set_vars.outputs.base_sha }} | |
| number_of_commits: ${{ steps.set_vars.outputs.number_of_commits }} | |
| steps: | |
| - name: Set workflow inputs | |
| id: set_vars | |
| run: | | |
| # If this workflow is called via workflow_call, we want to use the inputs. | |
| # Otherwise, we want to use "default" values | |
| if [[ "${{ github.event_name }}" == "pull_request" || "${{ github.event_name }}" == "pull_request_target" ]]; then | |
| echo "Running in PR context" | |
| echo "dev_image_tag=${{ needs.get-dev-images.outputs.image-tag }}" >> $GITHUB_OUTPUT | |
| echo "head_sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT | |
| echo "base_sha=${{ github.event.pull_request.base.sha }}" >> $GITHUB_OUTPUT | |
| echo "number_of_commits=${{ github.event.pull_request.commits || -1 }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "Running in workflow_call or non-PR context" | |
| echo "dev_image_tag=${{ inputs.dev_image_tag }}" >> $GITHUB_OUTPUT | |
| echo "head_sha=${{ inputs.head_sha || github.sha }}" >> $GITHUB_OUTPUT | |
| echo "base_sha=${{ inputs.base_sha || github.event.before || github.sha }}" >> $GITHUB_OUTPUT | |
| echo "number_of_commits=${{ inputs.number_of_commits || -1 }}" >> $GITHUB_OUTPUT | |
| fi | |
| check-clang-tidy: | |
| timeout-minutes: 90 | |
| name: Clang-Tidy Diff | |
| needs: [setup, get-dev-images] | |
| # Due to limited ARM server capacity we only run on x64 | |
| runs-on: [ self-hosted, linux, Build, x64] | |
| if: > | |
| (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.fork == true) || | |
| (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) | |
| container: | |
| image: nebulastream/nes-ci:${{ needs.setup.outputs.dev_image_tag }} | |
| options: --user root | |
| volumes: | |
| - ccache:/ccache | |
| env: | |
| CCACHE_DIR: /ccache | |
| MOLD_JOBS: 1 | |
| GH_TOKEN: ${{ github.token }} | |
| steps: | |
| - name: Include base commit | |
| id: increment | |
| run: echo "result=$((${{ needs.setup.outputs.number_of_commits }} + 1))" >> $GITHUB_OUTPUT | |
| - name: Checkout Branch | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: ${{ steps.increment.outputs.result }} | |
| ref: ${{ needs.setup.outputs.head_sha }} | |
| - name: Configure NebulaStream for Clang-Tidy | |
| run: cmake -GNinja -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON | |
| # We need to build the project, as some headers are only created during the build. | |
| - name: Build NebulaStream | |
| run: cmake --build build -j -- -k 0 | |
| - name: Create results directory | |
| run: mkdir clang-tidy-result | |
| - name: Clang-Tidy Precheck | |
| # quickly check for compile errors | |
| run: git diff -U0 ${{ needs.setup.outputs.base_sha }} -- ':!*.inc' | clang-tidy-diff-19.py -clang-tidy-binary clang-tidy-19 -p1 -path build -export-fixes clang-tidy-result/fixes.yml -checks='-*,readability-duplicate-include' -j $(nproc) | |
| - name: Analyze by running Clang-Tidy | |
| run: git diff -U0 ${{ needs.setup.outputs.base_sha }} -- ':!*.inc' | clang-tidy-diff-19.py -clang-tidy-binary clang-tidy-19 -p1 -path build -export-fixes clang-tidy-result/fixes.yml -j $(nproc) | |
| - name: Upload Clang-Tidy Results | |
| if: ${{ !cancelled() && !github.event.act }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| if-no-files-found: warn | |
| name: clang-tidy-result | |
| path: clang-tidy-result | |
| - name: Run clang-tidy-pr-comments action | |
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | |
| # requires python3-venv | |
| uses: platisd/clang-tidy-pr-comments@v1 | |
| with: | |
| github_token: ${{ github.token }} | |
| clang_tidy_fixes: clang-tidy-result/fixes.yml | |
| request_changes: false | |
| # Optionally set the number of comments per review to avoid GitHub API timeouts for heavily loaded pull requests | |
| suggestions_per_comment: 100 | |
| auto_resolve_conversations: true | |
| # As we are running it in a docker, we need to set the repo path prefix to /__w | |
| # This is mentioned in https://github.com/platisd/clang-tidy-pr-comments/blob/master/action.yml | |
| repo_path_prefix: /__w | |
| python_path: /usr/bin/python3 |