WORKFLOW · quality-cd
CI quality gate for Java services
Build, test, coverage, and lint as named required checks, identical for agent and human PRs, plus two-tier prompt regression jobs for services that call Bedrock.
✓ verified 2026-06-12 · stack: github-actions, java, maven, bedrock · source
The full quality gate for a Maven-built Java service, exposed as named status checks so a ruleset can require each one individually. It is deliberately author-blind: an agent PR and a human PR pass or fail on identical evidence. The two prompt-regression jobs cover the surface JUnit cannot (behaviour changes in Bedrock-calling code paths caused by prompt or model edits), using the deterministic-first, judge-second tiering from Anthropic’s eval methodology.
name: CI Quality Gate (Java + AI)on: push: branches: [main, develop] pull_request: schedule: - cron: '0 2 * * *' # nightly tier-2 evals workflow_dispatch:
permissions: contents: read id-token: write # OIDC for Bedrock-backed eval jobs
jobs: build-test-coverage: name: Build, Test, and Coverage runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: java-version: '21' distribution: 'corretto' cache: 'maven'
- name: Build, unit tests, and coverage gate run: mvn verify -Dskip.integration.tests=true # jacoco:check is bound to verify — see the pom snippet below
static-analysis: name: Static Analysis runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: java-version: '21' distribution: 'corretto' cache: 'maven'
- name: Checkstyle and SpotBugs run: mvn -DskipTests compile spotbugs:check checkstyle:check
prompt-regression-tier1: name: Prompt Regression (Tier 1) runs-on: ubuntu-latest needs: build-test-coverage if: github.event_name == 'pull_request' || github.event_name == 'push' steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '20'
- name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} aws-region: us-east-1
- name: Run deterministic prompt assertions run: | npx promptfoo eval \ --config src/test/prompts/promptfoo.yaml \ --filter-pattern "tier1" \ --output results-tier1.json
- uses: actions/upload-artifact@v4 if: always() with: name: prompt-regression-tier1 path: results-tier1.json
prompt-regression-tier2: name: Prompt Regression (Tier 2, LLM judge) runs-on: ubuntu-latest if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '20'
- name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} aws-region: us-east-1
- name: Run LLM-judge evals run: | npx promptfoo eval \ --config src/test/prompts/promptfoo.yaml \ --filter-pattern "tier2" \ --output results-tier2.json
- uses: actions/upload-artifact@v4 if: always() with: name: prompt-regression-tier2 path: results-tier2.jsonThe coverage gate assumes JaCoCo is bound to verify in the pom:
<plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.8.12</version> <executions> <execution> <goals><goal>prepare-agent</goal></goals> </execution> <execution> <id>coverage-check</id> <goals><goal>check</goal></goals> <configuration> <rules> <rule> <element>BUNDLE</element> <limits> <limit> <counter>LINE</counter> <value>COVEREDRATIO</value> <minimum>0.80</minimum> </limit> </limits> </rule> </rules> </configuration> </execution> </executions></plugin>Then require Build, Test, and Coverage, Static Analysis, and
Prompt Regression (Tier 1) in a ruleset with no bypass actors. The ruleset
configuration, CODEOWNERS pairing, and the same-gate-for-agents rationale are
in the
required checks artifact.
Tier 2 is deliberately not a required check: it runs nightly and on demand,
and gates prompt-change PRs by team policy rather than blocking every build
on a non-deterministic judge.
What it does
- Exposes build+test+coverage, lint, and tier-1 prompt regressions as separately named checks, so a ruleset can require them individually and a failure is legible at a glance.
- Applies one gate to all authors: there is no agent-specific path, which is the property that lets agent PRs merge on evidence rather than trust.
- Splits prompt regressions by grader determinism, per Anthropic’s eval methodology: tier 1 (JSON validity, required fields, bounds) on every PR at near-zero cost; tier 2 (LLM-as-judge rubrics) nightly, where non-determinism and token cost are acceptable.
- Authenticates eval jobs to Bedrock via OIDC: no static AWS keys in secrets.
Failure modes
- Check names are a contract. Renaming a job’s
name:silently decouples it from the ruleset; the required check never reports and PRs hang. Change workflow and ruleset together. - The coverage gate is only as honest as the threshold. Agents generate tests easily, so line coverage inflates without assertion quality. Treat 0.80 as a floor that catches missing tests; rely on review (and the no-editing-tests rule from TDD with agents) for test quality.
- Tier-1 evals cost real Bedrock invocations on every PR. Keep the tier-1
suite small (deterministic assertions over a fixed golden set), and skip
the job entirely in repos with no
src/test/prompts/directory. - Promptfoo syntax and Bedrock model IDs move. Confirm the provider ID
and cross-region inference profile (
us.anthropic.…) against your promptfoo version and region’s model catalogue before first run; eval failures from a renamed model are indistinguishable from regressions in the check UI. -Dskip.integration.testsassumes your pom defines that switch. Wire it to Failsafe’sskipITsor drop the flag and accept longer PR builds.
Gate structure verified against Anthropic’s eval methodology (capability vs regression suites, code-based graders first) and the DORA 2025 control-systems finding; job syntax against GitHub Actions current schema, 2026-06-12.