-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab40b0c
commit 6bdf5e9
Showing
2 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
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[\\\/][^.]+.(cc|h)" \ | ||
"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 }} |
This file contains 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