From 4c2c8bde9857a4cd50c68d9d720cc30c41f17239 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Tue, 7 Apr 2026 06:54:23 +0100 Subject: [PATCH] jenkin jacoco alignment --- files/config/Jenkinsfile | 5 +- .../shipper/StudioShipperServiceTest.java | 99 ------------------- 2 files changed, 3 insertions(+), 101 deletions(-) delete mode 100644 prometeu-studio/src/test/java/p/studio/shipper/StudioShipperServiceTest.java diff --git a/files/config/Jenkinsfile b/files/config/Jenkinsfile index 2d925ba7..675c30a2 100644 --- a/files/config/Jenkinsfile +++ b/files/config/Jenkinsfile @@ -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"]], diff --git a/prometeu-studio/src/test/java/p/studio/shipper/StudioShipperServiceTest.java b/prometeu-studio/src/test/java/p/studio/shipper/StudioShipperServiceTest.java deleted file mode 100644 index fef7c1fa..00000000 --- a/prometeu-studio/src/test/java/p/studio/shipper/StudioShipperServiceTest.java +++ /dev/null @@ -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 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); - } -}