diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b3f68f0..c5afb49 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,10 @@ # This workflow runs on Gitea Actions, which is API-compatible with GitHub Actions. # It performs CI on every push to main and every pull request, and automatically # builds and attaches a Linux amd64 release binary when a version tag (v*) is pushed. +# +# Go is installed manually from a Chinese mirror (NJU) instead of using +# actions/setup-go, because the runner is in a region where the official Go +# download endpoint is slow. GOPROXY is set to goproxy.cn for the same reason. name: CI / Release on: @@ -19,11 +23,15 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - cache: true + - name: Install Go (Mirror in China) + run: | + if [ ! -d "/usr/local/go" ]; then + wget https://mirrors.nju.edu.cn/golang/go1.25.5.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf go1.25.5.linux-amd64.tar.gz + rm go1.25.5.linux-amd64.tar.gz + fi + echo "/usr/local/go/bin" >> $GITHUB_PATH + echo "GOPROXY=https://goproxy.cn,direct" >> $GITHUB_ENV - name: Build run: go build ./... @@ -50,11 +58,15 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - cache: true + - name: Install Go (Mirror in China) + run: | + if [ ! -d "/usr/local/go" ]; then + wget https://mirrors.nju.edu.cn/golang/go1.25.5.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf go1.25.5.linux-amd64.tar.gz + rm go1.25.5.linux-amd64.tar.gz + fi + echo "/usr/local/go/bin" >> $GITHUB_PATH + echo "GOPROXY=https://goproxy.cn,direct" >> $GITHUB_ENV - name: Build release binary run: GOOS=linux GOARCH=amd64 go build -o spark-mcp-linux-amd64 ./main.go