From bd643b6d49606029b09cbac38438f9d4ef263dc9 Mon Sep 17 00:00:00 2001 From: Javier Aliaga Date: Tue, 26 Aug 2025 15:44:22 +0200 Subject: [PATCH] chore: Fix build ci Signed-off-by: Javier Aliaga --- .github/scripts/health_check_script.sh | 25 ----------- .github/workflows/build.yml | 8 +--- .../workflows/chain/DemoChainClient.java | 14 +++--- .../faninout/DemoFanInOutClient.java | 7 ++- .../DemoSuspendResumeClient.java | 2 +- .../examples/workflows/utils/RetryUtils.java | 44 +++++++++---------- pom.xml | 12 +++++ sdk-tests/pom.xml | 12 ----- 8 files changed, 47 insertions(+), 77 deletions(-) delete mode 100755 .github/scripts/health_check_script.sh diff --git a/.github/scripts/health_check_script.sh b/.github/scripts/health_check_script.sh deleted file mode 100755 index 15ea375bc..000000000 --- a/.github/scripts/health_check_script.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -wait_for_dapr() { - local port="${1:-3500}" - local max_tries="${2:-60}" - local url="http://localhost:${port}/v1.0/healthz" - local code="" - - for i in $(seq 1 "$max_tries"); do - code=$(curl -s -o /dev/null -w "%{http_code}" "$url" || true) - if [ "$code" = "204" ]; then - echo "Ready (204) on port ${port}" - return 0 # do not exit; just return - fi - sleep 1 - done - - echo "Timeout after ${max_tries}s waiting for 204 on port ${port} (last code: ${code})" - return 0 # keep returning success to avoid exiting callers using set -e -} - -# Example usage: -# wait_for_dapr # uses defaults: port 3500, tries 60 -# wait_for_dapr 3501 # custom port, default tries -# wait_for_dapr 3501 30 # custom port and tries diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c80263093..7bbebe247 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,18 +112,14 @@ jobs: wget -q ${{ env.TOXIPROXY_URL }} -O /home/runner/.local/bin/toxiproxy-server chmod +x /home/runner/.local/bin/toxiproxy-server /home/runner/.local/bin/toxiproxy-server --version - - name: Clean up files - run: ./mvnw clean -B - - name: Build sdk - run: ./mvnw compile -B -q + - name: Clean up and install sdk + run: ./mvnw clean install -B -q -DskipTests - name: Unit tests run: ./mvnw test # making it temporarily verbose. env: DOCKER_HOST: ${{steps.setup_docker.outputs.sock}} - name: Codecov uses: codecov/codecov-action@v5.5.0 - - name: Install jars - run: ./mvnw install -q -B -DskipTests - name: Integration tests using spring boot version ${{ matrix.spring-boot-version }} id: integration_tests run: PRODUCT_SPRING_BOOT_VERSION=${{ matrix.spring-boot-version }} ./mvnw -B -Pintegration-tests verify diff --git a/examples/src/main/java/io/dapr/examples/workflows/chain/DemoChainClient.java b/examples/src/main/java/io/dapr/examples/workflows/chain/DemoChainClient.java index 3f0499c97..334e40f8d 100644 --- a/examples/src/main/java/io/dapr/examples/workflows/chain/DemoChainClient.java +++ b/examples/src/main/java/io/dapr/examples/workflows/chain/DemoChainClient.java @@ -30,15 +30,15 @@ public class DemoChainClient { */ public static void main(String[] args) { try (DaprWorkflowClient client = new DaprWorkflowClient(PropertyUtils.getProperties(args))) { - String instanceId = RetryUtils.callWithRetry(() -> client.scheduleNewWorkflow(DemoChainWorkflow.class), - Duration.ofSeconds(60)); + String instanceId = RetryUtils.callWithRetry(() -> client.scheduleNewWorkflow(DemoChainWorkflow.class), + Duration.ofSeconds(60)); - System.out.printf("Started a new chaining model workflow with instance ID: %s%n", instanceId); - WorkflowInstanceStatus workflowInstanceStatus = - client.waitForInstanceCompletion(instanceId, null, true); + System.out.printf("Started a new chaining model workflow with instance ID: %s%n", instanceId); + WorkflowInstanceStatus workflowInstanceStatus = + client.waitForInstanceCompletion(instanceId, null, true); - String result = workflowInstanceStatus.readOutputAs(String.class); - System.out.printf("workflow instance with ID: %s completed with result: %s%n", instanceId, result); + String result = workflowInstanceStatus.readOutputAs(String.class); + System.out.printf("workflow instance with ID: %s completed with result: %s%n", instanceId, result); } catch (TimeoutException | InterruptedException e) { throw new RuntimeException(e); } diff --git a/examples/src/main/java/io/dapr/examples/workflows/faninout/DemoFanInOutClient.java b/examples/src/main/java/io/dapr/examples/workflows/faninout/DemoFanInOutClient.java index d0b429a77..871b15cfe 100644 --- a/examples/src/main/java/io/dapr/examples/workflows/faninout/DemoFanInOutClient.java +++ b/examples/src/main/java/io/dapr/examples/workflows/faninout/DemoFanInOutClient.java @@ -41,12 +41,11 @@ public class DemoFanInOutClient { "Always remember that you are absolutely unique. Just like everyone else."); // Schedule an orchestration which will reliably count the number of words in all the given sentences. - String instanceId = RetryUtils.callWithRetry(() -> client.scheduleNewWorkflow( + String instanceId = RetryUtils.callWithRetry(() -> client.scheduleNewWorkflow( DemoFanInOutWorkflow.class, - listOfStrings), Duration.ofSeconds(60)); + listOfStrings), Duration.ofSeconds(60)); - - System.out.printf("Started a new fan out/fan in model workflow with instance ID: %s%n", instanceId); + System.out.printf("Started a new fan out/fan in model workflow with instance ID: %s%n", instanceId); // Block until the orchestration completes. Then print the final status, which includes the output. WorkflowInstanceStatus workflowInstanceStatus = client.waitForInstanceCompletion( diff --git a/examples/src/main/java/io/dapr/examples/workflows/suspendresume/DemoSuspendResumeClient.java b/examples/src/main/java/io/dapr/examples/workflows/suspendresume/DemoSuspendResumeClient.java index 73c9f18b2..5b94b5fa5 100644 --- a/examples/src/main/java/io/dapr/examples/workflows/suspendresume/DemoSuspendResumeClient.java +++ b/examples/src/main/java/io/dapr/examples/workflows/suspendresume/DemoSuspendResumeClient.java @@ -31,7 +31,7 @@ public class DemoSuspendResumeClient { */ public static void main(String[] args) { try (DaprWorkflowClient client = new DaprWorkflowClient(PropertyUtils.getProperties(args))) { - String instanceId = RetryUtils.callWithRetry(() -> client.scheduleNewWorkflow(DemoExternalEventWorkflow.class), Duration.ofSeconds(60)); + String instanceId = RetryUtils.callWithRetry(() -> client.scheduleNewWorkflow(DemoExternalEventWorkflow.class), Duration.ofSeconds(60)); System.out.printf("Started a new external-event workflow with instance ID: %s%n", instanceId); diff --git a/examples/src/main/java/io/dapr/examples/workflows/utils/RetryUtils.java b/examples/src/main/java/io/dapr/examples/workflows/utils/RetryUtils.java index 68fa957b3..cbcbdca5b 100644 --- a/examples/src/main/java/io/dapr/examples/workflows/utils/RetryUtils.java +++ b/examples/src/main/java/io/dapr/examples/workflows/utils/RetryUtils.java @@ -4,31 +4,31 @@ import java.time.Duration; import java.util.concurrent.Callable; public class RetryUtils { - private static final long RETRY_WAIT_MILLISECONDS = 1000; + private static final long RETRY_WAIT_MILLISECONDS = 1000; - public static String callWithRetry(Callable function, Duration retryTimeout) throws InterruptedException { - var retryTimeoutMilliseconds = retryTimeout.toMillis(); - long started = System.currentTimeMillis(); - while (true) { - Throwable exception; - try { - return function.call(); - } catch (Exception | AssertionError e) { - exception = e; - } + public static String callWithRetry(Callable function, Duration retryTimeout) throws InterruptedException { + var retryTimeoutMilliseconds = retryTimeout.toMillis(); + long started = System.currentTimeMillis(); + while (true) { + Throwable exception; + try { + return function.call(); + } catch (Exception | AssertionError e) { + exception = e; + } - long elapsed = System.currentTimeMillis() - started; - if (elapsed >= retryTimeoutMilliseconds) { - if (exception instanceof RuntimeException) { - throw (RuntimeException) exception; - } - - throw new RuntimeException(exception); - } - - long remaining = retryTimeoutMilliseconds - elapsed; - Thread.sleep(Math.min(remaining, RETRY_WAIT_MILLISECONDS)); + long elapsed = System.currentTimeMillis() - started; + if (elapsed >= retryTimeoutMilliseconds) { + if (exception instanceof RuntimeException) { + throw (RuntimeException) exception; } + + throw new RuntimeException(exception); + } + + long remaining = retryTimeoutMilliseconds - elapsed; + Thread.sleep(Math.min(remaining, RETRY_WAIT_MILLISECONDS)); } + } } diff --git a/pom.xml b/pom.xml index 6ea7d1e51..9f7b17028 100644 --- a/pom.xml +++ b/pom.xml @@ -658,6 +658,18 @@ sdk-tests + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + diff --git a/sdk-tests/pom.xml b/sdk-tests/pom.xml index 7a0fca81d..a9d2e1358 100644 --- a/sdk-tests/pom.xml +++ b/sdk-tests/pom.xml @@ -315,18 +315,6 @@ org.apache.maven.plugins maven-failsafe-plugin 3.2.2 - - - - integration-test - verify - - - - ${skipITs} - - -