Pull MinIO from the Gitea-mirrored pgsty image after upstream Hub/Quay removal.
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
# infra — shared CI, staged
|
||||
|
||||
Staging area for the two repositories that hold CI once it stops being per-repo. Nothing here
|
||||
is live yet: these files are reviewed in the monorepo, then pushed to their own repos on
|
||||
`git.vectur45.com`.
|
||||
|
||||
| Repo to create | Holds | From |
|
||||
| --- | --- | --- |
|
||||
| `infra/ci-workflows` | reusable pipelines (`on: workflow_call`) — `dotnet8-ci`, `node-ci`, `node-service-ci` | [`ci-workflows/`](ci-workflows/) |
|
||||
| `infra/ci-actions` | composite actions (capped bake, bundle extract, compose deploy, smoke) | not written yet |
|
||||
|
||||
## Why an org rather than `trent`
|
||||
|
||||
`self:` references and `workflow_call` paths both embed the owner, so moving later means editing
|
||||
every caller. An org is also the right home for the mirrored `ci-ubuntu` package. If you keep
|
||||
`trent`, substitute it everywhere below — but decide once.
|
||||
|
||||
## Creating them
|
||||
|
||||
1. Create the `infra` organisation on `git.vectur45.com`.
|
||||
2. Create `ci-workflows` (private is fine) and push the contents of `ci-workflows/` to it.
|
||||
3. In that repo: **Settings → Actions → General → collaborative owners**, add the owners whose
|
||||
private repos need to read it. Gitea 1.26+ requires this for private reusable workflows.
|
||||
4. Tag it `v1`. Callers pin the tag, never a branch.
|
||||
|
||||
**Currently staged for `v1.1`** (additive — `@v1` callers keep working):
|
||||
`node-ci.yml` gains `post_build_command` with a documented phase order; `node-service-ci.yml`
|
||||
is new. Push and tag `v1.1`, then move callers when they need the new inputs.
|
||||
|
||||
## Referencing
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
backend:
|
||||
uses: infra/ci-workflows/.gitea/workflows/dotnet8-ci.yml@v1
|
||||
with:
|
||||
working_directory: GrowthOS
|
||||
solution: GrowthOS.sln
|
||||
test_projects: |
|
||||
tests/GrowthOS.UnitTests/GrowthOS.UnitTests.csproj
|
||||
tests/GrowthOS.IntegrationTests/GrowthOS.IntegrationTests.csproj
|
||||
tests/GrowthOS.AgentEvals/GrowthOS.AgentEvals.csproj
|
||||
```
|
||||
|
||||
Runner 4.0 also added `uses: self:{owner}/{repo}@{ref}` for **actions** on this instance. Whether
|
||||
that prefix works for reusable **workflows** is unverified — use the plain `owner/repo/path@ref`
|
||||
form above until it is.
|
||||
|
||||
## Gitea-specific constraints these encode
|
||||
|
||||
| Constraint | Why |
|
||||
| --- | --- |
|
||||
| `inputs:` are explicit, never `gitea.event.inputs` | Not propagated into reusable workflows as of Gitea 1.27.2 |
|
||||
| One label in `runs_on` | Multi-label `runs-on: [a, b]` is documented incomplete |
|
||||
| No `jobs.<id>.environment` | Ignored by Gitea — there are no approval gates |
|
||||
| Artifact actions on `@v4`, both ends | v3 and v4 use different backends and do not interoperate |
|
||||
| `builtin:checkout` | Runner 4.0; no Node runtime, no github.com round-trip |
|
||||
| Service containers by name, never published | The runner builds a per-job network with DNS aliases |
|
||||
| `DOTNET_PROCESSOR_COUNT=1` on every test step | 2 vCPU shared with Gitea; uncapped testhost crashes service Postgres |
|
||||
|
||||
Source of truth for all of these: [`../platform/observed-state.md`](../platform/observed-state.md).
|
||||
|
||||
## What stays in the caller
|
||||
|
||||
A reusable workflow cannot accept injected steps, so anything repo-specific arrives as an input
|
||||
(`pre_build_command`, `test_env`, `extra_check_command`) or stays in the caller as its own job.
|
||||
GrowthOS's change-detection job is the latter: it needs `fetch-depth: 0` and a repo-specific path
|
||||
map, so it remains in `.gitea/workflows/ci.yml`.
|
||||
|
||||
## Next
|
||||
|
||||
1. Push `ci-workflows`, tag `v1`.
|
||||
2. Convert GrowthOS's `backend` and `frontend` jobs to callers; confirm green.
|
||||
3. Extract the CD composite actions into `ci-actions` — the capped bake, the `docker create` /
|
||||
`docker cp` bundle extract, the compose deploy, the smoke test.
|
||||
4. **Onboard a second project.** That is the step that proves the inputs are sufficient; design
|
||||
alone will not.
|
||||
@@ -0,0 +1,207 @@
|
||||
# Reusable .NET 8 CI pipeline for this Gitea instance.
|
||||
#
|
||||
# Every constraint below is measured, not assumed — see the source of truth at
|
||||
# CICD/platform/observed-state.md in the marketing monorepo:
|
||||
# * service containers are reached BY NAME on the runner's per-job network;
|
||||
# never publish 5432/6379, the runner host already uses them
|
||||
# * the host is 2 vCPU / 8 GB shared with Gitea, so every `dotnet test` caps
|
||||
# testhost to one core or the service Postgres crashes (57P03)
|
||||
# * artifact actions are @v4 (both ends together — v3 and v4 do not interoperate)
|
||||
# * `builtin:checkout` needs no Node runtime and no github.com round-trip
|
||||
#
|
||||
# Callers that still use Testcontainers (especially RabbitMQ) leave this workflow's
|
||||
# Postgres/Redis services idle — extend this workflow with inputs rather than forking.
|
||||
# RabbitMQ cannot be a workflow `services:` entry on this fleet at all; see
|
||||
# node-service-ci.yml and observed-state.md.
|
||||
#
|
||||
# Caller:
|
||||
# jobs:
|
||||
# backend:
|
||||
# uses: infra/ci-workflows/.gitea/workflows/dotnet8-ci.yml@v1
|
||||
# with:
|
||||
# working_directory: GrowthOS
|
||||
# solution: GrowthOS.sln
|
||||
# test_projects: |
|
||||
# tests/Foo.UnitTests/Foo.UnitTests.csproj
|
||||
# tests/Foo.IntegrationTests/Foo.IntegrationTests.csproj
|
||||
name: dotnet8-ci
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
runs_on:
|
||||
description: "Runner label. One label only — multi-label runs-on is unreliable."
|
||||
type: string
|
||||
default: ubuntu-latest
|
||||
working_directory:
|
||||
description: "Directory holding the solution, relative to the repo root."
|
||||
type: string
|
||||
default: "."
|
||||
solution:
|
||||
description: "Solution file, relative to working_directory."
|
||||
type: string
|
||||
required: true
|
||||
dotnet_version:
|
||||
type: string
|
||||
default: "8.0.x"
|
||||
cache_dependency_path:
|
||||
description: "Glob for setup-dotnet's NuGet cache key."
|
||||
type: string
|
||||
default: "**/*.csproj"
|
||||
postgres_image:
|
||||
type: string
|
||||
default: "postgres:16"
|
||||
postgres_db:
|
||||
type: string
|
||||
default: "app_test"
|
||||
redis_image:
|
||||
type: string
|
||||
default: "redis:7"
|
||||
pre_build_command:
|
||||
description: "Optional shell run at the REPO ROOT before restore (schema checks, codegen)."
|
||||
type: string
|
||||
default: ""
|
||||
isolated_test_projects:
|
||||
description: |
|
||||
Test projects that must NOT see the service database — typically unit tests on an
|
||||
in-memory provider. Run first, with ConnectionStrings__* blanked, because a context
|
||||
factory (or a stray UseNpgsql) will otherwise connect to the live Postgres and retry
|
||||
until it thrashes the runner. One .csproj path per line.
|
||||
type: string
|
||||
default: ""
|
||||
test_projects:
|
||||
description: "Test projects that DO use the service containers. One .csproj path per line."
|
||||
type: string
|
||||
required: true
|
||||
test_env:
|
||||
description: "Optional extra KEY=VALUE lines exported for every test step."
|
||||
type: string
|
||||
default: ""
|
||||
blame_hang_timeout:
|
||||
description: "Kill testhost if a test stops completing."
|
||||
type: string
|
||||
default: "2m"
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ${{ inputs.runs_on }}
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ inputs.working_directory }}
|
||||
services:
|
||||
postgres:
|
||||
image: ${{ inputs.postgres_image }}
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: ${{ inputs.postgres_db }}
|
||||
# --shm-size is NOT stripped by the runner (verified on Runner 4.0).
|
||||
# pg_isready can pass while Postgres is still in crash recovery, so the
|
||||
# start-period is generous and tests must wait for queries, not health.
|
||||
options: >-
|
||||
--shm-size=256mb
|
||||
--health-cmd "pg_isready -U postgres -d ${{ inputs.postgres_db }}"
|
||||
--health-interval 2s
|
||||
--health-timeout 5s
|
||||
--health-retries 30
|
||||
--health-start-period=20s
|
||||
redis:
|
||||
image: ${{ inputs.redis_image }}
|
||||
options: >-
|
||||
--health-cmd "redis-cli ping"
|
||||
--health-interval 5s
|
||||
--health-timeout 3s
|
||||
--health-retries 10
|
||||
env:
|
||||
ASPNETCORE_ENVIRONMENT: Testing
|
||||
ConnectionStrings__Postgres: "Host=postgres;Port=5432;Database=${{ inputs.postgres_db }};Username=postgres;Password=postgres;SSL Mode=Disable"
|
||||
ConnectionStrings__Redis: "redis:6379"
|
||||
# GITEA_TOKEN is injected into every job and job containers CAN reach this
|
||||
# Gitea. Product code holding the token will make live API calls from CI
|
||||
# unless it is blanked. Tests are fixtures, not writes.
|
||||
GITEA_TOKEN: ""
|
||||
steps:
|
||||
- uses: builtin:checkout
|
||||
|
||||
- name: Pre-build checks
|
||||
if: inputs.pre_build_command != ''
|
||||
working-directory: .
|
||||
run: ${{ inputs.pre_build_command }}
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: ${{ inputs.dotnet_version }}
|
||||
cache: true
|
||||
cache-dependency-path: ${{ inputs.working_directory }}/${{ inputs.cache_dependency_path }}
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore ${{ inputs.solution }}
|
||||
|
||||
- name: Build
|
||||
run: dotnet build ${{ inputs.solution }} -c Release --no-restore
|
||||
|
||||
# Two steps, not one, because the connection strings differ. Both loop rather
|
||||
# than becoming separate jobs: extra jobs queue at capacity 1 rather than
|
||||
# running in parallel, and --no-build means the cost is the test run itself.
|
||||
- name: Test (isolated — no service database)
|
||||
if: inputs.isolated_test_projects != ''
|
||||
env:
|
||||
ConnectionStrings__Postgres: ""
|
||||
ConnectionStrings__Redis: ""
|
||||
DOTNET_PROCESSOR_COUNT: "1"
|
||||
DOTNET_gcServer: "0"
|
||||
DOTNET_GCHeapCount: "1"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
while IFS= read -r line; do
|
||||
[ -n "$line" ] || continue
|
||||
export "${line?}"
|
||||
done <<< "${{ inputs.test_env }}"
|
||||
|
||||
while IFS= read -r proj; do
|
||||
[ -n "$proj" ] || continue
|
||||
name="$(basename "$proj" .csproj)"
|
||||
echo "::group::$name"
|
||||
dotnet test "$proj" -c Release --no-build \
|
||||
--filter "Category!=Live" \
|
||||
--blame-hang-timeout ${{ inputs.blame_hang_timeout }} \
|
||||
--logger "trx;LogFileName=${name}.trx" \
|
||||
--results-directory ./TestResults \
|
||||
-- xUnit.MaxParallelThreads=1
|
||||
echo "::endgroup::"
|
||||
done <<< "${{ inputs.isolated_test_projects }}"
|
||||
|
||||
- name: Test (against the service containers)
|
||||
env:
|
||||
# 2 vCPU shared with Gitea. Uncapped testhost takes both cores, the
|
||||
# service Postgres container dies, and later tests fail with 57P03.
|
||||
DOTNET_PROCESSOR_COUNT: "1"
|
||||
DOTNET_gcServer: "0"
|
||||
DOTNET_GCHeapCount: "1"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
while IFS= read -r line; do
|
||||
[ -n "$line" ] || continue
|
||||
export "${line?}"
|
||||
done <<< "${{ inputs.test_env }}"
|
||||
|
||||
while IFS= read -r proj; do
|
||||
[ -n "$proj" ] || continue
|
||||
name="$(basename "$proj" .csproj)"
|
||||
echo "::group::$name"
|
||||
dotnet test "$proj" -c Release --no-build \
|
||||
--filter "Category!=Live" \
|
||||
--blame-hang-timeout ${{ inputs.blame_hang_timeout }} \
|
||||
--logger "trx;LogFileName=${name}.trx" \
|
||||
--results-directory ./TestResults \
|
||||
-- xUnit.MaxParallelThreads=1
|
||||
echo "::endgroup::"
|
||||
done <<< "${{ inputs.test_projects }}"
|
||||
|
||||
- name: Publish test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-results
|
||||
path: ${{ inputs.working_directory }}/TestResults
|
||||
@@ -0,0 +1,111 @@
|
||||
# Reusable Node CI pipeline — covers Vue 3, React and Nuxt front ends.
|
||||
# Typecheck runs ONCE (in lint); the build step must not re-run vue-tsc/tsc.
|
||||
#
|
||||
# Phase order (do not reorder in callers):
|
||||
# 1. lint_command — lint + typecheck (no dist)
|
||||
# 2. extra_check_command — audit, unit tests, source checks (no dist)
|
||||
# 3. build_command — production build only (produces dist)
|
||||
# 4. post_build_command — bundle budget, e2e, anything that needs dist
|
||||
# build_env is exported for Build and Post-build only.
|
||||
name: node-ci
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
runs_on:
|
||||
type: string
|
||||
default: ubuntu-latest
|
||||
working_directory:
|
||||
description: "Directory holding package.json, relative to the repo root."
|
||||
type: string
|
||||
required: true
|
||||
node_version:
|
||||
type: string
|
||||
default: "22"
|
||||
package_manager:
|
||||
description: "npm | pnpm"
|
||||
type: string
|
||||
default: npm
|
||||
lock_file:
|
||||
type: string
|
||||
default: package-lock.json
|
||||
lint_command:
|
||||
type: string
|
||||
default: "npm run lint"
|
||||
extra_check_command:
|
||||
description: "Optional checks between lint and build. Must NOT require dist/."
|
||||
type: string
|
||||
default: ""
|
||||
build_command:
|
||||
description: "Build only. Typechecking belongs in lint_command, not here."
|
||||
type: string
|
||||
default: "npx vite build"
|
||||
build_env:
|
||||
description: "Optional KEY=VALUE lines exported for Build and Post-build."
|
||||
type: string
|
||||
default: ""
|
||||
post_build_command:
|
||||
description: "Optional checks after build that may use dist/ (bundle budget, e2e)."
|
||||
type: string
|
||||
default: ""
|
||||
artifact_path:
|
||||
description: "Optional build output to upload. Empty uploads nothing."
|
||||
type: string
|
||||
default: ""
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ inputs.runs_on }}
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ inputs.working_directory }}
|
||||
steps:
|
||||
- uses: builtin:checkout
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.node_version }}
|
||||
cache: ${{ inputs.package_manager }}
|
||||
cache-dependency-path: ${{ inputs.working_directory }}/${{ inputs.lock_file }}
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
if [ "${{ inputs.package_manager }}" = "pnpm" ]; then
|
||||
corepack enable && pnpm install --frozen-lockfile
|
||||
else
|
||||
npm ci
|
||||
fi
|
||||
|
||||
- name: Lint (and typecheck)
|
||||
run: ${{ inputs.lint_command }}
|
||||
|
||||
- name: Extra check
|
||||
if: inputs.extra_check_command != ''
|
||||
run: ${{ inputs.extra_check_command }}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
set -euo pipefail
|
||||
while IFS= read -r line; do
|
||||
[ -n "$line" ] || continue
|
||||
export "${line?}"
|
||||
done <<< "${{ inputs.build_env }}"
|
||||
${{ inputs.build_command }}
|
||||
|
||||
- name: Post-build check
|
||||
if: inputs.post_build_command != ''
|
||||
run: |
|
||||
set -euo pipefail
|
||||
while IFS= read -r line; do
|
||||
[ -n "$line" ] || continue
|
||||
export "${line?}"
|
||||
done <<< "${{ inputs.build_env }}"
|
||||
${{ inputs.post_build_command }}
|
||||
|
||||
- name: Upload build output
|
||||
if: inputs.artifact_path != ''
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-output
|
||||
path: ${{ inputs.working_directory }}/${{ inputs.artifact_path }}
|
||||
@@ -0,0 +1,129 @@
|
||||
# Reusable Node service CI — install, migrate, test against job sidecars.
|
||||
#
|
||||
# Do NOT use workflow services: for RabbitMQ on this runner — the broker fails
|
||||
# health before steps run. Sidecars via start-job-sidecars.sh (Docker socket).
|
||||
# See CICD/platform/observed-state.md.
|
||||
#
|
||||
# Caller (after this file is tagged in infra/ci-workflows@v1):
|
||||
# jobs:
|
||||
# api-service:
|
||||
# uses: infra/ci-workflows/.gitea/workflows/node-service-ci.yml@v1
|
||||
# with:
|
||||
# working_directory: api-service
|
||||
# migrate_command: npm run migrate
|
||||
# test_command: npm test -- --runInBand --forceExit
|
||||
# sidecars_script: scripts/start-job-sidecars.sh
|
||||
name: node-service-ci
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
runs_on:
|
||||
type: string
|
||||
default: ubuntu-latest
|
||||
working_directory:
|
||||
description: "Directory holding package.json, relative to the repo root."
|
||||
type: string
|
||||
required: true
|
||||
node_version:
|
||||
# Matches node-ci.yml. Pin this explicitly in every caller — a shared
|
||||
# default that moves is a silent toolchain change across projects.
|
||||
type: string
|
||||
default: "22"
|
||||
package_manager:
|
||||
type: string
|
||||
default: npm
|
||||
lock_file:
|
||||
type: string
|
||||
default: package-lock.json
|
||||
install_command:
|
||||
type: string
|
||||
default: ""
|
||||
migrate_command:
|
||||
description: "Shell run after sidecars are up (working_directory)."
|
||||
type: string
|
||||
default: ""
|
||||
test_command:
|
||||
description: "Shell run after migrate (working_directory)."
|
||||
type: string
|
||||
default: "npm test -- --runInBand --forceExit"
|
||||
sidecars_script:
|
||||
description: "Path from repo root to start-job-sidecars.sh (copy from the CICD kit)."
|
||||
type: string
|
||||
default: "scripts/start-job-sidecars.sh"
|
||||
database_url_var:
|
||||
description: "Env var name for the Postgres URL written by the sidecar script."
|
||||
type: string
|
||||
default: DATABASE_URL
|
||||
amqp_url_var:
|
||||
type: string
|
||||
default: AMQP_URL
|
||||
redis_url_var:
|
||||
type: string
|
||||
default: REDIS_URL
|
||||
postgres_db:
|
||||
type: string
|
||||
default: app_test
|
||||
test_env:
|
||||
description: "Optional KEY=VALUE lines exported for migrate and test."
|
||||
type: string
|
||||
default: ""
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ inputs.runs_on }}
|
||||
steps:
|
||||
- uses: builtin:checkout
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.node_version }}
|
||||
cache: ${{ inputs.package_manager }}
|
||||
cache-dependency-path: ${{ inputs.working_directory }}/${{ inputs.lock_file }}
|
||||
|
||||
- name: Start job sidecars
|
||||
env:
|
||||
CI_PG_DB: ${{ inputs.postgres_db }}
|
||||
CI_DATABASE_URL_VAR: ${{ inputs.database_url_var }}
|
||||
CI_AMQP_URL_VAR: ${{ inputs.amqp_url_var }}
|
||||
CI_REDIS_URL_VAR: ${{ inputs.redis_url_var }}
|
||||
run: bash ${{ inputs.sidecars_script }}
|
||||
|
||||
- name: Install
|
||||
working-directory: ${{ inputs.working_directory }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -n "${{ inputs.install_command }}" ]; then
|
||||
${{ inputs.install_command }}
|
||||
elif [ "${{ inputs.package_manager }}" = "pnpm" ]; then
|
||||
corepack enable && pnpm install --frozen-lockfile
|
||||
else
|
||||
npm ci
|
||||
fi
|
||||
|
||||
- name: Migrate
|
||||
if: inputs.migrate_command != ''
|
||||
working-directory: ${{ inputs.working_directory }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
while IFS= read -r line; do
|
||||
[ -n "$line" ] || continue
|
||||
export "${line?}"
|
||||
done <<< "${{ inputs.test_env }}"
|
||||
${{ inputs.migrate_command }}
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{ inputs.working_directory }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
while IFS= read -r line; do
|
||||
[ -n "$line" ] || continue
|
||||
export "${line?}"
|
||||
done <<< "${{ inputs.test_env }}"
|
||||
${{ inputs.test_command }}
|
||||
|
||||
- name: Stop job sidecars
|
||||
if: always()
|
||||
run: |
|
||||
docker rm -f "${CI_PG_NAME:-}" "${CI_RMQ_NAME:-}" "${CI_REDIS_NAME:-}" 2>/dev/null || true
|
||||
@@ -0,0 +1,44 @@
|
||||
# Generic single-product CI caller — copy into .gitea/workflows/ci.yml and rename paths.
|
||||
# Requires infra/ci-workflows@v1 (collaborative owners must include this repo's owner).
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
paths:
|
||||
- "src/**"
|
||||
- "web/**"
|
||||
- "MyApp.sln"
|
||||
- ".gitea/workflows/**"
|
||||
pull_request:
|
||||
branches: [main, master]
|
||||
paths:
|
||||
- "src/**"
|
||||
- "web/**"
|
||||
- "MyApp.sln"
|
||||
- ".gitea/workflows/**"
|
||||
|
||||
jobs:
|
||||
backend:
|
||||
uses: infra/ci-workflows/.gitea/workflows/dotnet8-ci.yml@v1
|
||||
with:
|
||||
working_directory: .
|
||||
solution: MyApp.sln
|
||||
postgres_db: myapp_test
|
||||
isolated_test_projects: |
|
||||
tests/MyApp.UnitTests/MyApp.UnitTests.csproj
|
||||
test_projects: |
|
||||
tests/MyApp.IntegrationTests/MyApp.IntegrationTests.csproj
|
||||
test_env: |
|
||||
Jwt__SigningKey=ci-test-jwt-secret-at-least-32-bytes-long!!
|
||||
|
||||
frontend:
|
||||
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
|
||||
extra_check_command: npm test
|
||||
build_command: npx vite build
|
||||
build_env: |
|
||||
VITE_API_BASE_URL=
|
||||
@@ -0,0 +1,112 @@
|
||||
# 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
|
||||
@@ -0,0 +1,83 @@
|
||||
# What .gitea/workflows/ci.yml becomes once infra/ci-workflows exists and is tagged v1.
|
||||
# STAGED — do not copy into .gitea/workflows/ until that repo is pushed and tagged,
|
||||
# or every run fails to resolve the `uses:` reference.
|
||||
#
|
||||
# 241 lines -> ~75. What stays here is what a reusable workflow cannot take:
|
||||
# the change-detection job needs fetch-depth: 0 and a repo-specific path map.
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
paths:
|
||||
- "GrowthOS/**"
|
||||
- ".gitea/workflows/**"
|
||||
pull_request:
|
||||
branches: [master, main]
|
||||
paths:
|
||||
- "GrowthOS/**"
|
||||
- ".gitea/workflows/**"
|
||||
|
||||
jobs:
|
||||
# Stays local: repo-specific path map, and it needs full history to diff against
|
||||
# the merge base. Keep actions/checkout@v4 here unless the probe proves
|
||||
# builtin:checkout honours fetch-depth: 0 — a silently shallow clone would make
|
||||
# this filter skip real work while the run stays green.
|
||||
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
|
||||
- name: Detect changed stacks
|
||||
id: filter
|
||||
run: |
|
||||
# ... unchanged from the current ci.yml ...
|
||||
echo "see .gitea/workflows/ci.yml for the body"
|
||||
|
||||
backend:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.backend == 'true'
|
||||
uses: infra/ci-workflows/.gitea/workflows/dotnet8-ci.yml@v1
|
||||
with:
|
||||
working_directory: GrowthOS
|
||||
solution: GrowthOS.sln
|
||||
postgres_db: growth_os_test
|
||||
# Unit tests are InMemory. They must not see the service Postgres, or
|
||||
# AppDbContextFactory connects to it and retries until the runner thrashes.
|
||||
isolated_test_projects: |
|
||||
tests/GrowthOS.UnitTests/GrowthOS.UnitTests.csproj
|
||||
test_projects: |
|
||||
tests/GrowthOS.IntegrationTests/GrowthOS.IntegrationTests.csproj
|
||||
tests/GrowthOS.AgentEvals/GrowthOS.AgentEvals.csproj
|
||||
test_env: |
|
||||
Jwt__SigningKey=ci-test-jwt-secret-at-least-32-bytes-long!!
|
||||
Gitea__DryRun=true
|
||||
Gitea__BaseUrl=
|
||||
Gitea__Token=
|
||||
pre_build_command: |
|
||||
set -euo pipefail
|
||||
venv=/tmp/growth-seed
|
||||
if ! python3 -m venv "$venv"; then
|
||||
(sudo apt-get update -qq && sudo apt-get install -y -qq python3-venv) \
|
||||
|| (apt-get update -qq && apt-get install -y -qq python3-venv)
|
||||
python3 -m venv "$venv"
|
||||
fi
|
||||
"$venv/bin/pip" install --quiet --disable-pip-version-check pyyaml
|
||||
"$venv/bin/python" GrowthOS/scripts/sync-growth-memory-seed.py --check
|
||||
|
||||
frontend:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.frontend == 'true'
|
||||
uses: infra/ci-workflows/.gitea/workflows/node-ci.yml@v1
|
||||
with:
|
||||
working_directory: GrowthOS/web
|
||||
node_version: "22"
|
||||
lint_command: npm run lint
|
||||
extra_check_command: node scripts/check-prod-routing.mjs
|
||||
build_command: npx vite build
|
||||
build_env: |
|
||||
VITE_API_BASE_URL=
|
||||
Reference in New Issue
Block a user