chore(ci): update CI configuration to use local development dependencies and improve health checks

This commit is contained in:
2026-08-04 13:56:35 +08:00
parent a517ffc6a7
commit a39a8c1fe5

View File

@@ -8,34 +8,15 @@ on:
jobs:
release-gate:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: tiku
ports: ['5432:5432']
options: >-
--health-cmd "pg_isready -U postgres -d tiku"
--health-interval 5s
--health-timeout 5s
--health-retries 20
redis:
image: redis:7-alpine
ports: ['6379:6379']
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 20
env:
DATABASE_URL: Host=localhost;Port=5432;Database=tiku;Username=postgres;Password=postgres
TIKU_TEST_POSTGRES_ADMIN: Host=localhost;Port=5432;Database=postgres;Username=postgres;Password=postgres;Pooling=false;Timeout=5;Command Timeout=60
REDIS_URL: localhost:6379,abortConnect=false
DATABASE_URL: Host=127.0.0.1;Port=5432;Database=tiku;Username=tiku;Password=tiku_dev
TIKU_TEST_POSTGRES_ADMIN: Host=127.0.0.1;Port=5432;Database=postgres;Username=tiku;Password=tiku_dev;Pooling=false;Timeout=5;Command Timeout=60
REDIS_URL: 127.0.0.1:6379,abortConnect=false
DOTNET_ENVIRONMENT: Development
steps:
- uses: actions/checkout@v4
- name: Start development dependencies
run: docker compose up -d --wait
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
@@ -69,10 +50,22 @@ jobs:
dotnet run --project Tiku.Api --no-build --no-launch-profile --urls http://localhost:5090 > /tmp/tiku-api.log 2>&1 &
api_pid=$!
trap 'kill "$api_pid" 2>/dev/null || true' EXIT
api_ready=false
for attempt in $(seq 1 60); do
curl --fail --silent http://localhost:5090/api/health >/dev/null && break
if curl --fail --silent --show-error http://localhost:5090/api/system/health/ready >/dev/null; then
api_ready=true
break
fi
if ! kill -0 "$api_pid" 2>/dev/null; then
cat /tmp/tiku-api.log
exit 1
fi
sleep 1
done
if [ "$api_ready" != true ]; then
cat /tmp/tiku-api.log
exit 1
fi
curl --fail --silent http://localhost:5090/openapi/v1.json >/dev/null
cd Tiku.PlatformAdmin.Web
npm run generate:api
@@ -84,3 +77,6 @@ jobs:
docker build -f Tiku.Worker/Dockerfile -t tiku-worker:ci .
- name: Verify clean diff formatting
run: git diff --check
- name: Stop development dependencies
if: always()
run: docker compose down -v