From 3cfbb05f18f3d69185c3f7d21d7868c96e2ca80c Mon Sep 17 00:00:00 2001 From: Nikita Nikolaenko <6870920@gmail.com> Date: Wed, 20 Jul 2022 00:08:51 +0200 Subject: [PATCH] Move clang-tidy steps into build_and_test.yml --- .github/workflows/build_and_test.yml | 24 +++++ .github/workflows/clang_tidy_check.yml | 122 ------------------------- BUILD.bazel | 2 +- 3 files changed, 25 insertions(+), 123 deletions(-) delete mode 100644 .github/workflows/clang_tidy_check.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index d81f6e418..607b88921 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -43,6 +43,9 @@ jobs: bazel-command: "dazel" bazel-config: "--config=asan" output-user_root: "" + eventuals-tidy-regex: | + "eventuals[\\\/]eventuals[\\\/]eventuals[\\\/][^.]+.(cc|h)" \ + "eventuals[\\\/]eventuals[\\\/]test[\\\/][^.]+.(cc|h)" - os: windows-2019 sudo-command: "" # The Windows runner already runs as root. # Explicitly not using `dazel` here as we don't want to @@ -51,6 +54,9 @@ jobs: bazel-config: "" # Fixes issue #248. output-user_root: "--output_user_root=C:/bzl" + eventuals-tidy-regex: | + "eventuals[\\\/]eventuals[\\\/]eventuals[\\\/][^.]+.(cc|h)" \ + "eventuals[\\\/]eventuals[\\\/]test[\\\/][^.]+.(cc|h)" # Don't fail all workflows if one fails as we're still getting # to a stable build right now and when one fails it doesn't mean # they all will fail. @@ -136,6 +142,24 @@ jobs: --test_arg=--gtest_shuffle \ --test_arg=--gtest_repeat=100 + - name: Extract Compile Commands + run: | + ${{ matrix.bazel-command }} \ + run \ + refresh_cc_github_actions \ + -- \ + ${{ matrix.output-user_root }} \ + ${{ matrix.bazel-config }} \ + ${{ env.BAZEL_REMOTE_CACHE }} \ + --verbose_failures \ + --compilation_mode=dbg \ + --strip="never" + + - name: Run clang-tidy + run: | + run-clang-tidy \ + ${{ matrix.eventuals-tidy-regex }} + - name: Debug using tmate (if failure) uses: mxschmitt/action-tmate@v3 # Optionally enable tmate debugging if the workflow was manually-triggered diff --git a/.github/workflows/clang_tidy_check.yml b/.github/workflows/clang_tidy_check.yml deleted file mode 100644 index 0e0eeedb6..000000000 --- a/.github/workflows/clang_tidy_check.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: Clang Tidy Check - -# We use action's triggers 'push' and 'pull_request'. -# The strategy is the following: this action will be -# triggered on any push to 'main' branch and any pull -# request to any branch. Thus we avoid duplicate work- -# flows. -on: - push: - branches: - - "main" - pull_request: - branches: - - "**" - workflow_dispatch: - inputs: - # Live debug failures using tmate by toggling input parameter - # 'debug_enabled': - # https://github.com/mxschmitt/action-tmate#manually-triggered-debug - # When manually running this workflow: - # https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow - debug_enabled: - description: 'Enable tmate debugging' - type: boolean - default: true - -jobs: - clang-tidy-check: - runs-on: ${{ matrix.os }} - strategy: - matrix: - include: - #- os: macos-latest - # sudo-command: "sudo" - # # Explicitly not using `dazel` here as we don't want to - # # build/test on Linux but on macOS! - # bazel-command: "bazelisk" - # bazel-config: "" - # output-user_root: "" - - os: ubuntu-latest - sudo-command: "sudo" - bazel-command: "dazel" - bazel-config: "--config=asan" - output-user_root: "" - eventuals-regex: | - "eventuals[\\\/]eventuals[\\\/]eventuals[\\\/][^.]+.(cc|h)" \ - "eventuals[\\\/]eventuals[\\\/]test[\\\/][^.]+.(cc|h)" - - os: windows-2019 - sudo-command: "" # The Windows runner already runs as root. - # Explicitly not using `dazel` here as we don't want to - # build/test on Linux but on Windows! - bazel-command: "bazelisk" - bazel-config: "" - # Fixes issue #248. - output-user_root: "--output_user_root=C:/bzl" - eventuals-regex: | - "eventuals[\\\/]eventuals[\\\/]eventuals[\\\/][^.]+.(cc|h)" \ - "eventuals[\\\/]eventuals[\\\/]test[\\\/][^.]+.(cc|h)" - - defaults: - run: - shell: bash - - steps: - # We should checkout the repo with submodules - # cause we need to have symlink to - # dev-tools/.clang-format file for all code - # style checks. - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - # Install 'wheel' for Python on Windows as required for running - # commands like 'python setup.py bdist_wheel'. - - name: Install Python 'wheel' - if: ${{ matrix.os == 'windows-2019' }} - run: ${{ matrix.sudo-command }} pip3 install wheel - - # Install Dazel for use on Linux so that we use the same build - # tooling in our Actions as we do on our workstations. - - name: Install Dazel - if: ${{ matrix.bazel-command == 'dazel' }} - run: ${{ matrix.sudo-command }} pip3 install dazel - - # Invoke 'dazel version' in order to build the Docker container - # as a separate step so we can track how long it takes and - # optimize as necessary. - - name: Dazel Docker Build - if: ${{ matrix.bazel-command == 'dazel' }} - run: dazel version - - # We have to build everything first to correctly extract - # compile commands later. - - name: Build - run: | - ${{ matrix.bazel-command }} \ - ${{ matrix.output-user_root }} \ - build \ - ${{ matrix.bazel-config }} \ - ${{ env.BAZEL_REMOTE_CACHE }} \ - --verbose_failures \ - -c dbg \ - --strip="never" \ - ... - - - name: Extract Compile Commands - run: | - ${{ matrix.bazel-command }} \ - ${{ matrix.output-user_root }} \ - run \ - refresh_cc_github_actions \ - -- \ - ${{ matrix.bazel-config }} \ - ${{ env.BAZEL_REMOTE_CACHE }} \ - --verbose_failures \ - --compilation_mode=dbg \ - --strip="never" \ - - - name: Run clang-tidy - run: | - run-clang-tidy \ - ${{ matrix.eventuals-regex }} diff --git a/BUILD.bazel b/BUILD.bazel index 794280a79..1d7a6c5c0 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -23,7 +23,7 @@ refresh_compile_commands( refresh_compile_commands( name = "refresh_cc_github_actions", targets = { - "//test:eventuals": "", + "//...": "", }, )