Files
clean-architecture-backend-…/scripts/ci/verify-configuration-cache.sh
DongHyeonka 11c63825ca build!: PR 단계가 시험 코드 정적 검사와 보조 source set 스타일 검사를 돈다
시험 source set의 SpotBugs·FindSecBugs(testQualityCheck)와 main·test 밖 source set의
Checkstyle(leaf마다 auxiliaryStyleCheck)는 main 단계(mainCheck 안 qualificationCheck)에서만
돈다. 그래서 시험 코드의 결함이 병합 뒤에야 잡힌다(2026-11-13 main run 269: graphql
systemTest의 dead local store). leaf check에 걸린 lane 밖의 보조 source set(예: graphql
systemTest, integrationTest)은 PR에서 컴파일조차 되지 않아, 그 컴파일 오류도 main에서야
드러난다.

루트 prCheck가 testQualityCheck와 모든 leaf의 auxiliaryStyleCheck에 기댄다. PR은 main
push의 done job이 채운 빌드 캐시를 받으므로, 입력이 바뀌지 않은 leaf의 분석은 캐시에서
온다(desktop 2026-11-13, 바꾸지 않은 트리를 다른 checkout에서: 캐시 있음 +29초, 없음
+310초). 설명 문자열, 머리 주석, docs/build.md·gates.md·decisions.md 행, be-testing 스킬의
검증 줄, configuration-cache 스크립트의 이유 문장을 같은 내용으로 고친다. 파생 서비스용
안내 docs/upgrade/2026-11-pr-test-quality.md를 더한다.

버린 대안:
- qualificationCheck(main)에서 두 검사를 빼고 PR로 옮기기: 단계에서 게이트를 빼는 것은
  소유자 결정이다. 그대로 두어 main push에서는 main job과 done job이 둘 다 돈다.
- pr.yml에 job을 더하기: 단계 job은 ./gradlew <단계> 한 줄이고, 단계에 무엇이 드는지는
  Gradle 단계 태스크가 정한다(gates.md 7절).
- 바뀐 leaf만 고르는 경로 조건: 빌드 캐시가 같은 일을 하고, 경로 필터는
  verifyStrictLaneStages가 거절한다.

위험·한계:
- 빌드 캐시를 못 받은 PR(표식만 남고 캐시 항목이 밀려난 경우 등)은 prCheck가 길어진다.
- main push에서 두 검사가 main job과 done job에서 두 번 돈다(done은 캐시를 채우려는 job).

검증(desktop, 기준 d095f905, 트리 2253bfdd):
- 탐침(variant마다 빈 빌드 캐시, 같은 경로 새 checkout, :prCheck):
  기준 fill 347초·530 executed, same 32초·273 from cache. 이 변경 fill
  574초·662 executed, same 34초·402 from cache.
- graphql systemTest에 SpotBugs만 잡는 줄(new Random().nextInt() 한 번)을
  넣으면 기준은 통과, 이 변경은 spotbugsSystemTest 실패. 타입 오류를
  넣으면 기준은 통과, 이 변경은 compileSystemTestJava 실패. 안 읽는
  변수·덮어쓴 값(dead store)은 이 변경에서 Error Prone UnusedVariable이
  compileSystemTestJava를 막는다(기준은 통과).
- :prCheck --dry-run 계획: 783 → 1,030 태스크(더함 247, 뺌 0). 시험
  source set SpotBugs 72, 보조 source set Checkstyle 38, 보조 source set
  컴파일 21(httpclient compileJmhJava 포함).
- scripts/verify.sh pr --no-cache rc=0(:prCheck 9:32, 662 executed,
  FROM-CACHE 0, 시험 7,269개). scripts/verify.sh main --no-cache rc=0
  (바깥 446 executed, FROM-CACHE 0, 시험 1,980개). 노트북
  scripts/verify.sh docs rc=0.

BREAKING CHANGE: pr.yml done의 ./gradlew :prCheck가 testQualityCheck와 모든 leaf의
auxiliaryStyleCheck를 돈다. 시험 코드에 SpotBugs·Checkstyle 발견이 있거나 보조 source set이
컴파일되지 않는 파생 서비스는 받는 PR부터 막힌다. 받기 전에 ./gradlew testQualityCheck
auxiliaryStyleCheck를 돌려 고친다(docs/upgrade/2026-11-pr-test-quality.md).
2026-11-20 17:28:41 +09:00

28 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Two questions about Gradle's configuration cache. Called by the `configuration-cache` job of
# .gitea/workflows/main.yml and by scripts/verify.sh main.
# 1. Can every repository-wide gate be stored? A property of the task graph, so --dry-run answers it
# for all of them in seconds without running a lane.
# 2. Is a stored entry reused while the build still executes its work? Checked on the two core
# leaves, whose check runs in a minute.
# prCheck and verifyStrictLaneStages are not in the list: the strict-lane check reads the task graph
# itself and is declared incompatible, and so is verifyDependencyLocks, which prCheck holds beside ci,
# the two test-code checks mainCheck runs as well (testQualityCheck, auxiliaryStyleCheck) and scripts.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/../.."
reused() { # gradle arguments...; fails unless the second identical run reuses the stored entry
./gradlew "$@" --configuration-cache --configuration-cache-problems=fail
output=$(./gradlew "$@" --configuration-cache --configuration-cache-problems=fail 2>&1)
printf '%s\n' "${output}"
grep -Fq 'Reusing configuration cache.' <<<"${output}" || {
echo "configuration cache: not reused for: $*" >&2
exit 1
}
}
for gate in ci mainCheck integrationCheck releaseCheck; do
reused "${gate}" --dry-run
done
reused :domain-core:check :application-core:check