83 lines
3.2 KiB
YAML
83 lines
3.2 KiB
YAML
name: ci
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
release-gate:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
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
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
cache: npm
|
|
cache-dependency-path: Tiku.PlatformAdmin.Web/package-lock.json
|
|
- name: Restore
|
|
run: dotnet restore TIKU-BACKEND.slnx
|
|
- name: Build
|
|
run: dotnet build TIKU-BACKEND.slnx --no-restore
|
|
- name: Test
|
|
run: dotnet test TIKU-BACKEND.slnx --no-build
|
|
- name: Format
|
|
run: dotnet format TIKU-BACKEND.slnx --verify-no-changes --no-restore
|
|
- name: Verify EF model and migration SQL
|
|
run: |
|
|
dotnet ef migrations has-pending-model-changes --project Tiku.Infrastructure --startup-project Tiku.DbMigrator --no-build
|
|
dotnet ef migrations script --idempotent --project Tiku.Infrastructure --startup-project Tiku.DbMigrator --no-build --output /tmp/tiku-migrations.sql
|
|
test -s /tmp/tiku-migrations.sql
|
|
- name: Migrate development database
|
|
run: dotnet run --project Tiku.DbMigrator --no-build
|
|
- name: Install and check platform frontend
|
|
working-directory: Tiku.PlatformAdmin.Web
|
|
run: |
|
|
npm ci
|
|
npm run check
|
|
- name: Verify generated OpenAPI contract
|
|
run: |
|
|
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
|
|
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
|
|
cd ..
|
|
git diff --exit-code -- Tiku.PlatformAdmin.Web/src/api/platform-operations.generated.ts Tiku.PlatformAdmin.Web/src/api/schema.generated.d.ts
|
|
- name: Build containers
|
|
run: |
|
|
docker build -f Tiku.Api/Dockerfile -t tiku-api:ci .
|
|
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
|