Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ build:arm64-qnx --config=_common
build:arm64-qnx --platforms=@score_bazel_platforms//:aarch64-qnx-sdp_8.0.0-posix
build:arm64-qnx --extra_toolchains=@score_qcc_aarch64_toolchain//:aarch64-qnx-sdp_8.0.0
build:arm64-qnx --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_aarch64_unknown_nto_qnx800

# -------------------------------------------------------------------------------
# Clang-tidy (score_cpp_policies)
# -------------------------------------------------------------------------------
test:clang-tidy --aspects=//tools/lint:linters.bzl%clang_tidy_aspect
test:clang-tidy --output_groups=+rules_lint_report
test:clang-tidy --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux
29 changes: 29 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
Checks: >-
-*,
clang-analyzer-*,
cert-*,
cppcoreguidelines-*,
bugprone-*,
misc-*,
performance-*,
readability-*,
modernize-*

WarningsAsErrors: >-
clang-analyzer-*

HeaderFilterRegex: 'score/test_scenarios_cpp/'

FormatStyle: none
31 changes: 31 additions & 0 deletions .github/workflows/build_scenarios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,34 @@ jobs:
- name: Run tests
run: |
bazel test //... --config=x86_64-linux

clang-tidy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.15.0
with:
bazelisk-version: 1.26.0

- name: Run clang-tidy
run: |
bazel test --config=clang-tidy //score/test_scenarios_cpp:clang_tidy

clippy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.92.0
with:
components: clippy

- name: Run clippy
working-directory: score/test_scenarios_rust
run: |
cargo clippy --locked --all-targets -- -D warnings
2 changes: 2 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
load("@score_tooling//:defs.bzl", "setup_starpls")

exports_files([".clang-tidy"])

setup_starpls(
name = "starpls_server",
visibility = ["//visibility:public"],
Expand Down
27 changes: 23 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module(
bazel_dep(name = "rules_python", version = "1.4.1")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "aspect_rules_lint", version = "1.0.3")
bazel_dep(name = "aspect_rules_lint", version = "2.5.0", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "7.3.1")
bazel_dep(name = "platforms", version = "1.0.0")

Expand All @@ -32,9 +32,12 @@ bazel_dep(name = "score_rust_policies", version = "0.0.5")
# Toolchains and extensions
bazel_dep(name = "rules_rust", version = "0.68.1-score")

bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.5.1", dev_dependency = True)
bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.5.4", dev_dependency = True)
bazel_dep(name = "score_toolchains_rust", version = "0.8.0", dev_dependency = True)

bazel_dep(name = "score_cpp_policies", version = "0.1.1", dev_dependency = True)
bazel_dep(name = "toolchains_llvm", version = "1.8.0", dev_dependency = True)

# Others
gcc = use_extension("@score_bazel_cpp_toolchains//extensions:gcc.bzl", "gcc", dev_dependency = True)
gcc.toolchain(
Expand All @@ -53,15 +56,15 @@ gcc.toolchain(
)
gcc.toolchain(
name = "score_qcc_x86_64_toolchain",
sdp_version = "8.0.0",
sdp_version = "8.0.4",
target_cpu = "x86_64",
target_os = "qnx",
use_default_package = True,
version = "12.2.0",
)
gcc.toolchain(
name = "score_qcc_aarch64_toolchain",
sdp_version = "8.0.0",
sdp_version = "8.0.4",
target_cpu = "aarch64",
target_os = "qnx",
use_default_package = True,
Expand All @@ -75,6 +78,22 @@ use_repo(
"score_qcc_x86_64_toolchain",
)

llvm = use_extension(
"@toolchains_llvm//toolchain/extensions:llvm.bzl",
"llvm",
dev_dependency = True,
)
llvm.toolchain(
cxx_standard = {"": "c++17"},
link_libs = {"": [
"-lrt",
"-latomic",
]},
llvm_version = "22.1.7",
stdlib = {"": "stdc++"},
)
Comment thread
PiotrKorkus marked this conversation as resolved.
use_repo(llvm, "llvm_toolchain")

PYTHON_VERSION = "3.12"

python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)
Expand Down
9 changes: 9 additions & 0 deletions score/test_scenarios_cpp/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# *******************************************************************************
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_test.bzl", "cc_test")
load("//tools/lint:linters.bzl", "clang_tidy_test")

cc_library(
name = "test_scenarios_cpp",
Expand Down Expand Up @@ -52,3 +53,11 @@ cc_test(
"@googletest//:gtest_main",
],
)

clang_tidy_test(
name = "clang_tidy",
srcs = [
":test_scenarios_cpp",
],
tags = ["manual"],
)
17 changes: 17 additions & 0 deletions tools/lint/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

exports_files(
["linters.bzl"],
visibility = ["//visibility:public"],
)
23 changes: 23 additions & 0 deletions tools/lint/linters.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

"""Clang-tidy aspect and test rule, using the score_cpp_policies baseline."""

load("@score_cpp_policies//clang_tidy:defs.bzl", "make_clang_tidy_aspect", "make_clang_tidy_test")

clang_tidy_aspect = make_clang_tidy_aspect(
binary = Label("@llvm_toolchain//:clang-tidy"),
local_configs = [Label("//:.clang-tidy")],
)

clang_tidy_test = make_clang_tidy_test(aspect = clang_tidy_aspect)
Loading