ci(github): 添加 GitHub Actions 工作流

- 在 push/PR 时自动编译和运行测试
- 安装 Ubuntu 依赖:liburing-dev libz-dev libbrotli-dev libssl-dev libnghttp2-dev
- 构建 coco submodule、编译 cocoon、运行单元测试和集成测试
- 可选运行性能基准(wrk)
This commit is contained in:
xfy911 2026-06-06 18:08:17 +08:00
parent 87f89f5722
commit b0ae0f71c8

48
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential cmake \
liburing-dev libz-dev \
libbrotli-dev libssl-dev \
libnghttp2-dev
- name: Build coco
run: |
cd coco
mkdir -p build && cd build
cmake ..
make -j$(nproc)
- name: Build cocoon
run: make
- name: Run unit tests
run: make unit-test
- name: Run integration tests
run: make test
- name: Run benchmark
run: |
# 安装 wrk
sudo apt-get install -y wrk || true
make bench || true