From b2c9a951c497f7184a7b782cf0e5d632fb56a933 Mon Sep 17 00:00:00 2001 From: tison Date: Tue, 6 Feb 2024 00:39:03 +0800 Subject: [PATCH] test: fixup test deps and report Signed-off-by: tison --- .github/workflows/ci.yml | 12 ++++++++++-- plugin-maven/build.gradle.kts | 1 + .../org/tisonkun/os/maven/DetectExtensionTest.java | 7 +++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc2ce2d..1f19847 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: - name: Check license header uses: korandoru/hawkeye@v4 - name: Setup Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '21' @@ -56,12 +56,20 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '21' - name: Verify run: ./gradlew test + - name: Upload reports + if: ${{ failure() }} + uses: actions/upload-artifact@v4 + with: + name: reports + path: | + **/build/reports/ + **/build/test-results/ required: name: Required diff --git a/plugin-maven/build.gradle.kts b/plugin-maven/build.gradle.kts index 5b8eb94..8ad8f7a 100644 --- a/plugin-maven/build.gradle.kts +++ b/plugin-maven/build.gradle.kts @@ -47,6 +47,7 @@ dependencies { tasks.test { dependsOn(tasks.publishToMavenLocal) + dependsOn(project(":lib").tasks.publishToMavenLocal) systemProperty("project.basedir", projectDir) systemProperty("project.version", version) } diff --git a/plugin-maven/src/test/java/org/tisonkun/os/maven/DetectExtensionTest.java b/plugin-maven/src/test/java/org/tisonkun/os/maven/DetectExtensionTest.java index cbea153..f829571 100644 --- a/plugin-maven/src/test/java/org/tisonkun/os/maven/DetectExtensionTest.java +++ b/plugin-maven/src/test/java/org/tisonkun/os/maven/DetectExtensionTest.java @@ -37,17 +37,16 @@ void testExtension() throws Exception { final Properties properties = new Properties(); properties.put("os-detector-maven-plugin.version", System.getProperty("project.version")); - final File basedir = new File(System.getProperty("project.basedir"), "src/test/resources/test-project-extension"); final InvocationRequest request = new DefaultInvocationRequest(); - request.setPomFile(new File(basedir, "pom.xml")); + request.setPomFile(new File("src/test/resources/test-project-extension/pom.xml")); request.setProperties(properties); request.setGoals(Collections.singletonList("test")); // FIXME :: test more versions - final String[] mavenVersions = new String[]{"mvn39"}; + final String[] mavenVersions = new String[] {"mvn39"}; for (String mavenVersion : mavenVersions) { final Invoker invoker = new DefaultInvoker(); - invoker.setMavenExecutable(new File(basedir, mavenVersion + "/mvnw")); + invoker.setMavenExecutable(new File(mavenVersion + "/mvnw")); final InvocationResult result = invoker.execute(request); assertThat(result.getExitCode()).isZero(); assertThat(result.getExecutionException()).isNull();