# Generic monorepo CI caller — path map is always repo-specific; keep this job local. # Pin @v1. Until node-service-ci is tagged live, the node-service job stays in-repo # and uses CICD/scripts/start-job-sidecars.sh (Docker socket required). name: CI on: push: branches: [main, master] paths: - "backend/**" - "web/**" - "api-service/**" - ".gitea/workflows/**" pull_request: branches: [main, master] paths: - "backend/**" - "web/**" - "api-service/**" - ".gitea/workflows/**" 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 }} api_service: ${{ steps.filter.outputs.api_service }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Detect changed stacks id: filter run: | set -euo pipefail if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then BASE="origin/${GITHUB_BASE_REF}" git fetch --no-tags --depth=1 origin "${GITHUB_BASE_REF}" 2>/dev/null \ || git fetch --no-tags origin "${GITHUB_BASE_REF}" RANGE="${BASE}...HEAD" elif [ -n "${GITHUB_EVENT_BEFORE:-}" ] \ && [ "${GITHUB_EVENT_BEFORE}" != "0000000000000000000000000000000000000000" ]; then RANGE="${GITHUB_EVENT_BEFORE}...HEAD" else RANGE="HEAD~1...HEAD" fi changed="$(git diff --name-only ${RANGE} 2>/dev/null || git diff --name-only HEAD)" backend=false; frontend=false; api_service=false if echo "${changed}" | grep -qE '^\.gitea/workflows/'; then backend=true; frontend=true; api_service=true else echo "${changed}" | grep -qE '^backend/' && backend=true || true echo "${changed}" | grep -qE '^web/' && frontend=true || true echo "${changed}" | grep -qE '^api-service/' && api_service=true || true fi { echo "backend=${backend}" echo "frontend=${frontend}" echo "api_service=${api_service}" } >> "$GITHUB_OUTPUT" backend: needs: changes if: needs.changes.outputs.backend == 'true' uses: infra/ci-workflows/.gitea/workflows/dotnet8-ci.yml@v1 with: working_directory: backend solution: MyApp.sln postgres_db: myapp_test test_projects: | tests/MyApp.IntegrationTests/MyApp.IntegrationTests.csproj frontend: needs: changes if: needs.changes.outputs.frontend == 'true' uses: infra/ci-workflows/.gitea/workflows/node-ci.yml@v1 with: working_directory: web node_version: "22" lint_command: npm run lint && npm run typecheck build_command: npx vite build # Prefer uses: infra/ci-workflows/.../node-service-ci.yml@v1 once tagged. # Until then: local job + start-job-sidecars.sh (do NOT use RabbitMQ as services:). api-service: needs: changes if: needs.changes.outputs.api_service == 'true' runs-on: ubuntu-latest steps: - uses: builtin:checkout - name: Setup Node uses: actions/setup-node@v4 with: node-version: "20" cache: npm cache-dependency-path: api-service/package-lock.json - name: Start sidecars run: bash CICD/scripts/start-job-sidecars.sh # Or: bash CICD/scripts/start-job-sidecars.sh if you copied the kit to ./CICD - name: Install / migrate / test working-directory: api-service run: | npm ci npm run migrate npm test -- --runInBand --forceExit - name: Stop sidecars if: always() run: | docker rm -f "${CI_PG_NAME:-}" "${CI_RMQ_NAME:-}" "${CI_REDIS_NAME:-}" 2>/dev/null || true