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
1 change: 0 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ build --host_cxxopt='-std=c++23'
# Enable warnings
build --cxxopt='-Wall'
build --cxxopt='-Wextra'
build --cxxopt='-Wpedantic'
build --cxxopt='-Werror'
build --cxxopt='-Wno-unused-parameter'

Expand Down
99 changes: 31 additions & 68 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,60 +22,14 @@ jobs:
with:
clang-format-version: 19

build-and-test-cmake:
name: Build and Test (CMake)
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache CCache
uses: actions/cache@v4
id: ccache
with:
path: ~/.cache/ccache
key: ${{ runner.os }}-ccache-${{ hashFiles('conanfile.py') }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('CMakePresets.json') }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-ccache-${{ hashFiles('conanfile.py') }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('CMakePresets.json') }}-
${{ runner.os }}-ccache-

- name: Setup Conan
uses: hankhsu1996/setup-conan@v1
with:
conan-version: "2.5.0"
cache-dependencies: true
cache-tool: true

- name: Install Clang 19
run: |
sudo apt-get update
sudo apt-get install -y clang-19
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-19 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-19 100
sudo update-alternatives --set clang++ /usr/bin/clang++-19
sudo update-alternatives --set clang /usr/bin/clang-19

- name: Install dependencies
run: |
conan profile detect --force
conan install . --build=missing
conan install . -s build_type=Debug --build=missing

- name: Verify Clang is available
run: clang --version

- name: Configure CMake and build project
run: |
cmake --preset release
cmake --build --preset release

- name: Run tests
run: ctest --preset release

build-and-test-bazel:
name: Build and Test (Bazel)
name: Build and Test (Bazel, ${{ matrix.compiler.name }}-${{ matrix.compiler.version }})
runs-on: ubuntu-latest
strategy:
matrix:
compiler:
- { name: gcc, version: 13, cc: gcc-13, cxx: g++-13 }
- { name: clang, version: 19, cc: clang-19, cxx: clang++-19 }

steps:
- name: Checkout code
Expand All @@ -88,31 +42,40 @@ jobs:
disk-cache: ${{ github.workflow }}
repository-cache: true

- name: Install Clang 19
- name: Install ${{ matrix.compiler.name }}-${{ matrix.compiler.version }}
run: |
sudo apt-get update
sudo apt-get install -y clang-19
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-19 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-19 100
sudo update-alternatives --set clang++ /usr/bin/clang++-19
sudo update-alternatives --set clang /usr/bin/clang-19
sudo apt-get install -y ${{ matrix.compiler.cc }} ${{ matrix.compiler.cxx }}

- name: Verify Clang is available
run: clang --version
- name: Verify compiler is available
run: ${{ matrix.compiler.cxx }} --version

- name: Build with Bazel
run: |
# Build release configuration
bazel build //...
# Build debug configuration
bazel build //... --config=debug
bazel build //... --action_env=CC=${{ matrix.compiler.cc }} --action_env=CXX=${{ matrix.compiler.cxx }}
bazel build //... --config=debug --action_env=CC=${{ matrix.compiler.cc }} --action_env=CXX=${{ matrix.compiler.cxx }}

- name: Test with Bazel
run: |
# Test release configuration
bazel test //... --test_output=all --test_timeout=5
# Test debug configuration
bazel test //... --config=debug --test_output=all --test_timeout=5
bazel test //... --test_output=all --test_timeout=5 --action_env=CC=${{ matrix.compiler.cc }} --action_env=CXX=${{ matrix.compiler.cxx }}
bazel test //... --config=debug --test_output=all --test_timeout=5 --action_env=CC=${{ matrix.compiler.cc }} --action_env=CXX=${{ matrix.compiler.cxx }}

build-and-test-windows:
name: Build and Test (CMake, MSVC)
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Configure CMake
run: cmake -S . -B build -DBUILD_TESTS=ON

- name: Build
run: cmake --build build --config Release

- name: Run tests
run: ctest --test-dir build -C Release -E "PipeTransport|FramedPipeTransport" --output-on-failure

docs:
name: Generate Documentation
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,6 @@ compile_commands.json

# Misc
*.tmp.*

# Local configuration
*.local.md
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
![GitHub Release](https://img.shields.io/github/v/release/hankhsu1996/jsonrpc-cpp-lib)
![GitHub License](https://img.shields.io/github/license/hankhsu1996/jsonrpc-cpp-lib)

Welcome to the **JSON-RPC 2.0 Modern C++ Library**! This library provides a lightweight, modern C++ implementation of [JSON-RPC 2.0](https://www.jsonrpc.org/specification) servers and clients. It is designed to be flexible, allowing integration with various transport layers. This library makes it easy to register methods and notifications, binding them to client logic efficiently.
A lightweight, modern C++ implementation of [JSON-RPC 2.0](https://www.jsonrpc.org/specification) servers and clients. The library is designed to be flexible, allowing integration with various transport layers, and provides straightforward method and notification registration.

## Features

Expand Down Expand Up @@ -49,7 +49,7 @@ CMake offers two main approaches for including this library:

##### A. As a Build-Time Dependency (FetchContent)

This approach downloads and builds the library as part of your project. It's ideal for development workflows where you want everything self-contained:
This approach downloads and builds the library as part of your project, suitable for development workflows where a self-contained build is desired:

```cmake
include(FetchContent)
Expand All @@ -66,7 +66,7 @@ target_link_libraries(your_app PRIVATE jsonrpc::jsonrpc)

##### B. As a System-Wide Installation (find_package)

This approach uses a pre-installed version of the library. It's better for production environments and system-wide installations:
This approach uses a pre-installed version of the library, appropriate for production environments and system-wide installations:

1. First, install the library:

Expand Down Expand Up @@ -318,7 +318,7 @@ In both cases, the `compile_commands.json` file will be placed in the root direc

## Contributing

We welcome contributions! If you have suggestions or find any issues, feel free to open an issue or pull request.
Contributions are welcome. If you have suggestions or find issues, please open an issue or pull request.

## License

Expand Down
1 change: 0 additions & 1 deletion tests/endpoint/dispatcher_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <asio.hpp>
#include <catch2/catch_test_macros.hpp>
#include <fmt/core.h>
#include <nlohmann/json.hpp>
#include <spdlog/spdlog.h>

Expand Down
1 change: 0 additions & 1 deletion tests/endpoint/endpoint_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <asio.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_string.hpp>
#include <fmt/core.h>
#include <nlohmann/json.hpp>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>
Expand Down