Files
vigilcare-records/.gitea/workflows/ci.yml
T
Trent 5a175e3fba
CI / changes (push) Successful in 1m4s
CI / backend (push) Failing after 0s
CI / frontend (push) Failing after 0s
Align CI/CD with shared infra/ci-workflows and drop compose-based CI.
Replace hand-rolled jobs with @v1 callers, capped bake/migrate CD, and remove the docker-compose.ci.yml bridge workaround.
2026-10-06 19:10:58 +08:00

100 lines
3.6 KiB
YAML

# Thin caller — pipelines live in infra/ci-workflows@v1.
# Pin @v1 (never a branch). Path filter + changes job stay local (repo-specific).
#
# Prerequisite: infra/ci-workflows Settings → Actions → collaborative owners
# must list this repo's owner.
name: CI
on:
push:
branches: [main, master]
paths:
- "VigilCareRecordsAPI/**"
- "VigilCareRecordsAPI.Tests/**"
- "vigilcare-records-web/**"
- "VigilCareRecords.sln"
- ".gitea/workflows/**"
pull_request:
branches: [main, master]
paths:
- "VigilCareRecordsAPI/**"
- "VigilCareRecordsAPI.Tests/**"
- "vigilcare-records-web/**"
- "VigilCareRecords.sln"
- ".gitea/workflows/**"
workflow_dispatch:
jobs:
# Stays local: repo-specific path map; needs fetch-depth: 0.
# Keep actions/checkout@v4 here until builtin:checkout is proven with fetch-depth: 0.
changes:
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: filter
name: Detect stack changes
run: |
set -euo pipefail
backend=false
frontend=false
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
backend=true
frontend=true
else
if [ "${{ github.event_name }}" = "pull_request" ]; then
base="${{ github.event.pull_request.base.sha }}"
else
base="${{ github.event.before }}"
fi
if [ -z "${base:-}" ] || [ "$base" = "0000000000000000000000000000000000000000" ]; then
backend=true
frontend=true
else
files="$(git diff --name-only "$base" "${{ github.sha }}")"
printf '%s\n' "$files"
if printf '%s\n' "$files" | grep -qE '^(VigilCareRecordsAPI/|VigilCareRecordsAPI\.Tests/|VigilCareRecords\.sln|\.gitea/workflows/)'; then
backend=true
fi
if printf '%s\n' "$files" | grep -qE '^(vigilcare-records-web/|\.gitea/workflows/)'; then
frontend=true
fi
fi
fi
echo "backend=${backend}" >> "$GITHUB_OUTPUT"
echo "frontend=${frontend}" >> "$GITHUB_OUTPUT"
backend:
needs: changes
if: needs.changes.outputs.backend == 'true'
uses: infra/ci-workflows/.gitea/workflows/dotnet8-ci.yml@v1
with:
working_directory: .
solution: VigilCareRecords.sln
postgres_db: vigilcare_records_test
# Single test project (service-backed). No isolated/InMemory split today.
test_projects: |
VigilCareRecordsAPI.Tests/VigilCareRecordsAPI.Tests.csproj
# ApiFixture reads CONNECTIONSTRINGS__DEFAULTCONNECTION / REDIS__CONNECTIONSTRING
# (not the shared workflow's ConnectionStrings__Postgres / ConnectionStrings__Redis).
test_env: |
CONNECTIONSTRINGS__DEFAULTCONNECTION=Host=postgres;Port=5432;Database=vigilcare_records_test;Username=postgres;Password=postgres;SSL Mode=Disable
REDIS__CONNECTIONSTRING=redis:6379,defaultDatabase=1,allowAdmin=true
frontend:
needs: changes
if: needs.changes.outputs.frontend == 'true'
uses: infra/ci-workflows/.gitea/workflows/node-ci.yml@v1
with:
working_directory: vigilcare-records-web
node_version: "22"
# Typecheck once here; build must not re-run vue-tsc.
lint_command: npm run typecheck
extra_check_command: npm run test:run
build_command: npx vite build