Why: The runner cannot reach github.com, so cloning actions/checkout timed out before any test ran. Evidence: mirrors.aliyun.com/golang/go1.27.1.linux-amd64.tar.gz returned HTTP 200. The workflow now fetches GITHUB_SHA with the job token and installs Go from that mirror. Impact: Submodule checkout still requires SUBMODULE_TOKEN. A missing secret fails the job with that message. Refs: feature/agent-stack-r0-r1 Co-authored-by: Cursor <cursoragent@cursor.com>
54 lines
2.1 KiB
YAML
54 lines
2.1 KiB
YAML
name: ci
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
jobs:
|
|
vet-and-test:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GOPROXY: https://goproxy.cn,direct
|
|
steps:
|
|
- name: Checkout
|
|
env:
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SUBMODULE_TOKEN: ${{ secrets.SUBMODULE_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
git init -q
|
|
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
|
git -c http.extraheader="AUTHORIZATION: token ${TOKEN}" fetch --depth=1 origin "${GITHUB_SHA}"
|
|
git checkout -q --detach FETCH_HEAD
|
|
if [ -z "${SUBMODULE_TOKEN}" ]; then
|
|
echo "SUBMODULE_TOKEN is not configured" >&2
|
|
exit 1
|
|
fi
|
|
git config --global url."https://weichen:${SUBMODULE_TOKEN}@git-home.u1680832.nyat.app:30319/".insteadOf "ssh://git@git-ssh.u1680832.nyat.app:31411/"
|
|
git -c fetch.recurseSubmodules=false submodule update --init --recursive
|
|
- name: Install Go 1.27.1
|
|
run: |
|
|
set -euo pipefail
|
|
curl -fsSL -o "$RUNNER_TEMP/go.tgz" https://mirrors.aliyun.com/golang/go1.27.1.linux-amd64.tar.gz
|
|
tar -C /usr/local -xzf "$RUNNER_TEMP/go.tgz"
|
|
ln -sfn /usr/local/go/bin/go /usr/local/bin/go
|
|
ln -sfn /usr/local/go/bin/gofmt /usr/local/bin/gofmt
|
|
- name: Vet, test, and race
|
|
run: GOWORK=off go vet ./... && GOWORK=off go test -count=1 ./... && GOWORK=off go test -count=1 -race ./...
|
|
docker-checkout-hostgateway:
|
|
runs-on: ubuntu-latest
|
|
options: --add-host gitea:host-gateway
|
|
env:
|
|
GITHUB_SERVER_URL: http://gitea:3000
|
|
steps:
|
|
- name: Checkout without GitHub actions
|
|
env:
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
git init -q
|
|
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
|
git -c http.extraheader="AUTHORIZATION: token ${TOKEN}" fetch --depth=1 origin "${GITHUB_SHA}"
|
|
git checkout -q --detach FETCH_HEAD
|
|
test -f go.mod && echo "docker-mode checkout via host-gateway OK"
|