d3ro-voice/.forgejo/workflows/ci.yml
Yun Chan d3d6f34bfa test(infra): gate protected acceptance tests and ratchet test quality (TDD 2.0 Phase 1)
docs/tdd-red/07-revamp-plan.md Phase 1 — v1.1이 문서로만 선언한 것을 게이트로 옮긴다.

보호 수용 경로 게이트 (check-protected-tests.mjs):
- 06 §5 의 보호 6경로를 base revision 과 비교한다.
- 실패 조건: 테스트/스텝 블록 감소, expect 감소, .only 추가, skip/todo 추가,
  보호 파일 삭제.
- 정당한 스펙 변경은 커밋 본문 `allow-protected-change: <사유>` 또는 --reason 으로만
  통과한다(사람 리뷰 대체 아님). CI quality 잡이 --base HEAD^ 로 실행하며
  체크아웃이 depth 2 로 바뀐다. 얕은 클론에서는 SKIP 사유를 출력한다.

품질 래칫 (check-test-quality.mjs + test-quality-baseline.json):
- 파일별 weak-assertion(toBeDefined/toBeTruthy/toBeFalsy/toBeNull)과
  ambient-time(Date.now/Math.random/performance.now) 수치를 동결하고 증가만 막는다.
- 128 / 203 건을 한 번에 고치지 않고 회귀만 차단한다. --update 는 리뷰 후 실행.

배선: verify:all 에 두 게이트 편입, CI quality 잡 단계 추가,
map/02 §10 · tdd-red/06 §5·§6 · 07 Phase 0-1 상태 갱신.

검증:
- self-test: check-protected-tests 6케이스, check-test-quality 6케이스 통과
- 실제 약화 주입 시 두 게이트가 exit 1 (smoke.spec.ts .only, 약한 단정 추가) 후 원복
- npm run test:hygiene / check:design GREEN, npm test GREEN (2800+605+31+24)
2026-11-08 21:11:12 +09:00

232 lines
8.3 KiB
YAML

