Skip to content

ci(codequality): offload differential code quality checks to Cloud Build - #1272

Merged
kyasbal merged 1 commit into
mainfrom
push-lltpzmyvouut
Nov 13, 2026
Merged

kyasbal merged 1 commit into
mainfrom
push-lltpzmyvouut

Conversation

@kyasbal

@kyasbal kyasbal commented Nov 13, 2026

Copy link
Copy Markdown
Member

Summary

Offloads differential Go and TypeScript code quality checks (scripts/codequality) from GitHub Actions (ubuntu-latest) to Google Cloud Build (E2_HIGHCPU_32, 32 vCPUs) so PR verification stays fast while evaluating all reached mutants without budget truncation.

Key Changes

  1. Cloud Build Quality Gate (.cloudbuild/github-codequality.yaml, scripts/run-codequality-ci.sh, scripts/make/testing.mk):
    • Runs make codequality-ci inside gcr.io/kubernetes-history-inspector/builder:latest on E2_HIGHCPU_32 with _MAX_MUTANTS=0 (evaluate 100% of reached mutants) and _TIMEOUT=10m.
    • Fetches the PR's target branch (_BASE_BRANCH, supporting main, epic/*, and stacked PR branches) in shallow clones and resolves merge-base.
    • Applies path-aware build preparation: skips npm ci and Angular builds on pure Go backend changes outside pkg/server/ and cmd/, skips production ng build on pure frontend TypeScript changes, and skips all codegen when neither Go nor TypeScript files changed.
  2. Unified Unlimited Mutant Budget (scripts/codequality/internal/tscheck):
    • Aligns tscheck.Options.MaxMutants with mutcheck and karma_mutation_plugin.js so --max-mutants=0 evaluates all reached TypeScript mutants instead of falling back to 80.
  3. GitHub Actions Lightening (.github/workflows/pullrequest.yaml):
    • Keeps fast unit tests (go test ./..., make test-web) and linters (golangci-lint, codequality --conventions, lint-web) in GitHub Actions while removing differential coverage/mutation runs from pullrequest.yaml.
  4. Container Chromium /dev/shm Hardening (web/karma.conf.js, scripts/codequality/internal/tscheck/karma.go):
    • Adds --disable-dev-shm-usage to ChromeHeadlessNoSandbox so headless Chromium uses /tmp instead of the 64 MB /dev/shm tmpfs inside Cloud Build step containers.

Verification

  • go test ./scripts/...: PASS
  • make codequality-ci: PASS (0 violations) — Patch coverage 100.0% (5/5), Mutation score 100.0% (2/2 killed)
  • make pre-commit: PASS

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a unified differential code quality check for Cloud Build CI, adding a new Cloud Build configuration, a 'codequality-ci' make target, and a 'run-codequality-ci.sh' script to prepare workspace artifacts and run checks. It also refactors the TypeScript mutation testing budget logic to support unlimited mutants (using 0) and adds the '--disable-dev-shm-usage' flag to ChromeHeadless configurations in Karma. Feedback suggests expanding the file matching pattern in 'run-codequality-ci.sh' from 'web/src/.ts' to 'web/' to ensure any frontend changes correctly trigger workspace preparation and prevent CI failures.

case "${path}" in
web/src/app/generated/*|web/src/environments/*|*/zzz_*|*/zzz-*)
;;
web/src/*.ts)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Currently, web/src/*.ts only matches TypeScript files. If a PR only modifies other frontend files under web/ (such as HTML templates *.html, stylesheets *.scss, or configuration files like package.json or karma.conf.js), has_ts will remain false. This causes the script to skip workspace preparation (npm ci and frontend asset generation), which leads to test failures or stale test runs in CI because the required dependencies or assets are missing.

Changing the pattern to web/* ensures that any non-ignored changes under the web/ directory correctly trigger the frontend workspace preparation.

Suggested change
web/src/*.ts)
web/*)
@kyasbal
kyasbal enabled auto-merge November 13, 2026 10:45
@kyasbal
kyasbal disabled auto-merge November 13, 2026 10:47
@kyasbal
kyasbal merged commit daa0410 into main Nov 13, 2026
22 checks passed
@kyasbal
kyasbal deleted the push-lltpzmyvouut branch November 13, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant