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
2 changes: 1 addition & 1 deletion .bazeliskrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
USE_BAZEL_VERSION=7.4.1
USE_BAZEL_VERSION=8.5.1
21 changes: 14 additions & 7 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
build --cxxopt=-std=c++20
build --host_cxxopt=-std=c++20


# Clang-tidy configuration
build:clang-tidy --aspects @bazel_clang_tidy//clang_tidy:clang_tidy.bzl%clang_tidy_aspect
Expand All @@ -8,10 +7,18 @@ build:clang-tidy --@bazel_clang_tidy//:clang_tidy_config=//:clang_tidy_config
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_executable=@llvm_toolchain//:clang-tidy

# Clang-format configuration
build:clang-format --aspects=@bazel_clang_format//:defs.bzl%check_aspect
build:clang-format --output_groups=report
build:clang-format-fix --aspects=@bazel_clang_format//:defs.bzl%fix_aspect
build:clang-format-fix --output_groups=report
build:clang-format-fix --use_action_cache=false
# Setting up clang-format and clang-tidy
build:clang-format-base --output_groups=report
build:clang-format-base --@bazel_clang_format//:config=//:clang-format-config
build:clang-format-base --@bazel_clang_format//:binary=@llvm_toolchain//:clang-format


# Check-only mode
build:clang-format --config=clang-format-base \
--aspects=@bazel_clang_format//:defs.bzl%check_aspect

# Fix mode
build:clang-format-fix --config=clang-format-base \
--aspects=@bazel_clang_format//:defs.bzl%fix_aspect \
--use_action_cache=false

16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v4
Expand All @@ -27,10 +30,11 @@ jobs:
- name: Test
run: bazel test //...

- name: Check Clang Format
if: !cancelled()
run: bazel build //... --config=clang-format

# Only for Linux builds
- name: Check Clang Tidy
if: !cancelled()
if: ${{ runner.os == 'Linux' && !cancelled() }}
run: bazel build //... --config=clang-tidy

- name: Check Clang Format
if: ${{ runner.os == 'Linux' && !cancelled() }}
run: bazel build //... --config=clang-format
6 changes: 4 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ module(
version = "0.0.1",
)

bazel_dep(name = "rules_cc", version = "0.1.0")
bazel_dep(name = "googletest", version = "1.15.2", dev_dependency = True)
bazel_dep(name = "rules_cc", version = "0.2.16")
bazel_dep(name = "cpp-httplib", version = "0.22.0")

bazel_dep(name = "googletest", version = "1.17.0", dev_dependency = True)
bazel_dep(name = "toolchains_llvm", version = "1.6.0", dev_dependency = True)
bazel_dep(name = "bazel_clang_format", version = "0.0.1", dev_dependency = True)
bazel_dep(name = "bazel_clang_tidy", version = "0.0.1", dev_dependency = True)
Expand Down
154 changes: 121 additions & 33 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ cc_library(
name = "rest_api_helper",
srcs = ["hello.cpp"],
hdrs = ["hello.hpp"],
copts = ["-Wall", "-Wextra", "-Wpedantic", "-Werror"],
visibility = ["//visibility:public"],
)

cc_binary(
name = "example_app",
srcs = ["main.cpp"],
copts = ["-Wall", "-Wextra", "-Wpedantic", "-Werror"],
deps = [":rest_api_helper"],
visibility = ["//visibility:private"],
)
1 change: 1 addition & 0 deletions tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cc_test(
srcs = ["hello_test.cpp"],
deps = [
"//src:rest_api_helper",
"@googletest//:gtest",
"@googletest//:gtest_main",
],
)