Files
backend/.gitea/workflows/ci.yml
Andriy Oblivantsev 169a486043
CI / test (push) Failing after 4s
Add adaptive checkout strategy for Gitea Actions runners.
Probe multiple internal and external repository URLs, then fetch the target commit from the first reachable endpoint before running tests.

Made-with: Cursor
2026-03-01 11:50:23 +00:00

60 lines
1.6 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout source (adaptive)
run: |
set -euo pipefail
GW="$(ip route | awk '/default/ {print $3; exit}')"
CANDIDATES="
http://gitea:3000/${{ github.repository }}
http://${GW}:3000/${{ github.repository }}
http://host.docker.internal:3000/${{ github.repository }}
https://git.produktor.io/${{ github.repository }}
https://git.produktor.io/${{ github.repository }}.git
"
REPO_URL=""
for URL in ${CANDIDATES}; do
if git -c http.sslVerify=false ls-remote "${URL}" >/dev/null 2>&1; then
REPO_URL="${URL}"
break
fi
done
test -n "${REPO_URL}"
echo "Using repo URL: ${REPO_URL}"
rm -rf .git
git init .
git remote add origin "${REPO_URL}"
git -c http.sslVerify=false fetch --depth=1 origin "${{ github.sha }}"
git checkout --detach FETCH_HEAD
test -f go.mod
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.25.x"
- name: Go tests
run: go test ./...
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Bun install
working-directory: libs/geo-api-client
run: bun install
- name: Bun tests
working-directory: libs/geo-api-client
run: bun test