Skip to content

Commit 6124c0d

Browse files
committed
feat: enhance CI/CD pipeline with architecture info and update README documentation
1 parent 37d73cc commit 6124c0d

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

.github/workflows/cd.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ jobs:
4747
- name: Install dependencies
4848
run: sudo apt-get update && sudo apt-get install -y cmake gcc
4949

50+
- name: Get architecture info
51+
id: arch
52+
run: |
53+
echo "arch=$(uname -m)" >> $GITHUB_OUTPUT
54+
echo "platform=linux" >> $GITHUB_OUTPUT
55+
5056
- name: Configure CMake
5157
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
5258

@@ -63,7 +69,7 @@ jobs:
6369
- name: Upload build artifacts
6470
uses: actions/upload-artifact@v4
6571
with:
66-
name: mjsonrpc-${{ matrix.build_type }}-linux
72+
name: mjsonrpc-${{ matrix.build_type }}-${{ steps.arch.outputs.platform }}-${{ steps.arch.outputs.arch }}
6773
path: dist/${{ matrix.build_type }}/
6874
retention-days: 7
6975

@@ -84,7 +90,7 @@ jobs:
8490
run: |
8591
mkdir -p release
8692
cd artifacts
87-
for dir in mjsonrpc-*-linux; do
93+
for dir in mjsonrpc-*-linux-*; do
8894
tar -czf ../release/${dir}.tar.gz ${dir}/
8995
done
9096
cd ..

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# mjsonrpc - A JSON-RPC 2.0 Message Parser and Generator Based on cJSON
22

3-
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/sfxfs/mjsonrpc/memcheck.yml) ![GitHub License](https://img.shields.io/github/license/sfxfs/mjsonrpc) ![GitHub commit activity](https://img.shields.io/github/commit-activity/t/sfxfs/mjsonrpc) ![GitHub top language](https://img.shields.io/github/languages/top/sfxfs/mjsonrpc) ![GitHub repo size](https://img.shields.io/github/repo-size/sfxfs/mjsonrpc) ![GitHub Downloads (all assets, latest release)](https://img.shields.io/github/downloads/sfxfs/mjsonrpc/latest/total)
3+
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/sfxfs/mjsonrpc/ci.yml) ![GitHub License](https://img.shields.io/github/license/sfxfs/mjsonrpc) ![GitHub commit activity](https://img.shields.io/github/commit-activity/t/sfxfs/mjsonrpc) ![GitHub top language](https://img.shields.io/github/languages/top/sfxfs/mjsonrpc) ![GitHub repo size](https://img.shields.io/github/repo-size/sfxfs/mjsonrpc) ![GitHub Downloads (all assets, latest release)](https://img.shields.io/github/downloads/sfxfs/mjsonrpc/latest/total)
44

55
[ English | [中文](README_CN.md) ]
66

@@ -14,7 +14,7 @@ Simply add the project source files (**mjsonrpc.c**, **mjsonrpc.h**) and the cJS
1414

1515
### Function Definitions
1616

17-
For detailed API descriptions, please refer to **src/mjsonrpc.h**.
17+
For detailed API descriptions, please refer to **src/mjsonrpc.h** and [Doxygen docs of this repo](https://sfxfs.github.io/mjsonrpc).
1818

1919
### Example
2020

README_CN.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# mjsonrpc - 基于 C 语言的 JSON-RPC 2.0 的服务端消息解析器和生成器
22

3+
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/sfxfs/mjsonrpc/ci.yml) ![GitHub License](https://img.shields.io/github/license/sfxfs/mjsonrpc) ![GitHub commit activity](https://img.shields.io/github/commit-activity/t/sfxfs/mjsonrpc) ![GitHub top language](https://img.shields.io/github/languages/top/sfxfs/mjsonrpc) ![GitHub repo size](https://img.shields.io/github/repo-size/sfxfs/mjsonrpc) ![GitHub Downloads (all assets, latest release)](https://img.shields.io/github/downloads/sfxfs/mjsonrpc/latest/total)
4+
35
### 介绍
46

57
本项目轻量,依赖少,可以集成进各种通信方式(TCP、UDP、消息队列等),使用简单(只有少量功能函数),性能好(哈希值计算索引,无需轮询所有方法),并支持批量调用 (JSON Array) 、自动根据请求生成对应错误信息或构造自定义的错误信息,以及通知请求等功能。
68

79
### 如何使用
810

9-
将项目源文件(`mjsonrpc.c``mjsonrpc.h`)和 `cJSON` 库加入自己的工程一同编译即可,也可以自行编译为动态库进行链接
11+
将项目源文件(`mjsonrpc.c``mjsonrpc.h`)和 `cJSON` 库加入自己的工程一同编译即可,也可以自行编译为动态库进行链接或在本仓库 [releases](https://github.com/sfxfs/mjsonrpc/releases) 中下载已经编译好的二进制版本
1012

1113
### 函数定义
1214

13-
详细 API 描述请见 `src/mjsonrpc.h`
15+
详细 API 描述请见 `src/mjsonrpc.h`,或 [本仓库 Doxygen 文档](https://sfxfs.github.io/mjsonrpc)
1416

1517
### 示例
1618

@@ -19,38 +21,38 @@
1921
#include <stdio.h>
2022
#include <stdlib.h>
2123

22-
// Define a simple JSON-RPC method
24+
// 定义一个简单的 JSON-RPC 方法
2325
cJSON *hello_world(mjrpc_func_ctx_t *context, cJSON *params, cJSON *id) {
2426
cJSON *result = cJSON_CreateString("Hello, World!");
2527
return result;
2628
}
2729

2830
int main() {
29-
// Initialize mjrpc_handle_t
31+
// 初始化 mjrpc_handle_t
3032
mjrpc_handle_t* handle = mjrpc_create_handle(0);
3133

32-
// Add a method
34+
// 添加一个方法
3335
mjrpc_add_method(handle, hello_world, "hello", NULL);
3436

35-
// Construct a JSON-RPC request
37+
// 生成 JSON-RPC 请求
3638
const char *json_request = "{\"jsonrpc\":\"2.0\",\"method\":\"hello\",\"id\":1}";
3739

38-
// Process the request
40+
// 处理请求
3941
int result;
4042
char *json_response = mjrpc_process_str(handle, json_request, &result);
4143

42-
// Check return code
44+
// 检查返回值
4345
if (result != MJRPC_RET_OK) {
4446
printf("Error processing request: %d\n", result);
4547
}
4648

47-
// Check response string
49+
// 检查响应字符串
4850
if (json_response) {
4951
printf("Response: %s\n", json_response);
5052
free(json_response);
5153
}
5254

53-
// Cleanup
55+
// 释放句柄
5456
mjrpc_destroy_handle(handle);
5557

5658
return 0;

0 commit comments

Comments
 (0)