jenkin jacoco alignment
Some checks failed
Test / Build occurred while executing withChecks step.

This commit is contained in:
bQUARKz 2026-04-07 06:54:23 +01:00
parent ab1b5e2e0a
commit 4c2c8bde98
Signed by: bquarkz
SSH Key Fingerprint: SHA256:Z7dgqoglWwoK6j6u4QC87OveEq74WOhFN+gitsxtkf8
2 changed files with 3 additions and 101 deletions

View File

@ -1,7 +1,8 @@
pipeline {
agent any
environment {
tools {
gradle 'gradle-9.3.1'
}
stages {
@ -10,7 +11,7 @@ pipeline {
withChecks(name: 'Test', includeStage: true) {
withGradle {
sh """
./gradlew clean test jacocoTestReport --no-daemon
gradle clean test jacocoTestReport --no-daemon
"""
}
recordCoverage(tools: [[parser: 'JACOCO', pattern: "build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"]],

View File

@ -1,99 +0,0 @@
package p.studio.shipper;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import p.packer.Packer;
import p.studio.projects.ProjectCatalogService;
import p.studio.projects.ProjectReference;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import static org.junit.jupiter.api.Assertions.*;
final class StudioShipperServiceTest {
@TempDir
Path tempDir;
@Test
void prepareBuildsPackAndManifestForMainFixture() throws Exception {
final Path projectRoot = copyFixture(fixturePath("test-projects/main"), tempDir.resolve("main-project"));
final ProjectReference projectReference = new ProjectCatalogService(tempDir).openProject(projectRoot);
final ArrayList<StudioShipperLogEntry> streamedLogs = new ArrayList<>();
final StudioShipperPrepareResult result;
try (final Packer packer = Packer.bootstrap(new ObjectMapper(), ignored -> { })) {
final StudioShipperService service = new StudioShipperService(packer.workspaceService());
result = service.prepare(projectReference, streamedLogs::add);
}
assertTrue(result.success());
assertEquals(StudioShipperPreparationStatus.SUCCESS, result.status());
assertNotNull(result.buildResult());
assertNotNull(result.validationResult());
assertNotNull(result.packResult());
assertNotNull(result.manifestPath());
assertEquals(result.logs(), streamedLogs);
assertTrue(Files.isRegularFile(projectRoot.resolve("build").resolve("program.pbx")));
assertTrue(Files.isRegularFile(projectRoot.resolve("build").resolve("assets.pa")));
assertTrue(Files.isRegularFile(projectRoot.resolve("build").resolve("manifest.json")));
assertTrue(result.logs().stream().anyMatch(entry -> entry.source() == StudioShipperLogSource.BUILD));
assertTrue(result.logs().stream().anyMatch(entry -> entry.source() == StudioShipperLogSource.PACK_VALIDATION));
assertTrue(result.logs().stream().anyMatch(entry -> entry.source() == StudioShipperLogSource.PACK));
assertTrue(result.logs().stream().anyMatch(entry -> entry.source() == StudioShipperLogSource.MANIFEST));
final String manifestJson = Files.readString(result.manifestPath());
assertTrue(manifestJson.contains("\"magic\""));
assertTrue(manifestJson.contains("\"capabilities\""));
assertTrue(manifestJson.contains("\"asset_table\""));
assertTrue(manifestJson.contains("\"preload\""));
}
@Test
void prepareManifestPreservesCompilerCapabilities() throws Exception {
final Path projectRoot = copyFixture(fixturePath("test-projects/main"), tempDir.resolve("main-capabilities"));
final ProjectReference projectReference = new ProjectCatalogService(tempDir).openProject(projectRoot);
final StudioShipperPrepareResult result;
try (final Packer packer = Packer.bootstrap(new ObjectMapper(), ignored -> { })) {
final StudioShipperService service = new StudioShipperService(packer.workspaceService());
result = service.prepare(projectReference);
}
assertTrue(result.success());
final String manifestJson = Files.readString(result.manifestPath());
assertTrue(manifestJson.contains("\"log\""));
assertTrue(manifestJson.contains("\"gfx\""));
assertTrue(manifestJson.contains("\"asset\""));
}
private Path copyFixture(final Path sourceRoot, final Path targetRoot) throws IOException {
Files.walk(sourceRoot).forEach(source -> {
try {
final Path target = targetRoot.resolve(sourceRoot.relativize(source).toString());
if (Files.isDirectory(source)) {
Files.createDirectories(target);
} else {
Files.createDirectories(target.getParent());
Files.copy(source, target);
}
} catch (IOException ioException) {
throw new RuntimeException(ioException);
}
});
return targetRoot;
}
private Path fixturePath(final String relativePath) {
final Path direct = Path.of(relativePath).toAbsolutePath().normalize();
if (Files.exists(direct)) {
return direct;
}
final Path parent = Path.of("..").resolve(relativePath).toAbsolutePath().normalize();
if (Files.exists(parent)) {
return parent;
}
throw new IllegalArgumentException("fixture not found: " + relativePath);
}
}