CI / test (push) Failing after 5s
Probe common bridge gateway addresses to reach the self-hosted Gitea service when container DNS aliases are unavailable in the runner network. Made-with: Cursor
72 lines
2.1 KiB
YAML
72 lines
2.1 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
|
|
CANDIDATES="
|
|
http://gitea:3000/${{ github.repository }}
|
|
http://host.docker.internal:3000/${{ github.repository }}
|
|
http://172.17.0.1:3000/${{ github.repository }}
|
|
http://172.18.0.1:3000/${{ github.repository }}
|
|
http://172.19.0.1:3000/${{ github.repository }}
|
|
http://172.20.0.1:3000/${{ github.repository }}
|
|
https://git.produktor.io/${{ github.repository }}
|
|
https://git.produktor.io/${{ github.repository }}.git
|
|
"
|
|
REPO_URL=""
|
|
for URL in ${CANDIDATES}; do
|
|
echo "Trying ${URL}"
|
|
if git -c http.sslVerify=false ls-remote "${URL}" >/dev/null 2>&1; then
|
|
REPO_URL="${URL}"
|
|
break
|
|
fi
|
|
done
|
|
|
|
if [ -n "${REPO_URL}" ]; then
|
|
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
|
|
else
|
|
echo "No git endpoint reachable, falling back to archive download."
|
|
rm -rf ./*
|
|
curl -k -L "https://git.produktor.io/${{ github.repository }}/archive/main.tar.gz" -o repo.tar.gz
|
|
tar -xzf repo.tar.gz --strip-components=1
|
|
rm -f repo.tar.gz
|
|
fi
|
|
|
|
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
|