ci: add Jenkins pipeline with JaCoCo coverage reports
build / jvm (push) Canceled after 0s
build / native (macos-15, macos-arm64) (push) Canceled after 0s
build / native (ubuntu-24.04, linux-x86_64) (push) Canceled after 0s
build / native (windows-2025, windows-x86_64) (push) Canceled after 0s

This commit is contained in:
Nilton Constantino
2026-11-16 10:35:58 +00:00
parent 3dd04a730f
commit dc495b8db5
22 changed files with 945 additions and 1 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
---
schemaVersion: 2
lastWork: "0003"
lastWork: "0004"
@@ -0,0 +1,11 @@
---
schemaVersion: 1
id: "ART-0001"
workId: "WRK-0004"
origin: "aie-jenkins-implementation.txt"
purpose: "Implementação do pipeline e verificação real de relatórios após falha controlada"
path: "artifacts/evidence/ART-0001/payload"
sha256: "58bfb21aafd37579b7cde5c7ccb909911153d3015224a45ad0b86febb08b7961"
size: 2282
author: "agent"
createdAt: "2026-11-16T10:26:14.887102Z"
@@ -0,0 +1,31 @@
WRK-0004 — implementação Jenkins/JaCoCo e falha controlada
Autorização: pedido explícito do usuário para CI Jenkins baseado em JaCoCo como no Prometeu Studio. Referência: files/config/Jenkinsfile e README, build.gradle.kts e convenções Gradle do Studio; apenas leitura.
Implementado: JaCoCo 0.8.14 compatível com Java 25; XML/HTML no caminho comum ao Studio; execução de testes finalizada por relatório com mustRunAfter, sem dependência de sucesso; Jenkinsfile com clean separado, --continue, JUnit, Coverage, HTML e arquivos brutos, publicadores isolados e gates do Studio. Teste local do Jenkinsfile cobre 11 cenários e integra check e o comando CI.
./gradlew jenkinsPipelineTest --console=plain passou. A fixture executa o Jenkinsfile real com passos controlados; não é validação de plugins/controlador.
Falha real controlada: um CiFailureProbeTest temporário, fora dos fontes versionados, foi adicionado apenas por um init script. ./gradlew test jacocoTestReport --continue --no-daemon --console=plain --init-script <temporário> -Daie.ci.probe=<temporário> retornou exit 1, com 1 teste e 1 falha. Mesmo assim, jacocoTestReport executou e produziu XML válido, HTML e test.exec. A primeira tentativa com dependsOn(test) impedia o relatório; mustRunAfter(test) corrigiu isso. A tentativa inicial do probe dentro do sandbox foi bloqueada pelo cache do Gradle e não foi contada como evidência de teste.
Dados observados da execução de falha:
{
"tests": {
"name": "net.intrepid.aiengineering.CiFailureProbeTest",
"tests": "1",
"skipped": "0",
"failures": "1",
"errors": "0",
"timestamp": "2026-11-16T10:24:23.711Z",
"hostname": "VFL-FNLVJ40Y64.local",
"time": "0.02"
},
"jacocoRoot": "report",
"xmlBytes": 487230,
"htmlExists": true,
"execBytes": 47085
}
As saídas de falha foram limpas antes da suíte completa. A suíte completa com o comando exato do pipeline está em execução. O executável nativo instalado foi preservado/restaurado com os mesmos bytes durante clean; não há alteração de produção Java nesta tarefa.
Não foi configurado nem executado um controlador Jenkins real. Isso exige o job, plugins e agente; o setup e essa fronteira estão documentados em files/config/README.md.
@@ -0,0 +1,12 @@
---
schemaVersion: 1
id: "ART-0002"
workId: "WRK-0004"
origin: "aie-jenkins-final-evidence.txt"
purpose: "Comando completo de CI, 126 testes, 11 cenários de pipeline e relatórios\
\ JaCoCo verificados"
path: "artifacts/evidence/ART-0002/payload"
sha256: "eab61e1af988a9eb3ab3b1abdd3984caa2e449aea528aa4eab6febb21fbbf171"
size: 4702
author: "agent"
createdAt: "2026-11-16T10:32:22.869800Z"
@@ -0,0 +1,111 @@
WRK-0004 — verificação final Jenkins/JaCoCo
Comandos executados:
1. ./gradlew clean --no-daemon --console=plain: BUILD SUCCESSFUL.
2. ./gradlew test jacocoTestReport jenkinsPipelineTest --continue --parallel --max-workers=2 --build-cache --no-daemon --console=plain: BUILD SUCCESSFUL em 4m57s; 16 tarefas executadas. Este é o comando do Jenkinsfile.
3. git diff --check: sem erros. aie project validate --format json: valid=true, issues=[].
Resultados medidos:
{
"testSuites": 20,
"junit": {
"tests": 126,
"failures": 0,
"errors": 0,
"skipped": 0
},
"pipelineFixtureScenarios": 11,
"coverage": {
"INSTRUCTION": {
"missed": 3468,
"covered": 23484,
"percent": 87.13,
"gatePassed": true
},
"BRANCH": {
"missed": 763,
"covered": 1728,
"percent": 69.37,
"gatePassed": true
},
"LINE": {
"missed": 200,
"covered": 2421,
"percent": 92.37,
"gatePassed": true
},
"COMPLEXITY": {
"missed": 731,
"covered": 1363,
"percent": 65.09
},
"METHOD": {
"missed": 66,
"covered": 775,
"percent": 92.15,
"gatePassed": true
},
"CLASS": {
"missed": 2,
"covered": 138,
"percent": 98.57,
"gatePassed": true
}
},
"outputs": {
"build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml": {
"bytes": 487358,
"sha256": "4c3de5d772ce6cffdef540ae49336d3080afdbc87fe7842befa3396853c46a07"
},
"build/reports/jacoco/jacocoTestReport/html/index.html": {
"bytes": 13076,
"sha256": "a67be38c4a30366e5c72e0352f441cad71bc26ae5399fecef37fb6cd3db64bbd"
},
"build/jacoco/test.exec": {
"bytes": 208847,
"sha256": "00d8a2d4bfe09b3422ca9436c1da81dde71ffb4a7f690dfee08bf873410cf5e7"
},
"build/reports/tests/test/index.html": {
"bytes": 7532,
"sha256": "938f5d30964a23e77049bb50a075fae63b691c26e53c0a4dbe4b0a1f5309a12f"
}
},
"nativeCliPreserved": true,
"controllerExecuted": false
}
As cinco métricas configuradas estão acima dos limites do Studio (CLASS/METHOD/LINE/INSTRUCTION 50%, BRANCH 40%). Os limites têm criticidade UNSTABLE no Jenkins; nenhuma falha de teste é ocultada. Não há exclusões de classes para elevar artificialmente cobertura. JaCoCo 0.8.14 instrumenta o JVM test worker, não os subprocessos CLI nem smoke nativo.
A falha controlada anterior retornou exit 1 e produziu JUnit (1 teste, 1 falha), XML válido de cobertura, HTML e test.exec. A suíte normal foi executada após limpar essas saídas; os 126 testes finais não incluem CiFailureProbeTest.
Fonte da falha controlada (temporária, não adicionada aos fontes versionados):
package net.intrepid.aiengineering;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.fail;
class CiFailureProbeTest {
@Test void deliberateFailure() { fail("Controlled CI failure probe"); }
}
Init script usado apenas no probe:
gradle.projectsEvaluated {
rootProject.sourceSets.test.java.srcDir(new File(System.getProperty('aie.ci.probe'), 'probe'))
rootProject.tasks.named('test') {
filter { includeTestsMatching 'net.intrepid.aiengineering.CiFailureProbeTest' }
}
}
O teste local do Jenkinsfile executa 11 cenários com passos controlados: sucesso, clean falho com caminhos antigos, falha com relatórios parciais, falha sem relatórios, três relatórios obrigatórios ausentes e falha isolada de cada um dos quatro publicadores. Não invoca plugins nem controlador Jenkins.
Setup no controlador documentado em files/config/README.md: Pipeline from SCM, Script Path files/config/Jenkinsfile, agente Unix com JDK 25 e Git, cache gravável e plugins Pipeline/Gradle/JUnit/Checks API/Coverage/HTML Publisher. Publicação real de checks e relatórios exige execução nesse controlador, que não foi configurado nem acessado nesta sessão.
Studio usado apenas como referência de leitura. Works COMPLETED existentes preservados. Nenhuma fonte Java de produção foi alterada. O executável nativo instalado foi preservado/restaurado com hash idêntico durante o clean local.
Hashes dos arquivos de implementação/documentação/teste:
{
"build.gradle.kts": "bef54ef73fd9eb9dd7b01774d9d17265ee5b0237add51dfc8774cf6b1693c612",
"README.md": "6fd6010b0b688cef888b4593279d4116dea5af5d41d19237e8b5a60a8356feb1",
"files/config/Jenkinsfile": "def60462f283b314b783cf92ca1ed105b1e8b4e9751bc9c81b542436a71e0dea",
"files/config/README.md": "8d8fd77f6259511cc2ef219d75fe107a305c57868de02d833e58452ffb9f7d61",
"scripts/test-jenkins-pipeline.groovy": "0221c4e4015a515b40274d2eae50ee626eccf7ccb95d48bc60a30969aed02a50"
}
@@ -0,0 +1,12 @@
---
schemaVersion: 1
id: "ART-0003"
workId: "WRK-0004"
origin: "ai-engineering:plans:16eced8303bde6b272bf40100ed28225399e414a9bd416342770e0e65613642f"
purpose: "Deterministic aggregation of completed Plans and reviewed cancellations;\
\ not semantic verification of prose criteria"
path: "artifacts/evidence/ART-0003/payload"
sha256: "16eced8303bde6b272bf40100ed28225399e414a9bd416342770e0e65613642f"
size: 283
author: "system:plans"
createdAt: "2026-11-16T10:32:24.049773Z"
@@ -0,0 +1,10 @@
{
"schemaVersion" : 1,
"workId" : "WRK-0004",
"inputHash" : "7e1cdbcf33f7ce9a9aa88caad8a39981760b868f4a8a29988c14b934794a1197",
"plans" : [ {
"id" : "PLN-0001",
"revision" : 8,
"sha256" : "ae341d858850eb0130838e1322b339c3a04c517f0cb7a518fb04fc819511ec8b"
} ]
}
@@ -0,0 +1,13 @@
---
schemaVersion: 1
id: "DSC-0001"
workId: "WRK-0004"
discussionId: "main"
kind: "NOTE"
author: "agent"
createdAt: "2026-11-16T10:18:25.585225Z"
respondsTo: null
documentVersion: 2
---
Autorização explícita do usuário: criar CI Jenkins baseado em JaCoCo como no Prometeu Studio. Referência lida: files/config/Jenkinsfile, README correspondente e convenções Gradle do Studio. Escopo: arquivos versionados e validação local no AIE; nenhuma modificação ou execução do Studio e nenhuma configuração/publicação em um controlador Jenkins. Adaptação necessária: AIE usa Java 25, portanto JaCoCo 0.8.14; manter publicação de falhas e limites CLASS/METHOD/LINE/INSTRUCTION 50%, BRANCH 40% com UNSTABLE, como na referência.
@@ -0,0 +1,19 @@
---
schemaVersion: 1
id: "PLN-0001"
workId: "WRK-0004"
title: "Cobertura Gradle e pipeline Jenkins"
decisions: []
steps: []
status: "OPEN"
author: "agent"
createdAt: "2026-11-16T10:18:25.905650Z"
revision: 1
previousHash: null
updatedAt: "2026-11-16T10:18:25.905650Z"
updatedBy: "agent"
changeReason: "Plan created"
documentVersion: 2
---
Configurar JaCoCo compatível com Java 25 e caminhos de relatórios comuns ao Studio; adicionar Jenkinsfile com publicação resiliente; verificar cobertura, sucesso/falha de publicação e documentação operacional.
@@ -0,0 +1,29 @@
---
schemaVersion: 1
id: "PLN-0001"
workId: "WRK-0004"
title: "Cobertura Gradle e pipeline Jenkins"
decisions: []
steps:
- id: "TSK-0001"
title: "Implementar Gradle JaCoCo e pipeline Jenkins"
description: ""
acceptanceCriteria:
- "Testes produzem XML/HTML/exec e pipeline publica relatórios preservando falhas."
dependsOn: []
status: "OPEN"
result: ""
evidence: []
updatedAt: "2026-11-16T10:18:26.659578Z"
status: "OPEN"
author: "agent"
createdAt: "2026-11-16T10:18:25.905650Z"
revision: 2
previousHash: "ae536b43c1c8af919104c9d40a95ea258883f7a31692c067090445f99117258d"
updatedAt: "2026-11-16T10:18:26.659639Z"
updatedBy: "agent"
changeReason: "Step added"
documentVersion: 2
---
Configurar JaCoCo compatível com Java 25 e caminhos de relatórios comuns ao Studio; adicionar Jenkinsfile com publicação resiliente; verificar cobertura, sucesso/falha de publicação e documentação operacional.
@@ -0,0 +1,41 @@
---
schemaVersion: 1
id: "PLN-0001"
workId: "WRK-0004"
title: "Cobertura Gradle e pipeline Jenkins"
decisions: []
steps:
- id: "TSK-0001"
title: "Implementar Gradle JaCoCo e pipeline Jenkins"
description: ""
acceptanceCriteria:
- "Testes produzem XML/HTML/exec e pipeline publica relatórios preservando falhas."
dependsOn: []
status: "OPEN"
result: ""
evidence: []
updatedAt: "2026-11-16T10:18:26.659578Z"
- id: "TSK-0002"
title: "Validar cobertura e documentar operação"
description: ""
acceptanceCriteria:
- "Verificação local dos testes e relatórios, cenários de publicação e instruçõ\
es para configuração no Jenkins."
dependsOn:
- "TSK-0001"
status: "OPEN"
result: ""
evidence: []
updatedAt: "2026-11-16T10:18:27.530841Z"
status: "OPEN"
author: "agent"
createdAt: "2026-11-16T10:18:25.905650Z"
revision: 3
previousHash: "560695eb6994971ba9120c2fd328b24876e11438781dba363b4917e4a9b83292"
updatedAt: "2026-11-16T10:18:27.530899Z"
updatedBy: "agent"
changeReason: "Step added"
documentVersion: 2
---
Configurar JaCoCo compatível com Java 25 e caminhos de relatórios comuns ao Studio; adicionar Jenkinsfile com publicação resiliente; verificar cobertura, sucesso/falha de publicação e documentação operacional.
@@ -0,0 +1,41 @@
---
schemaVersion: 1
id: "PLN-0001"
workId: "WRK-0004"
title: "Cobertura Gradle e pipeline Jenkins"
decisions: []
steps:
- id: "TSK-0001"
title: "Implementar Gradle JaCoCo e pipeline Jenkins"
description: ""
acceptanceCriteria:
- "Testes produzem XML/HTML/exec e pipeline publica relatórios preservando falhas."
dependsOn: []
status: "ACTIVE"
result: "Implementação autorizada pelo usuário."
evidence: []
updatedAt: "2026-11-16T10:18:28.544873Z"
- id: "TSK-0002"
title: "Validar cobertura e documentar operação"
description: ""
acceptanceCriteria:
- "Verificação local dos testes e relatórios, cenários de publicação e instruçõ\
es para configuração no Jenkins."
dependsOn:
- "TSK-0001"
status: "OPEN"
result: ""
evidence: []
updatedAt: "2026-11-16T10:18:27.530841Z"
status: "ACTIVE"
author: "agent"
createdAt: "2026-11-16T10:18:25.905650Z"
revision: 4
previousHash: "192ae5fcc16bd8d36f70d791a5cc3913a1acc7bd785bf5f268cfacbe73afbcc0"
updatedAt: "2026-11-16T10:18:28.544893Z"
updatedBy: "agent"
changeReason: "Implementação autorizada pelo usuário."
documentVersion: 2
---
Configurar JaCoCo compatível com Java 25 e caminhos de relatórios comuns ao Studio; adicionar Jenkinsfile com publicação resiliente; verificar cobertura, sucesso/falha de publicação e documentação operacional.
@@ -0,0 +1,44 @@
---
schemaVersion: 1
id: "PLN-0001"
workId: "WRK-0004"
title: "Cobertura Gradle e pipeline Jenkins"
decisions: []
steps:
- id: "TSK-0001"
title: "Implementar Gradle JaCoCo e pipeline Jenkins"
description: ""
acceptanceCriteria:
- "Testes produzem XML/HTML/exec e pipeline publica relatórios preservando falhas."
dependsOn: []
status: "COMPLETED"
result: "Gradle JaCoCo, pipeline e fixture implementados; 11 cenários passaram e\
\ a falha controlada gerou relatórios sem ocultar exit 1."
evidence:
- "ART-0001"
updatedAt: "2026-11-16T10:26:15.248190Z"
- id: "TSK-0002"
title: "Validar cobertura e documentar operação"
description: ""
acceptanceCriteria:
- "Verificação local dos testes e relatórios, cenários de publicação e instruçõ\
es para configuração no Jenkins."
dependsOn:
- "TSK-0001"
status: "OPEN"
result: ""
evidence: []
updatedAt: "2026-11-16T10:18:27.530841Z"
status: "ACTIVE"
author: "agent"
createdAt: "2026-11-16T10:18:25.905650Z"
revision: 5
previousHash: "d8ea2eb9febbe6540b809ae2e5637073819a40f90e1eda11ffcaaec940b90750"
updatedAt: "2026-11-16T10:26:15.248214Z"
updatedBy: "agent"
changeReason: "Gradle JaCoCo, pipeline e fixture implementados; 11 cenários passaram\
\ e a falha controlada gerou relatórios sem ocultar exit 1."
documentVersion: 2
---
Configurar JaCoCo compatível com Java 25 e caminhos de relatórios comuns ao Studio; adicionar Jenkinsfile com publicação resiliente; verificar cobertura, sucesso/falha de publicação e documentação operacional.
@@ -0,0 +1,45 @@
---
schemaVersion: 1
id: "PLN-0001"
workId: "WRK-0004"
title: "Cobertura Gradle e pipeline Jenkins"
decisions: []
steps:
- id: "TSK-0001"
title: "Implementar Gradle JaCoCo e pipeline Jenkins"
description: ""
acceptanceCriteria:
- "Testes produzem XML/HTML/exec e pipeline publica relatórios preservando falhas."
dependsOn: []
status: "COMPLETED"
result: "Gradle JaCoCo, pipeline e fixture implementados; 11 cenários passaram e\
\ a falha controlada gerou relatórios sem ocultar exit 1."
evidence:
- "ART-0001"
updatedAt: "2026-11-16T10:26:15.248190Z"
- id: "TSK-0002"
title: "Validar cobertura e documentar operação"
description: ""
acceptanceCriteria:
- "Verificação local dos testes e relatórios, cenários de publicação e instruçõ\
es para configuração no Jenkins."
dependsOn:
- "TSK-0001"
status: "ACTIVE"
result: "Documentação pronta; comando completo de CI está executando a suíte JVM\
\ com cobertura."
evidence: []
updatedAt: "2026-11-16T10:26:16.075092Z"
status: "ACTIVE"
author: "agent"
createdAt: "2026-11-16T10:18:25.905650Z"
revision: 6
previousHash: "e80197ce2e9082843daa828ea3ad9e672025e822c31105273d5a6597909a546b"
updatedAt: "2026-11-16T10:26:16.075113Z"
updatedBy: "agent"
changeReason: "Documentação pronta; comando completo de CI está executando a suíte\
\ JVM com cobertura."
documentVersion: 2
---
Configurar JaCoCo compatível com Java 25 e caminhos de relatórios comuns ao Studio; adicionar Jenkinsfile com publicação resiliente; verificar cobertura, sucesso/falha de publicação e documentação operacional.
@@ -0,0 +1,48 @@
---
schemaVersion: 1
id: "PLN-0001"
workId: "WRK-0004"
title: "Cobertura Gradle e pipeline Jenkins"
decisions: []
steps:
- id: "TSK-0001"
title: "Implementar Gradle JaCoCo e pipeline Jenkins"
description: ""
acceptanceCriteria:
- "Testes produzem XML/HTML/exec e pipeline publica relatórios preservando falhas."
dependsOn: []
status: "COMPLETED"
result: "Gradle JaCoCo, pipeline e fixture implementados; 11 cenários passaram e\
\ a falha controlada gerou relatórios sem ocultar exit 1."
evidence:
- "ART-0001"
updatedAt: "2026-11-16T10:26:15.248190Z"
- id: "TSK-0002"
title: "Validar cobertura e documentar operação"
description: ""
acceptanceCriteria:
- "Verificação local dos testes e relatórios, cenários de publicação e instruçõ\
es para configuração no Jenkins."
dependsOn:
- "TSK-0001"
status: "COMPLETED"
result: "Comando completo do pipeline passou: 126 testes JVM e 11 cenários; relató\
rios validados; linhas 92,37% e branches 69,37%; falha controlada preservou exit\
\ 1 e relatórios; setup Jenkins documentado."
evidence:
- "ART-0002"
updatedAt: "2026-11-16T10:32:23.245995Z"
status: "ACTIVE"
author: "agent"
createdAt: "2026-11-16T10:18:25.905650Z"
revision: 7
previousHash: "9830be99ce22f0cd0d6e2764d4995116ce3aafb35c483e586996ac34155df583"
updatedAt: "2026-11-16T10:32:23.246019Z"
updatedBy: "agent"
changeReason: "Comando completo do pipeline passou: 126 testes JVM e 11 cenários;\
\ relatórios validados; linhas 92,37% e branches 69,37%; falha controlada preservou\
\ exit 1 e relatórios; setup Jenkins documentado."
documentVersion: 2
---
Configurar JaCoCo compatível com Java 25 e caminhos de relatórios comuns ao Studio; adicionar Jenkinsfile com publicação resiliente; verificar cobertura, sucesso/falha de publicação e documentação operacional.
@@ -0,0 +1,46 @@
---
schemaVersion: 1
id: "PLN-0001"
workId: "WRK-0004"
title: "Cobertura Gradle e pipeline Jenkins"
decisions: []
steps:
- id: "TSK-0001"
title: "Implementar Gradle JaCoCo e pipeline Jenkins"
description: ""
acceptanceCriteria:
- "Testes produzem XML/HTML/exec e pipeline publica relatórios preservando falhas."
dependsOn: []
status: "COMPLETED"
result: "Gradle JaCoCo, pipeline e fixture implementados; 11 cenários passaram e\
\ a falha controlada gerou relatórios sem ocultar exit 1."
evidence:
- "ART-0001"
updatedAt: "2026-11-16T10:26:15.248190Z"
- id: "TSK-0002"
title: "Validar cobertura e documentar operação"
description: ""
acceptanceCriteria:
- "Verificação local dos testes e relatórios, cenários de publicação e instruçõ\
es para configuração no Jenkins."
dependsOn:
- "TSK-0001"
status: "COMPLETED"
result: "Comando completo do pipeline passou: 126 testes JVM e 11 cenários; relató\
rios validados; linhas 92,37% e branches 69,37%; falha controlada preservou exit\
\ 1 e relatórios; setup Jenkins documentado."
evidence:
- "ART-0002"
updatedAt: "2026-11-16T10:32:23.245995Z"
status: "COMPLETED"
author: "agent"
createdAt: "2026-11-16T10:18:25.905650Z"
revision: 8
previousHash: "7509d39fb74791dc573f636513bbacbd38ce8059c459b2294dde358b97cb7b96"
updatedAt: "2026-11-16T10:32:23.624351Z"
updatedBy: "system:plans"
changeReason: "All required steps completed; reviewed cancellations retained"
documentVersion: 2
---
Configurar JaCoCo compatível com Java 25 e caminhos de relatórios comuns ao Studio; adicionar Jenkinsfile com publicação resiliente; verificar cobertura, sucesso/falha de publicação e documentação operacional.
@@ -0,0 +1,75 @@
---
schemaVersion: 1
id: "WRK-0004"
title: "Pipeline Jenkins com cobertura JaCoCo"
description: "Configuração versionada Jenkins/Gradle inspirada no Studio e validada\
\ localmente com testes reais, JaCoCo e fixture de Pipeline. A configuração e execuç\
ão de um controlador Jenkins real permanecem externas ao escopo desta implementaç\
ão."
goal: "Adicionar testes e relatórios de cobertura JaCoCo ao CI Jenkins seguindo o\
\ padrão do Prometeu Studio."
motivation: ""
constraints:
- "Preservar Works concluídos e não modificar o projeto Studio de referência."
acceptanceCriteria:
- "Pipeline versionado executa testes pelo Gradle Wrapper e publica resultados JUnit\
\ e cobertura JaCoCo no Jenkins."
- "Relatórios de cobertura XML e HTML são gerados e validados localmente, com documentaç\
ão de configuração e execução."
status: "COMPLETED"
createdAt: "2026-11-16T10:17:15.272568Z"
updatedAt: "2026-11-16T10:32:24.081353Z"
author: "agent"
repositories:
- repositoryId: "ai-engineering"
path: "."
head: "3dd04a730fb314f64fe393bc8ad65da35e1fc3d2"
dirty: false
discussions:
- "DSC-0001"
decisions: []
artifacts:
- "ART-0001"
- "ART-0002"
- "ART-0003"
plans:
- "PLN-0001"
completions:
- at: "2026-11-16T10:32:24.081353Z"
by: "system:plans"
summary: "All required Plans completed; requester=agent"
humanApproved: false
scopeHash: "720b566f9e5df71ffba5fbfabe5bf846c0a73c06ba4769214ba036a378a6689f"
criteria:
- criterion: 1
text: "Pipeline versionado executa testes pelo Gradle Wrapper e publica resultados\
\ JUnit e cobertura JaCoCo no Jenkins."
evidence:
- "ART-0003"
- criterion: 2
text: "Relatórios de cobertura XML e HTML são gerados e validados localmente,\
\ com documentação de configuração e execução."
evidence:
- "ART-0003"
integrations: []
noIntegrationReason: "Canonical changes and execution results are recorded in the\
\ Plan step evidence"
origin: "SYSTEM_PLANS"
delegation: null
aggregation:
receipt: "ART-0003"
inputHash: "7e1cdbcf33f7ce9a9aa88caad8a39981760b868f4a8a29988c14b934794a1197"
requester: "agent"
requestId: "b2fec2f6-5b7c-4cd4-8e33-4770f49efb51"
events:
- action: "COMPLETE"
by: "system:plans"
reason: "All required Plans completed; requester=agent"
at: "2026-11-16T10:32:24.081353Z"
archived: false
topics: []
surveys: []
dispositions: []
agentRuns: []
epic: false
---
+16
View File
@@ -72,6 +72,22 @@ macOS x86_64 remains a target with an upstream toolchain availability limitation
GraalVM 25 dropped that port; see [roadmap](docs/roadmap.md). Local verification
results, including which native binaries were actually tested, are in [experiments](docs/experiments.md).
## Jenkins tests and coverage
The Jenkins pipeline is [files/config/Jenkinsfile](files/config/Jenkinsfile). Configure
that Script Path in a Pipeline from SCM job on a Unix agent with JDK 25 and Git.
It runs tests with JaCoCo and publishes JUnit, coverage XML/HTML and raw execution
data, including available diagnostics after failures. Coverage gates follow Studio.
```sh
./gradlew test jacocoTestReport jenkinsPipelineTest --continue --console=plain
```
Coverage HTML is generated at
`build/reports/jacoco/jacocoTestReport/html/index.html`. See the
[Jenkins setup and verification guide](files/config/README.md) for required plugins,
thresholds, report paths and the boundary between local checks and a controller run.
## Start in a simple project
Run inside the folder you already use for your application, game or library:
+23
View File
@@ -2,6 +2,7 @@ import org.gradle.api.tasks.bundling.Compression
plugins {
java
jacoco
id("org.springframework.boot") version "4.0.9"
id("org.graalvm.buildtools.native") version "0.11.5"
}
@@ -36,7 +37,29 @@ tasks.test {
useJUnitPlatform()
dependsOn(tasks.bootJar)
systemProperty("cli.jar", tasks.bootJar.get().archiveFile.get().asFile.absolutePath)
finalizedBy(tasks.jacocoTestReport)
}
jacoco { toolVersion = "0.8.14" }
tasks.jacocoTestReport {
// Ordering, not a success dependency: failed tests must still produce reports.
mustRunAfter(tasks.test)
reports {
xml.required.set(true)
xml.outputLocation.set(layout.buildDirectory.file("reports/jacoco/jacocoTestReport/jacocoTestReport.xml"))
html.required.set(true)
html.outputLocation.set(layout.buildDirectory.dir("reports/jacoco/jacocoTestReport/html"))
csv.required.set(false)
}
}
val jenkinsPipelineTest = tasks.register("jenkinsPipelineTest") {
group = "verification"
description = "Checks Jenkins publication behavior with a local Pipeline step fixture (no controller required)."
val fixture = layout.projectDirectory.file("scripts/test-jenkins-pipeline.groovy")
val pipeline = layout.projectDirectory.file("files/config/Jenkinsfile")
inputs.files(fixture, pipeline)
doLast { groovy.lang.GroovyShell().run(fixture.asFile, arrayOf(pipeline.asFile.absolutePath)) }
}
tasks.check { dependsOn(jenkinsPipelineTest) }
springBoot { mainClass = "net.intrepid.aiengineering.AiEngineeringApplication" }
graalvmNative {
binaries.named("main") {
+90
View File
@@ -0,0 +1,90 @@
pipeline {
agent any
environment {
GRADLE_USER_HOME = '/var/jenkins_home/.gradle'
GRADLE_OPTS = '-Dorg.gradle.parallel=true -Dorg.gradle.caching=true'
TESTS_STARTED = 'false'
VERIFICATION_SUCCEEDED = 'false'
}
stages {
stage('Clean') {
steps {
// A failed clean must not publish a previous build's reports.
withGradle {
sh './gradlew clean --no-daemon --console=plain'
}
}
}
stage('Tests and coverage') {
steps {
script { env.TESTS_STARTED = 'true' }
withChecks(name: 'Test', includeStage: true) {
withGradle {
// Continue independent verification while retaining a nonzero exit on failure.
sh './gradlew test jacocoTestReport jenkinsPipelineTest --continue --parallel --max-workers=2 --build-cache --no-daemon --console=plain'
}
}
script { env.VERIFICATION_SUCCEEDED = 'true' }
}
}
}
post {
always {
script {
if (env.TESTS_STARTED == 'true') {
// Attempt each publisher even if another publisher fails.
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
junit testResults: 'build/test-results/test/TEST-*.xml',
checksName: 'Test / Tests and coverage',
allowEmptyResults: env.VERIFICATION_SUCCEEDED != 'true'
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
if (fileExists('build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml')) {
withChecks(name: 'JaCoCo Coverage', includeStage: false) {
recordCoverage(tools: [[parser: 'JACOCO', pattern: 'build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml']],
id: 'jacoco',
name: 'JaCoCo Coverage',
checksName: 'JaCoCo Coverage',
enabledForFailure: true,
failOnError: true,
sourceDirectories: [[path: 'src/main/java']],
sourceCodeEncoding: 'UTF-8',
sourceCodeRetention: 'EVERY_BUILD',
qualityGates: [
[threshold: 50.0, metric: 'CLASS', baseline: 'PROJECT', criticality: 'UNSTABLE'],
[threshold: 50.0, metric: 'METHOD', baseline: 'PROJECT', criticality: 'UNSTABLE'],
[threshold: 50.0, metric: 'LINE', baseline: 'PROJECT', criticality: 'UNSTABLE'],
[threshold: 50.0, metric: 'INSTRUCTION', baseline: 'PROJECT', criticality: 'UNSTABLE'],
[threshold: 40.0, metric: 'BRANCH', baseline: 'PROJECT', criticality: 'UNSTABLE']])
}
} else if (env.VERIFICATION_SUCCEEDED == 'true') {
error 'Successful verification is missing the JaCoCo XML report.'
} else {
echo 'Verification failed before coverage was available; preserving available test reports.'
}
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
publishHTML(target: [
allowMissing: env.VERIFICATION_SUCCEEDED != 'true',
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build/reports/jacoco/jacocoTestReport/html',
reportFiles: 'index.html',
reportName: 'Coverage Report'
])
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
archiveArtifacts artifacts: 'build/test-results/test/**, build/reports/tests/test/**, build/reports/jacoco/**, build/jacoco/*.exec',
allowEmptyArchive: env.VERIFICATION_SUCCEEDED != 'true',
onlyIfSuccessful: false
}
} else {
echo 'Preparation did not complete; no current test run to publish. See the build console for diagnostics.'
}
}
}
}
}
+91
View File
@@ -0,0 +1,91 @@
# Jenkins tests and JaCoCo coverage
Configure a Jenkins Pipeline from SCM using this repository and the Script Path
`files/config/Jenkinsfile`. The pipeline follows the Prometeu Studio reference,
adapted to AIE's single Gradle project and Java 25 target.
Use a Unix agent with Git, JDK 25 and dependency/cache access. No GraalVM compiler,
native executable, sibling project, model CLI or model credentials are required.
The checked-in Gradle Wrapper selects Gradle 9.3.1; no named Jenkins Gradle tool
installation is needed. `GRADLE_USER_HOME` defaults to `/var/jenkins_home/.gradle`,
matching Studio; adjust it if the chosen agent uses another writable cache path.
The AIE CLI has no display requirement. Unlike Studio, this pipeline does not add
global `JAVA_TOOL_OPTIONS`: the JVM prints that variable to stderr and would pollute
the CLI output captured by the separate-process continuity tests.
The controller needs Declarative Pipeline, Gradle (`withGradle`), JUnit, Checks API
(`withChecks`), Coverage (`recordCoverage`) and HTML Publisher plugins. An appropriate
SCM checks provider is needed to publish commit checks. These are the same report
steps used by Studio; this repository does not install or configure controller plugins.
## Commands and reports
```sh
./gradlew clean --no-daemon --console=plain
./gradlew test jacocoTestReport jenkinsPipelineTest --continue --parallel --max-workers=2 --build-cache --no-daemon --console=plain
```
Clean runs separately so a preparation failure cannot publish stale reports as a
new test run. `--continue` retains a failing exit code while allowing independent
verification to finish. `test` finalizes with `jacocoTestReport`; invoking the report
task directly consumes existing execution data. CI schedules both tasks explicitly;
the report has an ordering constraint rather than a dependency on test success,
so a failed test cannot suppress available coverage. JaCoCo 0.8.14 is pinned for Java 25 support.
The report includes the main Java source set without coverage-driven exclusions.
| Output | Workspace-relative location |
|---|---|
| JUnit XML | `build/test-results/test/TEST-*.xml` |
| Test HTML | `build/reports/tests/test/index.html` |
| JaCoCo XML | `build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml` |
| Coverage HTML | `build/reports/jacoco/jacocoTestReport/html/index.html` |
| Raw JaCoCo data | `build/jacoco/test.exec` |
JUnit completes the check `Test / Tests and coverage`; the separate coverage check
is `JaCoCo Coverage`. Configure required SCM check names to match these values.
Coverage gates match Studio: CLASS, METHOD, LINE and INSTRUCTION at 50%, BRANCH at
40%, baseline PROJECT, criticality UNSTABLE. A missed coverage gate makes the Jenkins
build unstable; it does not convert a failed test run into a successful build.
No extra local `jacocoTestCoverageVerification` threshold is imposed.
## Failure reporting
After verification starts, the unconditional post block attempts JUnit, Coverage,
HTML and raw artifact publication independently. An exception in one publisher
does not suppress the others. Coverage processing errors fail publication and
coverage is enabled for failed builds. The archive retains test XML/binary output,
test HTML, coverage XML/HTML and raw `.exec` data on failed and unstable builds too.
Retention follows the Jenkins job's build/artifact policy.
Successful verification must produce nonempty JUnit results, coverage XML and HTML.
Missing successful-build evidence fails publication. Compilation or setup failure
may leave no reports; available diagnostics are retained and the original build
failure remains authoritative. A failed clean attempts no publishers.
## Local validation and limits
```sh
./gradlew jenkinsPipelineTest --console=plain
```
This task executes the actual Jenkinsfile with controlled Pipeline steps, using
Gradle's bundled Groovy without a new application/test dependency. Eleven cases
exercise success, failed clean with stale paths, failed verification with partial
reports, no reports, missing successful-build reports and isolated publisher errors.
The task is also part of `check` and is invoked explicitly by this pipeline.
JUnit/JaCoCo reports come from the JVM `test` task. Separate CLI subprocesses and
native smoke tests are not instrumented by the worker's JaCoCo agent; the report
does not claim native or external-provider coverage. Tests use deterministic
fixtures and require no real model calls.
The local Pipeline fixture is not a Jenkins controller or a plugin implementation.
It cannot certify plugin compatibility, actual SCM checks or UI publication. A run
of the configured Jenkins job is required to verify those integration details.
Existing GitHub Actions native builds remain a separate workflow.
References: [Gradle JaCoCo plugin](https://docs.gradle.org/current/userguide/jacoco_plugin.html),
[JaCoCo 0.8.14 / Java 25](https://github.com/jacoco/jacoco/releases/tag/v0.8.14),
[JUnit](https://www.jenkins.io/doc/pipeline/steps/junit/),
[Coverage](https://www.jenkins.io/doc/pipeline/steps/coverage/) and
[HTML Publisher](https://www.jenkins.io/doc/pipeline/steps/htmlpublisher/).
+136
View File
@@ -0,0 +1,136 @@
import org.codehaus.groovy.control.CompilerConfiguration
// Execute the actual Jenkinsfile with controlled Pipeline steps. This checks our
// control flow; Jenkins plugins, SCM checks and controller validation remain external.
abstract class PipelineFixture extends Script {
Map env = [:]
String result = 'SUCCESS'
String currentStage
Closure stagesBlock
Closure postBlock
boolean failClean = false
boolean failVerification = false
boolean junitAvailable = true
boolean coverageAvailable = true
boolean htmlAvailable = true
boolean archiveAvailable = true
String failedPublisher
List<Map> publications = []
List<String> commands = []
List<String> failures = []
List<Map> checks = []
Object getAny() { 'any' }
void agent(Object ignored) {}
void environment(Closure body) {
body.delegate = env
body.resolveStrategy = Closure.DELEGATE_FIRST
body()
}
void pipeline(Closure body) {
body()
try { stagesBlock() }
catch (RuntimeException failure) { recordFailure(failure) }
finally { postBlock() }
}
void stages(Closure body) { stagesBlock = body }
void post(Closure body) { postBlock = body }
void stage(String name, Closure body) { currentStage = name; body() }
void steps(Closure body) { body() }
void script(Closure body) { body() }
void always(Closure body) { body() }
void withGradle(Closure body) { body() }
void withChecks(Map options, Closure body) { checks << options; body() }
void sh(String command) {
commands << command
if (currentStage == 'Clean' && failClean) throw new IllegalStateException('clean failed')
if (currentStage == 'Tests and coverage' && failVerification) throw new IllegalStateException('verification failed')
}
void catchError(Map options, Closure body) {
assert options.buildResult == 'FAILURE'
try { body() } catch (RuntimeException failure) { recordFailure(failure) }
}
void recordFailure(RuntimeException failure) { result = 'FAILURE'; failures << failure.message }
boolean fileExists(String path) {
assert path == 'build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml'
coverageAvailable
}
void echo(String message) {}
void error(String message) { throw new IllegalStateException(message) }
void publish(String name, Map options) {
publications << [name: name, options: options]
if (failedPublisher == name) throw new IllegalStateException("${name} publisher failed")
}
void junit(Map options) {
publish('junit', options)
if (!junitAvailable && !options.allowEmptyResults) error('missing JUnit')
}
void recordCoverage(Map options) { publish('coverage', options) }
void publishHTML(Map options) {
publish('html', options)
if (!htmlAvailable && !options.target.allowMissing) error('missing HTML')
}
void archiveArtifacts(Map options) {
publish('archive', options)
if (!archiveAvailable && !options.allowEmptyArchive) error('missing artifacts')
}
}
assert args.length == 1 : 'Pass the Jenkinsfile path'
File pipeline = new File(args[0])
assert pipeline.isFile() : "Missing Jenkinsfile: ${pipeline}"
def configuration = new CompilerConfiguration(scriptBaseClass: PipelineFixture.name)
def shell = new GroovyShell(PipelineFixture.classLoader, new Binding(), configuration)
def runPipeline = { Map conditions = [:] ->
PipelineFixture fixture = shell.parse(pipeline) as PipelineFixture
conditions.each { key, value -> fixture.setProperty(key as String, value) }
fixture.run()
fixture
}
def publishers = ['junit', 'coverage', 'html', 'archive']
def successful = runPipeline()
assert successful.result == 'SUCCESS'
assert successful.publications*.name == publishers
assert successful.commands.size() == 2
assert successful.commands[0].startsWith('./gradlew clean ')
assert successful.commands[1].contains('test jacocoTestReport jenkinsPipelineTest --continue')
def junit = successful.publications.find { it.name == 'junit' }.options
assert junit.allowEmptyResults == false
assert junit.checksName == 'Test / Tests and coverage'
def coverage = successful.publications.find { it.name == 'coverage' }.options
assert coverage.enabledForFailure && coverage.failOnError
assert coverage.qualityGates.collectEntries { [(it.metric): it.threshold] } ==
[CLASS: 50.0, METHOD: 50.0, LINE: 50.0, INSTRUCTION: 50.0, BRANCH: 40.0]
assert coverage.qualityGates.every { it.baseline == 'PROJECT' && it.criticality == 'UNSTABLE' }
assert coverage.tools == [[parser: 'JACOCO', pattern: 'build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml']]
assert successful.publications.find { it.name == 'archive' }.options.onlyIfSuccessful == false
def failedClean = runPipeline(failClean: true)
assert failedClean.result == 'FAILURE'
assert failedClean.publications.empty // Even when stale report paths would exist.
assert failedClean.commands.size() == 1
def failedTests = runPipeline(failVerification: true)
assert failedTests.result == 'FAILURE'
assert failedTests.publications*.name == publishers
assert failedTests.env.VERIFICATION_SUCCEEDED == 'false'
assert failedTests.publications.find { it.name == 'junit' }.options.allowEmptyResults
assert failedTests.publications.find { it.name == 'coverage' }.options.enabledForFailure
def noReports = runPipeline(failVerification: true, junitAvailable: false,
coverageAvailable: false, htmlAvailable: false, archiveAvailable: false)
assert noReports.result == 'FAILURE'
assert noReports.publications*.name == ['junit', 'html', 'archive']
assert noReports.failures == ['verification failed']
['junitAvailable', 'coverageAvailable', 'htmlAvailable'].each { report ->
def missing = runPipeline([(report): false])
assert missing.result == 'FAILURE' : "Missing successful-build ${report} was ignored"
assert missing.publications*.name.containsAll(['junit', 'html', 'archive'])
}
publishers.each { publisher ->
def failed = runPipeline(failedPublisher: publisher)
assert failed.result == 'FAILURE'
assert failed.publications*.name == publishers : "${publisher} failure suppressed another publisher"
}
println 'Jenkins pipeline fixture passed: 11 success/failure scenarios (no controller or plugins invoked).'