Skip to content

Commit

Permalink
Add Windows OS Github Worflow (#7227)
Browse files Browse the repository at this point in the history
  • Loading branch information
tvallin authored Jan 13, 2025
1 parent 48c5b6b commit fa5a34c
Show file tree
Hide file tree
Showing 25 changed files with 150 additions and 109 deletions.
5 changes: 2 additions & 3 deletions .github/actions/common/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ inputs:
runs:
using: "composite"
steps:
- if: ${{ inputs.free-space == 'true' }}
- if: ${{ inputs.free-space == 'true' && runner.os != 'Windows'}}
# See https://github.com/actions/runner-images/issues/2840
name: Free disk space
shell: bash
Expand Down Expand Up @@ -140,8 +140,7 @@ runs:
run: ${{ inputs.run }}
shell: bash
- name: Archive test results
# https://github.com/actions/upload-artifact/issues/240
if: ${{ inputs.test-artifact-name != '' && runner.os != 'Windows' && always() }}
if: ${{ inputs.test-artifact-name != '' && always() }}
uses: actions/upload-artifact@v4
with:
if-no-files-found: 'ignore'
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,21 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
os: [ ubuntu-20.04 ]
os: [ ubuntu-20.04, windows-2022 ]
moduleSet: [ core, it, dbclient, dbclient-oracle, others ]
include:
- { os: ubuntu-20.04, platform: linux }
- { os: windows-2022, platform: windows }
runs-on: ${{ matrix.os }}
name: tests/${{ matrix.moduleSet }}
name: tests/${{ matrix.moduleSet }}-${{matrix.platform}}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: ./.github/actions/common
with:
build-cache: read-only
test-artifact-name: tests-${{ matrix.moduleSet }}
test-artifact-name: tests-${{ matrix.moduleSet }}-${{ matrix.platform }}
run: |
mvn ${MAVEN_ARGS} \
-DreactorRule=tests \
Expand Down Expand Up @@ -311,11 +312,12 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
os: [ ubuntu-20.04, macos-14 ]
os: [ ubuntu-20.04, macos-14, windows-2022 ]
packaging: [ jar, jlink ]
include:
- { os: ubuntu-20.04, platform: linux }
- { os: macos-14, platform: macos }
- { os: windows-2022, platform: windows }
runs-on: ${{ matrix.os }}
name: tests/packaging-${{ matrix.packaging }}-${{ matrix.platform }}
steps:
Expand All @@ -337,11 +339,12 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
os: [ ubuntu-20.04, macos-14 ]
os: [ ubuntu-20.04, macos-14, windows-2022 ]
module: [ mp-1, mp-2, mp-3, se-1, inject ]
include:
- { os: ubuntu-20.04, platform: linux }
- { os: macos-14, platform: macos }
- { os: windows-2022, platform: windows }
runs-on: ${{ matrix.os }}
name: tests/native-image-${{ matrix.module }}-${{ matrix.platform }}
steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2024 Oracle and/or its affiliates.
* Copyright (c) 2022, 2025 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -56,7 +56,11 @@ void testIt() throws Exception {
.build();
DefaultPrettyPrinter printer = new DefaultPrettyPrinter();
String json = mapper.writer(printer).writeValueAsString(customNamed);
assertThat(json, equalTo("{\n" + " \"stringSet\" : [ \"b\", \"a\", \"y\" ]\n" + "}"));
assertThat(json, equalTo("{"
+ System.lineSeparator()
+ " \"stringSet\" : [ \"b\", \"a\", \"y\" ]"
+ System.lineSeparator()
+ "}"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.helidon.integrations.oci.sdk.runtime;

import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Path;
Expand Down Expand Up @@ -159,7 +160,14 @@ static boolean canReadPath(String pathName) {
}

static String userHomePrivateKeyPath(OciConfig ociConfig) {
return Paths.get(System.getProperty("user.home"), ".oci", ociConfig.authKeyFile()).toString();
return normalizePath(Paths.get(System.getProperty("user.home"), ".oci", ociConfig.authKeyFile()).toString());
}

private static String normalizePath(String value) {
if (value == null) {
return null;
}
return value.replace(File.separator, "/");
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 Oracle and/or its affiliates.
* Copyright (c) 2024, 2025 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,8 @@
import io.helidon.microprofile.testing.junit5.HelidonTest;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
Expand All @@ -29,6 +31,7 @@
class TestTracerAtStartup {

@Test
@DisabledOnOs(value = OS.WINDOWS, disabledReason = "https://github.com/helidon-io/helidon/issues/9513")
void checkForFullFeaturedTracerAtStartup() {
assertThat("Global tracer from start-up extension",
TestExtension.globalTracerAtStartup.unwrap(io.opentelemetry.api.trace.Tracer.class).getClass().getName(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2024 Oracle and/or its affiliates.
* Copyright (c) 2022, 2025 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -106,6 +106,7 @@ public void onBeforeClass(ITestClass iTestClass) {
testClass = iTestClass.getRealClass();
HelidonTest testAnnot = testClass.getAnnotation(HelidonTest.class);
if (testAnnot == null) {
helidonTest = false;
return;
}
helidonTest = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Oracle and/or its affiliates.
* Copyright (c) 2023, 2025 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,26 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.helidon.microprofile.telemetry;

import static java.util.Comparator.comparingLong;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.hamcrest.MatcherAssert.assertThat;

import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;

import org.awaitility.Awaitility;

import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.export.SpanExporter;
import jakarta.enterprise.context.ApplicationScoped;
import org.awaitility.Awaitility;
import org.hamcrest.Matchers;

import static java.util.Comparator.comparingLong;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.hamcrest.MatcherAssert.assertThat;

@ApplicationScoped
public class InMemorySpanExporter implements SpanExporter {
private boolean isStopped = false;
Expand All @@ -48,7 +46,8 @@ public List<SpanData> getFinishedSpanItems(int spanCount) {
}

public void assertSpanCount(int spanCount) {
Awaitility.await().pollDelay(3, SECONDS).atMost(10, SECONDS)
Awaitility.await()
.pollDelay(3, SECONDS).atMost(10, SECONDS)
.untilAsserted(() -> assertThat(finishedSpanItems.size(), Matchers.is(spanCount)));
}

Expand All @@ -57,6 +56,7 @@ public void reset() {
}

@Override
@SuppressWarnings("NullableProblems")
public CompletableResultCode export(Collection<SpanData> spans) {
if (isStopped) {
return CompletableResultCode.ofFailure();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Oracle and/or its affiliates.
* Copyright (c) 2023, 2025 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.helidon.microprofile.telemetry;

import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSpanExporterProvider;
import io.opentelemetry.sdk.trace.export.SpanExporter;
import jakarta.enterprise.inject.spi.CDI;

@SuppressWarnings("NullableProblems")
public class InMemorySpanExporterProvider implements ConfigurableSpanExporterProvider {
@Override
public SpanExporter createExporter(final ConfigProperties config) {
Expand All @@ -31,4 +31,4 @@ public SpanExporter createExporter(final ConfigProperties config) {
public String getName() {
return "in-memory";
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, 2024 Oracle and/or its affiliates.
* Copyright (c) 2023, 2025 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,31 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/


package io.helidon.microprofile.telemetry;

import java.util.List;

import io.helidon.http.Status;
import io.helidon.microprofile.telemetry.InMemorySpanExporterProvider;
import io.helidon.microprofile.testing.junit5.AddBean;
import io.helidon.microprofile.testing.junit5.AddConfig;
import io.helidon.microprofile.testing.junit5.AddExtension;
import io.helidon.microprofile.testing.junit5.AddConfigBlock;
import io.helidon.microprofile.testing.junit5.HelidonTest;
import io.helidon.tracing.Span;
import io.helidon.tracing.Tracer;

import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.instrumentation.annotations.WithSpan;
import io.opentelemetry.sdk.trace.data.SpanData;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.client.WebTarget;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.Response;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand All @@ -53,10 +47,12 @@
@AddBean(RestSpanHierarchyTest.SpanResource.class)
@AddBean(InMemorySpanExporter.class)
@AddBean(InMemorySpanExporterProvider.class)
@AddConfig(key = "otel.service.name", value = "helidon-mp-telemetry")
@AddConfig(key = "otel.sdk.disabled", value = "false")
@AddConfig(key = "telemetry.span.full.url", value = "false")
@AddConfig(key = "otel.traces.exporter", value = "in-memory")
@AddConfigBlock("""
otel.service.name=helidon-mp-telemetry
otel.sdk.disabled=false
otel.traces.exporter=in-memory
telemetry.span.full.url=false
""")
public class RestSpanHierarchyTest {

@Inject
Expand All @@ -72,7 +68,6 @@ void setup() {

@Test
void spanHierarchy() {

assertThat(webTarget.path("mixed").request().get().getStatus(), is(Response.Status.OK.getStatusCode()));

List<SpanData> spanItems = spanExporter.getFinishedSpanItems(4);
Expand All @@ -81,12 +76,10 @@ void spanHierarchy() {
assertThat(spanItems.get(0).getAttributes().get(AttributeKey.stringKey("attribute")), is("value"));
assertThat(spanItems.get(0).getParentSpanId(), is(spanItems.get(1).getSpanId()));


assertThat(spanItems.get(1).getKind(), is(INTERNAL));
assertThat(spanItems.get(1).getName(), is("mixed_parent"));
assertThat(spanItems.get(1).getParentSpanId(), is(spanItems.get(2).getSpanId()));


assertThat(spanItems.get(2).getKind(), is(SERVER));
assertThat(spanItems.get(2).getName(), is("/mixed"));
}
Expand Down Expand Up @@ -119,17 +112,16 @@ void spanHierarchyInjected() {
public static class SpanResource {

@Inject
private io.helidon.tracing.Tracer helidonTracerInjected;

private Tracer helidonTracerInjected;

@GET
@Path("mixed")
@WithSpan("mixed_parent")
public Response mixedSpan() {

io.helidon.tracing.Tracer helidonTracer = io.helidon.tracing.Tracer.global();
io.helidon.tracing.Span mixedSpan = helidonTracer.spanBuilder("mixed_inner")
.kind(io.helidon.tracing.Span.Kind.SERVER)
Tracer helidonTracer = Tracer.global();
Span mixedSpan = helidonTracer.spanBuilder("mixed_inner")
.kind(Span.Kind.SERVER)
.tag("attribute", "value")
.start();
mixedSpan.end();
Expand All @@ -142,8 +134,8 @@ public Response mixedSpan() {
@WithSpan("mixed_parent_injected")
public Response mixedSpanInjected() {

io.helidon.tracing.Span mixedSpan = helidonTracerInjected.spanBuilder("mixed_inner_injected")
.kind(io.helidon.tracing.Span.Kind.SERVER)
Span mixedSpan = helidonTracerInjected.spanBuilder("mixed_inner_injected")
.kind(Span.Kind.SERVER)
.tag("attribute", "value")
.start();
mixedSpan.end();
Expand Down
Loading

0 comments on commit fa5a34c

Please sign in to comment.