feat: Prism HTTP/SOCKS5 代理网关及管理台
CI / test (push) Successful in 1m24s
CI / docker (push) Failing after 22s

Go 控制面(SQLite + REST API)嵌入 Mihomo 数据面,Vue 3 多语言 Web 管理台。
含订阅/节点/规则/出站/监控/日志、OpenAPI、API Key、Gitea Actions CI 与开源文档;
CI 适配自托管 runner(国内 Go 镜像、act 容器构建、docker.sock 挂载说明)。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-16 12:10:02 +00:00
committed by renjue
commit af5596aea3
161 changed files with 19761 additions and 0 deletions
+132
View File
@@ -0,0 +1,132 @@
# Prism CI:单元测试 + 多架构镜像发布到 Gitea Container Registry
#
# 前置条件:
# 1. 在线 act_runnerruns-on: ubuntu-latest
# 2. 仓库 SecretREGISTRY_TOKENwrite:package 权限的 PAT
#
# 说明:Go/Docker 步骤使用 shell + 国内镜像,避免 actions/setup-go 从 GitHub 下载卡住
name: CI
on:
push:
branches: [main, master]
tags: ['v*']
pull_request:
env:
REGISTRY: git.rc707blog.top
IMAGE_NAME: prism
GOPROXY: https://goproxy.cn,direct
GOSUMDB: sum.golang.google.cn
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
run: |
set -eux
GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}')
ARCH=$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')
TAR="go${GO_VERSION}.linux-${ARCH}.tar.gz"
if command -v go >/dev/null 2>&1 && go version | grep -q "go${GO_VERSION} "; then
go version
else
downloaded=0
for url in \
"https://mirrors.aliyun.com/golang/${TAR}" \
"https://golang.google.cn/dl/${TAR}" \
"https://go.dev/dl/${TAR}"; do
echo "trying ${url}"
if curl -fsSL --connect-timeout 20 --retry 3 --retry-delay 5 --max-time 600 \
"$url" -o /tmp/go.tgz; then
downloaded=1
break
fi
done
if [ "$downloaded" -ne 1 ]; then
echo "failed to download Go ${GO_VERSION}" >&2
exit 1
fi
rm -rf /usr/local/go
tar -C /usr/local -xzf /tmp/go.tgz
fi
echo "/usr/local/go/bin" >> "$GITHUB_PATH"
/usr/local/go/bin/go version
- name: Run tests
run: go test ./...
docker:
runs-on: ubuntu-latest
# 含 Docker CLI;仍须 runner 挂载 /var/run/docker.sock(见 .gitea/act-runner/README.md
container:
image: catthehacker/ubuntu:act-22.04
needs: test
if: gitea.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Docker
run: |
set -eux
if ! command -v docker >/dev/null 2>&1; then
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io
fi
if [ ! -S /var/run/docker.sock ]; then
echo "ERROR: /var/run/docker.sock 未挂载到 job 容器。" >&2
echo "请在 act_runner 宿主机 config.yaml 中配置:" >&2
echo " container.options: -v /var/run/docker.sock:/var/run/docker.sock" >&2
echo " container.valid_volumes: [/var/run/docker.sock]" >&2
echo "然后重启 runner。" >&2
exit 1
fi
docker info
- name: Log in to Gitea Container Registry
run: |
set -eux
echo "${{ secrets.REGISTRY_TOKEN }}" | \
docker login "${{ env.REGISTRY }}" -u "${{ gitea.actor }}" --password-stdin
- name: Build and push
env:
GITEA_SHA: ${{ gitea.sha }}
GITEA_REF: ${{ gitea.ref }}
GITEA_REPOSITORY_OWNER: ${{ gitea.repository_owner }}
run: |
set -eux
image="${REGISTRY}/${GITEA_REPOSITORY_OWNER}/${IMAGE_NAME}"
tags="${image}:sha-${GITEA_SHA:0:7}"
case "${GITEA_REF}" in
refs/heads/main|refs/heads/master)
tags="${tags},${image}:latest"
;;
refs/tags/v*)
tags="${tags},${image}:${GITEA_REF#refs/tags/}"
;;
esac
docker run --privileged --rm tonistiigi/binfmt --install all 2>/dev/null || true
docker buildx create --name prism-builder --use 2>/dev/null || docker buildx use prism-builder
docker buildx inspect --bootstrap
tag_args=()
IFS=',' read -r -a tag_list <<< "$tags"
for t in "${tag_list[@]}"; do
tag_args+=(-t "$t")
done
docker buildx build \
--platform linux/amd64,linux/arm64 \
-f Dockerfile \
"${tag_args[@]}" \
--push \
.