Skip to content

Commit

Permalink
[eclipse-iceoryx#265] Add clang-format check to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Jul 10, 2024
1 parent 94d6089 commit be4b012
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ iox2_cargo_fmt_and_clippy_template: &IOX2_CARGO_FMT_AND_CLIPPY
- cargo fmt --all -- --check
- cargo clippy -- -D warnings

iox2_clang_format_and_clang_tidy_template: &IOX2_CLANG_FORMAT_AND_CLANG_TIDY
clang_format_and_clang_tidy:
- git ls-files | grep -E "\.(c|cc|cpp|cxx|inl|h|hh|hpp|hxx)$" | xargs clang-format -i -style=file --Werror --dry-run

iox2_common_build_debug_template: &IOX2_COMMON_BUILD_DEBUG
build_script: cargo build --workspace --all-targets

Expand Down Expand Up @@ -148,6 +152,7 @@ preflight_check_task:
- cargo audit
# TODO iox2-#8: add more preflight-checks here
<<: *IOX2_CARGO_FMT_AND_CLIPPY
<<: *IOX2_CLANG_FORMAT_AND_CLANG_TIDY
<<: *IOX2_COMMON_BUILD_DEBUG # only build without tests to not slow down other tasks due to failures in flaky tests
doc_script: cargo doc

Expand Down
27 changes: 26 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Check license header
run: ./internal/scripts/ci_test_spdx_license_header.sh

static-code-analysis:
static-code-analysis-rust:
needs: preflight-check
if: ${{ needs.changes.outputs.source-code == 'true' }}
strategy:
Expand Down Expand Up @@ -72,6 +72,31 @@ jobs:
- name: Build documentation
run: cargo doc

static-code-analysis-cpp:
needs: preflight-check
if: ${{ needs.changes.outputs.source-code == 'true' }}
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: clang-format and clang-tidy versions
run: |
clang-format --version
clang-tidy --version
- name: Run clang-format
run: git ls-files | grep -E "\.(c|cc|cpp|cxx|inl|h|hh|hpp|hxx)$" | xargs clang-format -i -style=file --Werror --dry-run

# just to have a sync point for the C++ and Rust static code analysis
static-code-analysis:
needs: [static-code-analysis-cpp, static-code-analysis-rust]
runs-on: ubuntu-latest
steps:
- name: Static code analysis sync point
run: echo "Nothing to see, move along!"

cargo-nextest:
needs: preflight-check
strategy:
Expand Down

0 comments on commit be4b012

Please sign in to comment.