fix(ci): GOPROXY 与 npm 镜像源修复两条流水线的依赖下载失败
server-deploy 在 Install dependencies 失败、web-deploy 在 Install pnpm 失败——亚洲 runner 直连 proxy.golang.org / registry.npmjs.org 不稳定。 Go 侧加 goproxy.cn 优先回落官方源;pnpm 安装与前端依赖安装走 registry.npmmirror.com。 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
69b8907711
commit
7c7880bbd8
@@ -60,6 +60,8 @@ jobs:
|
||||
working-directory: server
|
||||
run: |
|
||||
export HOME="$RUNNER_WORKSPACE"
|
||||
# 国内 runner 优先 goproxy.cn,海外 runner 自动回落官方源
|
||||
export GOPROXY="https://goproxy.cn,https://proxy.golang.org,direct"
|
||||
"$LUNAR_GO" mod download
|
||||
|
||||
- name: Run tests
|
||||
|
||||
@@ -107,18 +107,24 @@ jobs:
|
||||
|
||||
- name: Install pnpm
|
||||
run: |
|
||||
export HOME="$RUNNER_WORKSPACE"
|
||||
# pnpm 随工具链缓存,避免每次重复下载
|
||||
TOOLDIR="$RUNNER_WORKSPACE/.lunar-toolchain"
|
||||
if [ ! -x "$TOOLDIR/pnpm/bin/pnpm" ]; then
|
||||
npm install -g --prefix "$TOOLDIR/pnpm" pnpm@9
|
||||
rm -rf "$TOOLDIR/pnpm"
|
||||
# 亚洲 runner 优先走 npmmirror,失败回落官方源
|
||||
npm install -g --prefix "$TOOLDIR/pnpm" --registry=https://registry.npmmirror.com pnpm@9 \
|
||||
|| npm install -g --prefix "$TOOLDIR/pnpm" --registry=https://registry.npmjs.org pnpm@9
|
||||
fi
|
||||
echo "PATH=$TOOLDIR/pnpm/bin:$PATH" >> "$GITEA_ENV"
|
||||
pnpm --version
|
||||
"$TOOLDIR/pnpm/bin/pnpm" --version
|
||||
|
||||
- name: Run Go tests
|
||||
working-directory: server
|
||||
run: |
|
||||
export HOME="$RUNNER_WORKSPACE"
|
||||
# 国内 runner 优先 goproxy.cn,海外 runner 自动回落官方源
|
||||
export GOPROXY="https://goproxy.cn,https://proxy.golang.org,direct"
|
||||
"$LUNAR_GO" mod download
|
||||
"$LUNAR_GO" test ./...
|
||||
|
||||
@@ -127,6 +133,8 @@ jobs:
|
||||
CI: "true"
|
||||
run: |
|
||||
export HOME="$RUNNER_WORKSPACE"
|
||||
# 用户级 npmrc:pnpm install 依赖下载走镜像源(lockfile 校验不受影响)
|
||||
npm config set registry https://registry.npmmirror.com || true
|
||||
# web/ 工作区:装依赖并构建 @lunar/core(web-commercial 的 file: 依赖)
|
||||
cd web
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
Reference in New Issue
Block a user