mirror of
https://github.com/snowy-yang/qqbotsdk.git
synced 2026-10-21 12:24:49 +00:00
probe: runner 环境盘点(python3/pip/uv/git/npx 在场 + clone/装 uv 实测)
This commit is contained in:
1 parent
98ed680c73
commit
b3edd79674
1 file changed
+34
-13
+34
-13
@@ -1,21 +1,20 @@
|
||||
name: 网络探测
|
||||
|
||||
# 探测 runner 主机对各关键站点的出网连通性,结果写入 commit status
|
||||
# (公开仓库匿名可读:GET /repos/{owner}/{repo}/commits/{sha}/status)。
|
||||
# runner 环境盘点:出网连通性 + 基础工具链 + clone/装 uv 迷你实测,
|
||||
# 结果写入 commit status(公开仓库匿名可读)。
|
||||
# 改动本文件推送即触发。
|
||||
|
||||
on:
|
||||
push:
|
||||
paths: ['.gitea/workflows/probe.yml']
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
probe:
|
||||
name: runner 出网探测
|
||||
name: runner 环境探测
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 探测连通性并写入 commit status
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
- name: 工具链与连通性探测
|
||||
run: |
|
||||
SERVER="${GITHUB_SERVER_URL:-https://gitea.4i.hk}"
|
||||
post() {
|
||||
@@ -26,11 +25,33 @@ jobs:
|
||||
"$SERVER/api/v1/repos/$GITHUB_REPOSITORY/statuses/$GITHUB_SHA" \
|
||||
-o /dev/null -w "probe/$1 = $2 (HTTP %{http_code})\n"
|
||||
}
|
||||
inv() { command -v "$1" >/dev/null 2>&1 && echo yes || echo no; }
|
||||
code() { curl -s -m 8 -o /dev/null -w '%{http_code}' -L "$1"; }
|
||||
post github "$(code https://github.com)" success
|
||||
post uv-release "$(code https://github.com/astral-sh/uv/releases/latest)" success
|
||||
post pypi "$(code https://pypi.org/simple/)" success
|
||||
post tuna "$(code https://pypi.tuna.tsinghua.edu.cn/simple/)" success
|
||||
post npm "$(code https://registry.npmjs.org)" success
|
||||
post npmmirror "$(code https://registry.npmmirror.com)" success
|
||||
post cf-api "$(code https://api.cloudflare.com/client/v4)" success
|
||||
|
||||
post python3 "$(python3 -V 2>/dev/null || echo absent)"
|
||||
post pip "$(inv pip)"
|
||||
post pip3 "$(inv pip3)"
|
||||
post uv "$(inv uv)"
|
||||
post git "$(inv git)"
|
||||
post npx "$(inv npx)"
|
||||
post pypi "$(code https://pypi.org/simple/)"
|
||||
post npmmirror "$(code https://registry.npmmirror.com)"
|
||||
|
||||
rm -rf /tmp/src
|
||||
if git clone --depth=1 "$SERVER/$GITHUB_REPOSITORY.git" /tmp/src >/dev/null 2>&1; then
|
||||
post clone ok
|
||||
else
|
||||
post clone fail
|
||||
fi
|
||||
|
||||
if cd /tmp/src 2>/dev/null \
|
||||
&& { pip install uv >/dev/null 2>&1 \
|
||||
|| pip3 install uv >/dev/null 2>&1 \
|
||||
|| python3 -m pip install uv >/dev/null 2>&1; }; then
|
||||
post pip-install-uv ok
|
||||
else
|
||||
post pip-install-uv fail
|
||||
fi
|
||||
|
||||
UV_BIN="$(command -v uv || echo "$HOME/.local/bin/uv")"
|
||||
post uv-version "$("$UV_BIN" --version 2>/dev/null || echo none)"
|
||||
Reference in new issue
Block a user