name: ci
# 브랜치·PR 검증. 예전 .github/workflows/ci.yml(GitHub 원격이 없어 한 번도 실행되지 않음)에서
# 자체 호스팅 linux-builder 러너로 돌릴 수 있는 잡만 옮겼다.
#
# 옮기지 않은 잡:
# - test-matrix의 windows/macos 칸: macOS 러너가 없고, windows 러너는 태그 릴리스 전용으로 둔다.
# - mobile-android APK 빌드 / mobile-emulator-e2e: Android SDK + KVM 에뮬레이터가 필요하다.
# GitLab 미러(.gitlab-ci.yml mobile-android, mobile-emulator-e2e)가 계속 담당한다.
#
# 러너 관례: actions/checkout·setup-* 없이 github.token으로 직접 fetch 한다(다른 .forgejo 워크플로와 동일).
# Deno/.NET은 scripts/ci/bootstrap-linux-toolchain.sh 가 체크섬 검증 후 설치한다.
# git clean -fdx 로 지워지지 않도록 도구 캐시는 체크아웃 밖(CI_PROJECT_DIR)에 둔다.
#
# 필요한 시크릿: 없음 (github.token 만 사용)
on:
push:
branches:
- main
- develop
- "feature/**"
- "fix/**"
pull_request:
branches:
- main
- develop
workflow_dispatch:
jobs:
quality:
name: 정본·보안·린트·타입·테스트
runs-on: linux-builder
steps:
- name: checkout
env: { CI_TOKEN: "${{ github.token }}" }
run: |
proto="${GITHUB_SERVER_URL%%://*}"; host="${GITHUB_SERVER_URL#*://}"
url="$proto://actions:${CI_TOKEN}@${host%/}/${GITHUB_REPOSITORY}.git"
[ -d .git ] || git init -q .
git remote remove origin 2>/dev/null || true
git remote add origin "$url"
# depth 2: 보호 수용 테스트 게이트가 HEAD^ 와 비교한다 (얕은 클론 1이면 비교 불가).
git fetch -q --depth 2 origin "$GITHUB_REF"
git checkout -q -f FETCH_HEAD
git clean -qfdx
- name: Node (.nvmrc) 설치
shell: bash
run: |
set -euo pipefail
export CI_PROJECT_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/d3ro-ci"
. scripts/ci/bootstrap-linux-toolchain.sh node
dirname "$(command -v node)" >> "$GITHUB_PATH"
echo "node $(node --version) / npm $(npm --version)"
- name: 의존성 설치
run: npm ci
- name: 버전·계약 정본 대조
run: |
npm run version:check
npm run contract:check
npm run release:metadata:test
- name: Supabase 마이그레이션 파일 정합성
run: |
npm run check:migrations:test
npm run check:migrations
- name: 하드코딩 자격증명 검사
run: |
npm run security:secrets:test
npm run security:secrets
- name: 모바일 릴리스 경계·설정 계약
run: |
npm run release:mobile:boundary:test
npm run release:mobile:config:test
npm run release:mobile:build-config:test
npm run release:play:assets
- name: 테스트 위생 게이트
run: |
npm run test:hygiene:test
npm run test:hygiene
- name: 보호 수용 테스트·품질 래칫
run: |
npm run check:protected-tests:test
npm run check:protected-tests -- --base HEAD^
npm run test:quality:test
npm run test:quality
- name: 린트
run: npm run lint
- name: 타입 검사
run: npm run typecheck
- name: 테스트 (Vitest)
run: npm test
build-validation:
name: 워크스페이스 빌드 검증
needs: quality
runs-on: linux-builder
steps:
- name: checkout
env: { CI_TOKEN: "${{ github.token }}" }
run: |
proto="${GITHUB_SERVER_URL%%://*}"; host="${GITHUB_SERVER_URL#*://}"
url="$proto://actions:${CI_TOKEN}@${host%/}/${GITHUB_REPOSITORY}.git"
[ -d .git ] || git init -q .
git remote remove origin 2>/dev/null || true
git remote add origin "$url"
git fetch -q --depth 1 origin "$GITHUB_REF"
git checkout -q -f FETCH_HEAD
git clean -qfdx
- name: Node (.nvmrc) 설치
shell: bash
run: |
set -euo pipefail
export CI_PROJECT_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/d3ro-ci"
. scripts/ci/bootstrap-linux-toolchain.sh node
dirname "$(command -v node)" >> "$GITHUB_PATH"
echo "node $(node --version) / npm $(npm --version)"
- name: 의존성 설치
run: npm ci
- name: 데스크톱 번들 빌드 + 렌더러 번들 검증
run: |
npm run build --workspace=@d3ro/desktop
node scripts/ci/verify-desktop-renderer-bundles.mjs
- name: 어드민 빌드
run: npm run build --workspace=@d3ro/admin
- name: 웹앱 프로덕션 빌드
run: npm run build --workspace=@d3ro/web
mobile-quality:
name: 모바일 린트·타입·Jest
runs-on: linux-builder
steps:
- name: checkout
env: { CI_TOKEN: "${{ github.token }}" }
run: |
proto="${GITHUB_SERVER_URL%%://*}"; host="${GITHUB_SERVER_URL#*://}"
url="$proto://actions:${CI_TOKEN}@${host%/}/${GITHUB_REPOSITORY}.git"
[ -d .git ] || git init -q .
git remote remove origin 2>/dev/null || true
git remote add origin "$url"
git fetch -q --depth 1 origin "$GITHUB_REF"
git checkout -q -f FETCH_HEAD
git clean -qfdx
- name: Node (.nvmrc) 설치
shell: bash
run: |
set -euo pipefail
export CI_PROJECT_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/d3ro-ci"
. scripts/ci/bootstrap-linux-toolchain.sh node
dirname "$(command -v node)" >> "$GITHUB_PATH"
echo "node $(node --version) / npm $(npm --version)"
- name: 의존성 설치
run: |
npm ci
npm --prefix apps/mobile-rn ci --workspaces=false
- name: 모바일 검사
run: |
npm --prefix apps/mobile-rn run lint
npm --prefix apps/mobile-rn run typecheck
npm --prefix apps/mobile-rn run test:ci
edge-functions:
name: Supabase Edge Functions + Cloudflare Worker
runs-on: linux-builder
steps:
- name: checkout
env: { CI_TOKEN: "${{ github.token }}" }
run: |
proto="${GITHUB_SERVER_URL%%://*}"; host="${GITHUB_SERVER_URL#*://}"
url="$proto://actions:${CI_TOKEN}@${host%/}/${GITHUB_REPOSITORY}.git"
[ -d .git ] || git init -q .
git remote remove origin 2>/dev/null || true
git remote add origin "$url"
git fetch -q --depth 1 origin "$GITHUB_REF"
git checkout -q -f FETCH_HEAD
git clean -qfdx
- name: Deno 2.8.1 설치 후 검사·테스트
shell: bash
run: |
set -euo pipefail
export CI_PROJECT_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/d3ro-ci"
. scripts/ci/bootstrap-linux-toolchain.sh deno
for entrypoint in server/supabase/functions/*/index.ts; do
deno check --config server/supabase/functions/deno.json "$entrypoint"
done
deno test --config server/supabase/functions/deno.json --allow-read --allow-env server/supabase/functions
deno check --no-config server/cloudflare-worker/src/push-drain.ts
deno test --no-config --allow-read server/cloudflare-worker/src/push-drain.test.ts
api-server-tests:
name: .NET API 서버 테스트
runs-on: linux-builder
steps:
- name: checkout
env: { CI_TOKEN: "${{ github.token }}" }
run: |
proto="${GITHUB_SERVER_URL%%://*}"; host="${GITHUB_SERVER_URL#*://}"
url="$proto://actions:${CI_TOKEN}@${host%/}/${GITHUB_REPOSITORY}.git"
[ -d .git ] || git init -q .
git remote remove origin 2>/dev/null || true
git remote add origin "$url"
git fetch -q --depth 1 origin "$GITHUB_REF"
git checkout -q -f FETCH_HEAD
git clean -qfdx
- name: .NET 10.0.302 설치 후 테스트
shell: bash
run: |
set -euo pipefail
export CI_PROJECT_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/d3ro-ci"
. scripts/ci/bootstrap-linux-toolchain.sh dotnet
dotnet restore apps/api-server.Tests/D3ROVoice.Api.Tests.csproj
dotnet test apps/api-server.Tests/D3ROVoice.Api.Tests.csproj --configuration Release --no-restore -p:StaticWebAssetsEnabled=false