Files
test/.gitea/workflows/go-ci.yaml
T
admin 62d6c3a081
Pure Run Build / build (push) Canceled after 10m52s
test
2026-07-23 15:37:28 +08:00

59 lines
1.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Pure Run Build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 配置国内源并安装工具链
run: |
set -e
# ========== 1. 换 apt 国内源(清华,Ubuntu 22.04 jammy ==========
cp /etc/apt/sources.list /etc/apt/sources.list.bak
cat > /etc/apt/sources.list <<'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
EOF
apt-get update
apt-get install -y golang-go git nodejs npm
# ========== 2. 配置 Go 国内源 ==========
# 七牛 goproxy.cn(国内最快之一)
go env -w GOPROXY=https://goproxy.cn,direct
# 同时关掉校验 sumdb 的境外访问(可选)
go env -w GOSUMDB=sum.golang.org
go env -w GONOSUMCHECK=1
# 如果私有仓库,可加(按需)
# go env -w GOPRIVATE=git.yourdomain.com
# ========== 3. 配置 npm 国内源 ==========
npm config set registry https://registry.npmmirror.com
echo "==> 源配置完成"
go version
node -v
npm -v
- name: 克隆当前仓库
run: |
git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git .
git checkout ${{ gitea.sha }}
- name: 编译 Go 项目
run: |
go mod tidy
go build -o myapp .
- name: 运行测试
run: |
go test ./...
- name: 打印完成
run: echo "构建完成 ✅"
- name: 运行应用程序
run: |
./myapp