Skip to content

Commit

Permalink
ci: test ninja2 sharebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
chanfun-ren committed Nov 4, 2024
1 parent 7ace97a commit 50775fd
Showing 1 changed file with 102 additions and 5 deletions.
107 changes: 102 additions & 5 deletions .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
# 1. 检出代码
Expand Down Expand Up @@ -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.
## 分布式构建 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 <<EOF | sudo tee /etc/scheduler/config.yaml > /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 <<EOF | sudo tee /etc/executor/config.yaml > /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 ../)"

0 comments on commit 50775fd

Please sign in to comment.