From 50775fda4df187241257cb3cfa3bb1e55a9632ca Mon Sep 17 00:00:00 2001 From: chanfun-ren <2196019485@qq.com> Date: Mon, 4 Nov 2024 14:21:51 +0800 Subject: [PATCH] ci: test ninja2 sharebuild --- .github/workflows/linux-ci.yml | 107 +++++++++++++++++++++++++++++++-- 1 file changed, 102 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index 5117ea0..ff94cd5 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -12,7 +12,7 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: # 1. 检出代码 @@ -93,13 +93,110 @@ jobs: cmake -G Ninja .. ninja - # 11. 运行 re2 测试 + # 12. 运行 re2 测试 - name: Test re2 build run: | cd re2/build ./re2_test # ctest --output-on-failure - # TODO: - # 1. remote build re2 with ninja2. - # 2. more testing projects. \ No newline at end of file + ## 分布式构建 re2 项目 + # 13. 启动 scheduler + - name: start scheduler + run: | + # 设置环境变量 + SCHEDULER_HOST=localhost + REDIS_HOST=localhost + REDIS_PORT=6379 + + # 安装依赖 + # sudo apt-get update + sudo apt-get install -y nfs-kernel-server redis-server + + # 配置并启动 Redis + sudo systemctl enable redis-server + sudo systemctl restart redis-server + + # 创建必要的文件夹 + mkdir -p ~/sharebuild-bin/ + wget https://github.com/chanfun-ren/ninja2/releases/download/ninja2_ci_test/scheduler + chmod +x ./scheduler + cp ./scheduler ~/sharebuild-bin + + # 配置 Scheduler + sudo mkdir -p /etc/scheduler + cat < /dev/null + redis: + host: ${REDIS_HOST} + port: ${REDIS_PORT} + password: '' + db: 0 + taskServer: + port: 8002 + license: + code: ShareBuild1234 + VerifyService: + host: 106.54.183.229 + port: 8004 + EOF + + # 启动 Scheduler + ~/sharebuild-bin/scheduler -config /etc/scheduler/config.yaml & + + # 14. 启动 executor + - name: start executor + run: | + # 环境变量配置 + REDIS_HOST=localhost + REDIS_PORT=6379 + SCHEDULER_HOST=localhost + + mkdir -p ~/sharebuild-bin + wget https://github.com/chanfun-ren/ninja2/releases/download/ninja2_ci_test/executor + chmod +x ./executor + cp ./executor ~/sharebuild-bin + + + # 配置 Executor + sudo mkdir -p /etc/executor + cat < /dev/null + redis: + host: ${REDIS_HOST} + port: ${REDIS_PORT} + password: '' + db: 0 + taskServer: + port: 8003 + user: $(whoami) + schedulerRegisterServer: + host: ${SCHEDULER_HOST} + port: 8002 + EOF + + # 启动 Executor + ~/sharebuild-bin/executor -config /etc/executor/config.yaml & + # 15. ninja2 分布式 sharebuild 模式编译 re2 + - name: sharebuild re2 + run: | + # 环境变量配置 + SCHEDULER_HOST=localhost + + # 安装依赖 + sudo apt-get install -y nfs-kernel-server + + # 配置 NFS + echo "/home *(rw,no_root_squash,anonuid=1000,anongid=1000,insecure,async,no_subtree_check)" | sudo tee -a /etc/exports + sudo exportfs -a + sudo systemctl restart nfs-kernel-server + + # 下载测试项目 re2 + wget https://github.com/google/re2/archive/refs/tags/2021-11-01.tar.gz + tar -zxvf 2021-11-01.tar.gz + mv re2-2021-11-01 re2 + + # 运行分布式测试 + cd re2 + mkdir -p build + cd build + cmake -G Ninja .. + ninja -s ${SCHEDULER_HOST}:8002 -r "$(realpath ../)"