在Android手机上运行`github-runner`

Gao

今天突发奇想,在没用到的Android手机上运行github-runner

经过一番实践,成功了

记录步骤:

  1. 安装termux

可以在Google Play Store安装,新版本移动到F-Droid去安装了, 也可以在Github上进行安装: https://github.com/termux/termux-app/releases

  1. 安装Andronix

可以在Google Play Store安装, 也可以直接安装: https://github.com/AndronixApp/AndronixOrigin

我这里直接使用GitHub上的安装脚本安装,修改了一些基本参数方便本地使用, 缺少proot,需要安装proot,pkg install proot

安装好后会在目录下生成start-ubuntu20.sh, 运行即可chroot进入ubuntu系统

  1. 下载Github Action Runner

进入ubuntu系统后,下载并解压缩runner/opt/actions-runner

添加用户actions-runner

useradd -m -d /opt/actions-runner actions-runner

安装依赖

apt install openssh-server openssh-client cd /opt/actions-runner ./bin/installdependencies.sh

根据Github文档配置添加action

./config.sh --url https://github.com/<GROUP> --token <token> ./run
  1. 配置与运行

配置环境变量 在/opt/actions-runner/.env中配置环境变量

LANG=C.UTF-8
http_proxy=http://user:pass@1.2.3.4:5678
https_proxy=http://user:pass@1.2.3.4:5678
no_proxy=gsmlg.org,gsmlg.dev,gsmlg.net,gsmlg.cn

运行:

# 进入termux中执行 nohup ./start-ubuntu20.sh su -c /opt/actions-runner/run.sh - actions-runner > /data/data/com.termux/files/usr/tmp/runner.log 2>&1 &